feat: full site build — Project/Melody schema (Option A), admin CRUD, public sections, uploads, email+SMTP, internal analytics, legal pages, docs
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
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<Metadata> {
|
||||
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 <MelodyDetail locale={locale} melody={melody} />;
|
||||
}
|
||||
Reference in New Issue
Block a user