diff --git a/app/curator/specials/[id]/page.tsx b/app/curator/specials/[id]/page.tsx index f95c81b..353b1bd 100644 --- a/app/curator/specials/[id]/page.tsx +++ b/app/curator/specials/[id]/page.tsx @@ -1,5 +1,7 @@ 'use client'; +export const dynamic = 'force-dynamic'; + import { useEffect, useState } from 'react'; import { useParams, useRouter, usePathname } from 'next/navigation'; import { useLocale, useTranslations } from 'next-intl'; diff --git a/app/curator/specials/page.tsx b/app/curator/specials/page.tsx index f5f2163..eded37e 100644 --- a/app/curator/specials/page.tsx +++ b/app/curator/specials/page.tsx @@ -1,161 +1,13 @@ 'use client'; -import { useEffect, useState } from 'react'; -import { useLocale, useTranslations } from 'next-intl'; -import { Link } from '@/lib/navigation'; -import { getCuratorAuthHeaders } from '@/lib/curatorAuth'; -import HelpTooltip from '@/components/HelpTooltip'; +// Root /curator/specials route without locale: +// redirect users to the default English locale version. -type LocalizedString = string | { de: string; en: string }; - -interface CuratorSpecialSummary { - id: number; - name: LocalizedString; - songCount: number; -} +import { redirect } from 'next/navigation'; export default function CuratorSpecialsPage() { - const t = useTranslations('Curator'); - const tHelp = useTranslations('CuratorHelp'); - const locale = useLocale(); - const [specials, setSpecials] = useState([]); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(null); - - useEffect(() => { - const fetchSpecials = async () => { - try { - setLoading(true); - const res = await fetch('/api/curator/specials', { - headers: getCuratorAuthHeaders(), - }); - if (res.ok) { - const data = await res.json(); - setSpecials(data); - } else if (res.status === 403) { - setError(t('noSpecialPermissions')); - } else { - setError('Failed to load specials'); - } - } catch (e) { - setError('Failed to load specials'); - } finally { - setLoading(false); - } - }; - - fetchSpecials(); - }, [t]); - - if (loading) { - return ( -
-

{t('loadingData')}

-
- ); - } - - if (error) { - return ( -
-

{error}

-
- ); - } - - if (specials.length === 0) { - return ( -
-

{t('noSpecialsInScope')}

-
- - {t('backToDashboard')} - -
-
- ); - } - - const resolveLocalized = (value: LocalizedString, locale: string): string => { - if (!value) return ''; - if (typeof value === 'string') return value; - const loc = locale === 'de' || locale === 'en' ? locale : 'en'; - return value[loc] ?? value.en ?? value.de; - }; - - return ( -
-
-
-

- {t('curateSpecialsTitle')} -

- -
- - {t('backToDashboard')} - -
-

- {t('curateSpecialsDescription')} -

-
- {specials.map(special => ( - -
-

- {resolveLocalized(special.name, String(locale))} -

-

- {t('curateSpecialSongCount', { count: special.songCount })} -

-
-
- {t('curateSpecialOpen')} -
- - ))} -
-
- ); + redirect('/en/curator/specials'); } +