Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/nowait-user/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@tanstack/react-query": "^5.80.10",
"@tanstack/react-virtual": "^3.13.11",
"axios": "^1.10.0",
"framer-motion": "^12.20.1",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-router-dom": "^7.6.2",
Expand Down
75 changes: 51 additions & 24 deletions apps/nowait-user/src/components/order/ConfirmModal.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,67 @@
import React from "react";
import React, { useState } from "react";
import { Button } from "@repo/ui";
import Portal from "../common/modal/Portal";
import { AnimatePresence, motion } from "framer-motion";

interface PropsType {
open: () => void;
close: () => void;
}

const ConfirmModal = ({ open, close }: PropsType) => {
// const [isVisible, setIsVisible] = useState(true);

// const handleClose = () => {
// setIsVisible(false);
// };


// const handleExitComplete = () => {
// if (!isVisible) close();
// };

return (
<Portal>
<div
onClick={close}
className="fixed inset-0 z-50 bg-black/30"
>
<div className="absolute left-1/2 bottom-8 -translate-x-1/2 w-[calc(100%-20px)] max-w-[430px] bg-white rounded-[20px] px-5 pt-9">
<h1 className="text-headline-22-bold mb-2">이체 완료 하셨나요?</h1>
<h2 className="text-16-regular text-black-70 mb-12">
아직 이체하지 않으셨다면 주문이
<br /> 정상적으로 접수되지 않을 수 있어요.
<br />
계좌로 송금을 마치셨다면 버튼을 눌러주세요.
</h2>
<Button fullWidth={true} textColor="#ffffff" onClick={open}>
이체했어요
</Button>
<Button
fullWidth={true}
backgroundColor="transparent"
textColor="#888888"
<AnimatePresence onExitComplete={close}>
{/* {isVisible && ( */}
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
onClick={close}
className="fixed inset-0 z-50 bg-black/30"
>
아직 안했어요
</Button>
</div>
</div>
<motion.div
initial={{ y: "100%" }}
animate={{ y: 0 }}
exit={{ y: "100%" }}
transition={{ duration: 0.3, ease: "easeInOut" }}
className="absolute left-1/2 bottom-8 -translate-x-1/2 w-[calc(100%-20px)] max-w-[430px] bg-white rounded-[20px] px-5 pt-9"
>
<h1 className="text-headline-22-bold mb-2">
이체 완료 하셨나요?
</h1>
<h2 className="text-16-regular text-black-70 mb-12">
아직 이체하지 않으셨다면 주문이
<br /> 정상적으로 접수되지 않을 수 있어요.
<br />
계좌로 송금을 마치셨다면 버튼을 눌러주세요.
</h2>
<Button fullWidth={true} textColor="#ffffff" onClick={open}>
이체했어요
</Button>
<Button
fullWidth={true}
backgroundColor="transparent"
textColor="#888888"
onClick={close}
>
아직 안했어요
</Button>
</motion.div>
</motion.div>
{/* )} */}
</AnimatePresence>
</Portal>
);
};
Expand Down
21 changes: 18 additions & 3 deletions apps/nowait-user/src/components/order/MenuItem.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import QuantitySelector from "../common/QuantitySelector";
import close from "../../assets/icon/close.svg";
import { useCartStore } from "../../stores/cartStore";
import { motion } from "framer-motion";
import { useState } from "react";

interface PropsType {
id: string;
Expand All @@ -11,8 +13,16 @@ interface PropsType {

const MenuItem = ({ id, name, price, quantity }: PropsType) => {
const { removeFromCart, increaseQuantity, decreaseQuantity } = useCartStore();
const [isRemoving, setIsRemoving] = useState(false);
return (
<li className="-mx-5 border-b border-[#ececec]">
<motion.li
layout
initial={{ opacity: 1, x: 0 }}
animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: -100 }}
transition={{ duration: 0.3 }}
className="-mx-5 border-b border-[#ececec]"
>
<div className="w-full p-5">
<div className="flex justify-between items-start">
<div className="max-w-[12.5rem]">
Expand All @@ -21,7 +31,12 @@ const MenuItem = ({ id, name, price, quantity }: PropsType) => {
</h1>
<h2 className="text-title-18-bold">{price.toLocaleString()}원</h2>
</div>
<button onClick={() => removeFromCart(id)}>
<button
onClick={() => {
setIsRemoving(true);
setTimeout(() => removeFromCart(id), 300);
}}
>
<img className="text-black-50" src={close} alt="메뉴 삭제 아이콘" />
</button>
</div>
Expand All @@ -34,7 +49,7 @@ const MenuItem = ({ id, name, price, quantity }: PropsType) => {
decreaseQuantity={decreaseQuantity}
/>
</div>
</li>
</motion.li>
);
};

Expand Down
10 changes: 8 additions & 2 deletions apps/nowait-user/src/components/order/Toast.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import React from "react";
import { motion } from "framer-motion";

interface PropsType {
message: string;
}

const Toast = ({ message }: PropsType) => {
return (
<div className="flex justify-center items-center px-4 py-2.5 rounded-[999px] bg-[#F2F6F9] fade-in">
<motion.div
initial={{ y: "100%" }}
animate={{ y: 0 }}
transition={{ duration: 0.4, ease: "easeInOut" }}
className="flex justify-center items-center px-4 py-2.5 rounded-[999px] bg-[#F2F6F9]"
>
<p className="text-14-medium text-navy-70">{message}</p>
</div>
</motion.div>
);
};

Expand Down
26 changes: 15 additions & 11 deletions apps/nowait-user/src/pages/order/OrderListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import { Button } from "@repo/ui";
import { useNavigate, useParams } from "react-router-dom";
import TotalButton from "../../components/order/TotalButton";
import { useCartStore } from "../../stores/cartStore";
import { AnimatePresence } from "framer-motion";
import EmptyCart from "../../components/order/EmptyCart";
import { sumTotalPrice } from "../../utils/sumUtils";
import axios from "axios";
import { getTableId } from "../../utils/cartStorage";


const OrderListPage = () => {
const navigate = useNavigate();
const { storeId } = useParams();
Expand Down Expand Up @@ -46,17 +48,19 @@ const OrderListPage = () => {
<div className="flex-1 overflow-y-auto pt-7 px-5">
<h1 className="text-headline-24-bold mb-5">총 주문 {cart.length}건</h1>
<ul>
{cart.map((item) => {
return (
<MenuItem
key={item.id}
id={item.id}
name={item.name}
price={item.price}
quantity={item.quantity}
/>
);
})}
<AnimatePresence mode="sync">
{cart.map((item) => {
return (
<MenuItem
key={item.id}
id={item.id}
name={item.name}
price={item.price}
quantity={item.quantity}
/>
);
})}
</AnimatePresence>
</ul>
</div>
<PageFooterButton>
Expand Down