Files

20 lines
929 B
TypeScript

import type { Metadata } from "next";
import { notFound } from "next/navigation";
import MelodyDirectory from "@/components/public/melody-directory";
import { getActiveLocale, isLocale, type Locale } from "@/lib/i18n";
import { getMelodyDirectoryCopy } from "@/lib/melody-content";
type MelodiesPageProps = { params: { locale: string }; searchParams: { category?: string } };
export function generateMetadata({ params }: { params: { locale: string } }): Metadata {
if (!isLocale(params.locale)) return {};
const copy = getMelodyDirectoryCopy(getActiveLocale(params.locale as Locale));
return { title: copy.title, description: copy.description };
}
export default function MelodiesPage({ params, searchParams }: MelodiesPageProps) {
if (!isLocale(params.locale)) notFound();
const locale = getActiveLocale(params.locale as Locale);
return <MelodyDirectory locale={locale} categorySlug={searchParams.category} />;
}