import OrderCard from "@/components/orderCard";
import { loadOrder } from "@/lib/db";
import NavMenu from "@/components/NavMenu";

export default async function Home() {
  const orders = await loadOrder();
  return (
    <main className="min-h-screen">
        <NavMenu />
      {orders.length === 0 && (
        <div className="flex items-center justify-center h-[calc(100vh-4rem)]">
          <p className="text-muted-foreground text-2xl">주문이 없습니다.</p>
        </div>
      )}
      <section className="grid grid-cols-[repeat(auto-fill,_minmax(300px,_auto))] p-4 gap-2">
        {orders.map((order) => (
          <OrderCard key={order.id} order={order} />
        ))}
      </section>
    </main>
  );
}
