212d6f7335
Root layout used title.template ("%s | Epicure") and 38 pages set
their own title, producing "Recipes | Epicure", "Messages — Epicure",
etc. Drop the template, set a flat "Epicure" default, and clear every
page's title override so they all inherit it.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
34 lines
1006 B
TypeScript
34 lines
1006 B
TypeScript
import type { Metadata } from "next";
|
|
import { headers } from "next/headers";
|
|
import { auth } from "@/lib/auth/server";
|
|
import { db, pantryItems, eq, asc } from "@epicure/db";
|
|
import { PantryManager } from "@/components/meal-plan/pantry-manager";
|
|
import { PantryPageHeader } from "@/components/pantry/pantry-page-header";
|
|
|
|
export const metadata: Metadata = {};
|
|
|
|
export default async function PantryPage() {
|
|
const session = await auth.api.getSession({ headers: await headers() });
|
|
if (!session) return null;
|
|
|
|
const items = await db.query.pantryItems.findMany({
|
|
where: eq(pantryItems.userId, session.user.id),
|
|
orderBy: asc(pantryItems.rawName),
|
|
});
|
|
|
|
const mappedItems = items.map((i) => ({
|
|
id: i.id,
|
|
rawName: i.rawName,
|
|
quantity: i.quantity,
|
|
unit: i.unit,
|
|
expiresAt: i.expiresAt?.toISOString() ?? null,
|
|
}));
|
|
|
|
return (
|
|
<div className="space-y-6">
|
|
<PantryPageHeader items={mappedItems} />
|
|
<PantryManager initialItems={mappedItems} />
|
|
</div>
|
|
);
|
|
}
|