3636ab27ae
AI-generated weekly meal plans with pantry-awareness. Manual entry per slot. Pantry inventory management. Auto-generated shopping lists from meal plan. Weekly nutrition bar chart vs daily goals. Nutrition goals settings.
32 lines
991 B
TypeScript
32 lines
991 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 = { title: "Pantry" };
|
|
|
|
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),
|
|
});
|
|
|
|
return (
|
|
<div className="space-y-6">
|
|
<PantryPageHeader />
|
|
<PantryManager initialItems={items.map((i) => ({
|
|
id: i.id,
|
|
rawName: i.rawName,
|
|
quantity: i.quantity,
|
|
unit: i.unit,
|
|
expiresAt: i.expiresAt?.toISOString() ?? null,
|
|
}))} />
|
|
</div>
|
|
);
|
|
}
|