feat: add book transcripts categorisation
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
import type { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
import { getTranscriptionsByBook } from "@/lib/transcriptions";
|
||||
import { bookTitle } from "@/lib/book-reference";
|
||||
import { buildOgMeta } from "@/lib/og";
|
||||
import { TranscriptionBookBrowser } from "./book-browser";
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ book: string }>;
|
||||
}): Promise<Metadata> {
|
||||
const { book } = await params;
|
||||
const title = bookTitle(book);
|
||||
if (!title) return {};
|
||||
const transcriptions = await getTranscriptionsByBook(book.toUpperCase());
|
||||
return buildOgMeta({
|
||||
title: "Transcriptions",
|
||||
detail: `${transcriptions.length} lectures on ${title}`,
|
||||
quote: `Śrīla Prabhupāda's lectures on ${title}, browsable by chapter — the living voice of the Founder-Ācārya preserved in text.`,
|
||||
});
|
||||
}
|
||||
|
||||
export default async function TranscriptionsByBookPage({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ book: string }>;
|
||||
}) {
|
||||
const { book } = await params;
|
||||
const code = book.toUpperCase();
|
||||
const title = bookTitle(code);
|
||||
if (!title) notFound();
|
||||
|
||||
const transcriptions = await getTranscriptionsByBook(code);
|
||||
if (transcriptions.length === 0) notFound();
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-background">
|
||||
<TranscriptionBookBrowser
|
||||
transcriptions={transcriptions}
|
||||
code={code}
|
||||
title={title}
|
||||
totalCount={transcriptions.length}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user