Files
lunaqrmenu/app/page.tsx

52 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { prisma } from "@/app/lib/prisma";
import MenuView from "./components/MenuView";
export const dynamic = 'force-dynamic';
export default async function Page() {
const restaurant = await prisma.restaurant.findFirst({
include: {
categories: {
include: {
items: true,
},
orderBy: {
createdAt: 'asc',
},
},
},
});
if (!restaurant) {
return (
<div style={{ background: '#000', color: '#fff', height: '100vh', display: 'flex', alignItems: 'center', justifyContent: 'center', textAlign: 'center', padding: '20px' }}>
<div>
<h1 style={{ color: 'var(--gold)' }}>LUNA</h1>
<p>Henüz menü verisi bulunamadı veya veritabanı bağlantısı kurulamadı.</p>
<p style={{ fontSize: '0.8rem', color: '#666' }}>Lütfen admin panelinden bir restoran ve kategori oluşturulduğundan emin olun.</p>
</div>
</div>
);
}
// Map database structure to the structure expected by MenuView
const data = {
restaurant_name: restaurant.name,
footer_note: restaurant.footerNote || "",
categories: restaurant.categories.map(cat => ({
id: cat.id,
title: cat.title,
externalId: cat.externalId,
items: cat.items.map(item => ({
name: item.name,
ingredients: item.ingredients,
tasteProfile: item.tasteProfile,
grapeVariety: item.grapeVariety,
price: item.price,
})),
})),
};
return <MenuView data={data} />;
}