chore: refactor settings route
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
import type { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
import { getTranscriptionsByYear } from "@/lib/transcriptions";
|
||||
import { buildOgMeta } from "@/lib/og";
|
||||
import { TranscriptionYearBrowser } from "./year-browser";
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ year: string }>;
|
||||
}): Promise<Metadata> {
|
||||
const { year: yearStr } = await params;
|
||||
const year = parseInt(yearStr, 10);
|
||||
if (isNaN(year)) return {};
|
||||
const transcriptions = await getTranscriptionsByYear(year);
|
||||
return buildOgMeta({
|
||||
title: "Transcriptions",
|
||||
detail: `${transcriptions.length} lectures & conversations from ${year}`,
|
||||
quote: `Lectures and conversations of Śrīla Prabhupāda from ${year} — the living voice of the Founder-Ācārya preserved in text.`,
|
||||
});
|
||||
}
|
||||
|
||||
export default async function TranscriptionsByYearPage({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ year: string }>;
|
||||
}) {
|
||||
const { year: yearStr } = await params;
|
||||
const year = parseInt(yearStr, 10);
|
||||
if (isNaN(year)) notFound();
|
||||
|
||||
const transcriptions = await getTranscriptionsByYear(year);
|
||||
if (transcriptions.length === 0) notFound();
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-background">
|
||||
<TranscriptionYearBrowser
|
||||
transcriptions={transcriptions}
|
||||
year={year}
|
||||
totalCount={transcriptions.length}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user