62 lines
2.0 KiB
TypeScript
62 lines
2.0 KiB
TypeScript
export const dynamic = "force-dynamic";
|
|
|
|
import Link from "next/link";
|
|
import { PageHeader } from "@/components/page-header";
|
|
import { Card, CardContent } from "@/components/ui/card";
|
|
import { prisma } from "@/lib/db";
|
|
|
|
async function getAllEssays() {
|
|
return prisma.essay.findMany({
|
|
orderBy: [{ group: "asc" }, { order: "asc" }],
|
|
select: { slug: true, title: true, author: true, year: true, group: true },
|
|
});
|
|
}
|
|
|
|
export default async function EssaysPage() {
|
|
const essays = await getAllEssays();
|
|
|
|
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">Essays</h1>
|
|
<p className="mt-1 text-muted-foreground">
|
|
Standalone essays by Śrīla Prabhupāda
|
|
</p>
|
|
</PageHeader>
|
|
|
|
<main className="max-w-3xl mx-auto px-6 py-8">
|
|
<Card className="divide-y divide-border">
|
|
<CardContent className="p-0">
|
|
<ul className="divide-y divide-border">
|
|
{essays.map((essay) => (
|
|
<li key={essay.slug}>
|
|
<Link
|
|
href={`/essays/${essay.slug}`}
|
|
className="flex flex-col sm:flex-row sm:items-center sm:justify-between px-5 py-4 gap-1 sm:gap-0 hover:bg-muted transition-colors"
|
|
>
|
|
<div>
|
|
<p className="font-medium text-foreground">
|
|
{essay.title}
|
|
</p>
|
|
<p className="text-sm text-muted-foreground">
|
|
{essay.author}
|
|
{essay.year ? ` · ${essay.year}` : ""}
|
|
</p>
|
|
</div>
|
|
</Link>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</CardContent>
|
|
</Card>
|
|
</main>
|
|
</div>
|
|
);
|
|
}
|