"use client";
import { MenuItem } from "@/lib/readCsv";
import { useOrder } from "../hooks/useOrder";
import Menu from "./menu";
import { Button } from "./ui/button";
import { Drawer, DrawerClose, DrawerContent, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger } from "./ui/drawer";
import { useRouter } from "next/navigation";
import { saveOrderApi } from "@/app/order/action";
export default function Order({
menus,
categories,
}: {
menus: MenuItem[];
categories: string[];
}) {
const { state, dispatch } = useOrder();
const router = useRouter();
return (
<>
다음 주문이 맞나요?
{state.orders.map(order => (
-
{order.HOT ? "HOT " : "COLD"}
{order.name}
단위 가격{order.price * 1000}원
{order.quantity}개
총 가격 {order.price * order.quantity * 1000}원
))}
총 가격
{state.orders.map(order => order.price * order.quantity)
.reduce((acc, price) => acc + price, 0) * 1000}원
>
);
}