import type { Metadata } from "next"; import { notFound } from "next/navigation"; import MelodyDetail from "@/components/public/melody-detail"; import { getActiveLocale, isLocale, type Locale } from "@/lib/i18n"; import { getPublishedMelody } from "@/lib/melody-queries"; type MelodyDetailPageProps = { params: { locale: string; slug: string } }; export async function generateMetadata({ params }: MelodyDetailPageProps): Promise { if (!isLocale(params.locale)) return {}; const melody = await getPublishedMelody(params.slug); if (!melody) return {}; return { title: getActiveLocale(params.locale as Locale) === "ar" ? melody.titleAr : melody.titleEn }; } export default async function MelodyDetailPage({ params }: MelodyDetailPageProps) { if (!isLocale(params.locale)) notFound(); const locale = getActiveLocale(params.locale as Locale); const melody = await getPublishedMelody(params.slug); if (!melody) notFound(); return ; }