chore: refactor settings route
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
import type { Metadata } from "next";
|
||||
import Link from "next/link";
|
||||
import { PageHeader } from "@/components/layout/page-header";
|
||||
import { ogForTranscriptions } from "@/lib/og";
|
||||
import {
|
||||
getTranscriptionYears,
|
||||
getTranscriptionPlaces,
|
||||
getTranscriptionBooks,
|
||||
getTotalTranscriptionCount,
|
||||
getTranscriptionIndex,
|
||||
} from "@/lib/transcriptions";
|
||||
import { TranscriptionsNav } from "./transcriptions-nav";
|
||||
import { TranscriptionsBrowser } from "./transcriptions-browser";
|
||||
|
||||
export function generateMetadata(): Metadata {
|
||||
return ogForTranscriptions();
|
||||
}
|
||||
|
||||
export default async function TranscriptionsPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ view?: string }>;
|
||||
}) {
|
||||
const { view = "year" } = await searchParams;
|
||||
|
||||
const [years, places, books, totalCount, index] = await Promise.all([
|
||||
getTranscriptionYears(),
|
||||
getTranscriptionPlaces(),
|
||||
getTranscriptionBooks(),
|
||||
getTotalTranscriptionCount(),
|
||||
getTranscriptionIndex(),
|
||||
]);
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-background">
|
||||
<PageHeader>
|
||||
<Link
|
||||
href="/"
|
||||
className="text-sm text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
← Home
|
||||
</Link>
|
||||
<h1 className="mt-3 text-3xl font-bold text-foreground">
|
||||
Transcriptions
|
||||
</h1>
|
||||
<p className="mt-1 text-muted-foreground">
|
||||
{totalCount.toLocaleString()} lectures & conversations of
|
||||
Śrīla Prabhupāda (1966–1977)
|
||||
</p>
|
||||
</PageHeader>
|
||||
|
||||
<main className="max-w-4xl mx-auto px-6 py-8 space-y-6">
|
||||
<TranscriptionsNav currentView={view} />
|
||||
|
||||
<TranscriptionsBrowser
|
||||
currentView={view}
|
||||
years={years}
|
||||
places={places}
|
||||
books={books}
|
||||
lectureCount={index.typeDistribution.lecture}
|
||||
conversationCount={index.typeDistribution.conversation}
|
||||
/>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user