diff --git a/apps/dataset-browser/package.json b/apps/dataset-browser/package.json index 1aad4ebee..79d2de05a 100644 --- a/apps/dataset-browser/package.json +++ b/apps/dataset-browser/package.json @@ -32,7 +32,7 @@ "classnames": "2.3.2", "fetch-sparql-endpoint": "4.1.0", "next": "14.0.3", - "next-intl": "3.0.0-beta.19", + "next-intl": "3.1.4", "rdf-object": "1.14.0", "react": "18.2.0", "react-dom": "18.2.0", diff --git a/apps/dataset-browser/src/app/[locale]/dataset-card.tsx b/apps/dataset-browser/src/app/[locale]/dataset-card.tsx index a137dc080..5da1d14da 100644 --- a/apps/dataset-browser/src/app/[locale]/dataset-card.tsx +++ b/apps/dataset-browser/src/app/[locale]/dataset-card.tsx @@ -1,4 +1,4 @@ -import Link from 'next-intl/link'; +import {Link} from '@/navigation'; import {useTranslations} from 'next-intl'; import {Dataset} from '@/lib/datasets'; import {Badge} from '@colonial-collections/ui'; diff --git a/apps/dataset-browser/src/app/[locale]/datasets/[id]/back-button.tsx b/apps/dataset-browser/src/app/[locale]/datasets/[id]/back-button.tsx new file mode 100644 index 000000000..54d3f2005 --- /dev/null +++ b/apps/dataset-browser/src/app/[locale]/datasets/[id]/back-button.tsx @@ -0,0 +1,19 @@ +'use client'; + +import {Link} from '@/navigation'; +import {useListHref} from '@colonial-collections/list-store'; +import {ReactNode} from 'react'; + +export default function BackButton({children}: {children: ReactNode}) { + const href = useListHref(); + + return ( + + {children} + + ); +} diff --git a/apps/dataset-browser/src/app/[locale]/datasets/[id]/page.tsx b/apps/dataset-browser/src/app/[locale]/datasets/[id]/page.tsx index f0eb5fcb0..39cf98986 100644 --- a/apps/dataset-browser/src/app/[locale]/datasets/[id]/page.tsx +++ b/apps/dataset-browser/src/app/[locale]/datasets/[id]/page.tsx @@ -1,5 +1,4 @@ -import {getTranslator, getFormatter} from 'next-intl/server'; -import {useLocale} from 'next-intl'; +import {getTranslations, getFormatter} from 'next-intl/server'; import { PageHeader, PageTitle, @@ -11,14 +10,14 @@ import { LocalizedMarkdown, } from '@colonial-collections/ui'; import { - ChevronLeftIcon, InformationCircleIcon, + ChevronLeftIcon, } from '@heroicons/react/24/solid'; import datasetFetcher from '@/lib/dataset-fetcher-instance'; import {Fragment} from 'react'; import BooleanMeasurement from '@/components/boolean-measurement'; import metricIds from '@/lib/transparency-metrics'; -import {ToFilteredListButton} from '@colonial-collections/ui/list'; +import BackButton from './back-button'; interface Props { params: {id: string}; @@ -30,10 +29,9 @@ export const revalidate = 0; export default async function Details({params}: Props) { const id = decodeURIComponent(params.id); const dataset = await datasetFetcher.getById({id}); - const locale = useLocale(); - const t = await getTranslator(locale, 'Details'); - const tMetrics = await getTranslator(locale, 'TransparencyMetrics'); - const format = await getFormatter(locale); + const t = await getTranslations('Details'); + const tMetrics = await getTranslations('TransparencyMetrics'); + const format = await getFormatter(); if (!dataset) { return