+
{children}
diff --git a/apps/nowait-user/src/components/order/TotalButton.tsx b/apps/nowait-user/src/components/order/TotalButton.tsx
index e1672b33..b2c59602 100644
--- a/apps/nowait-user/src/components/order/TotalButton.tsx
+++ b/apps/nowait-user/src/components/order/TotalButton.tsx
@@ -1,6 +1,6 @@
import { sumQuantity, sumTotalPrice } from "../../utils/sumUtils";
import { useCartStore } from "../../stores/cartStore";
-import { useEffect, useState } from "react";
+import React, { useEffect, useState } from "react";
import NumberFlow from "@number-flow/react";
interface PropsType {
@@ -18,8 +18,7 @@ const TotalButton = ({
const baseTotal = sumTotalPrice(cart);
const [price, setPrice] = useState(baseTotal);
const [trend, setTrend] = useState(0);
- console.log(trend);
- console.log(addedPrice);
+
useEffect(() => {
if (addedPrice !== undefined) {
setTrend(1);
@@ -49,4 +48,4 @@ const TotalButton = ({
);
};
-export default TotalButton;
+export default React.memo(TotalButton)
diff --git a/apps/nowait-user/src/pages/NotFound/NotFound.tsx b/apps/nowait-user/src/pages/NotFound/NotFound.tsx
index 891d82ac..f982d00f 100644
--- a/apps/nowait-user/src/pages/NotFound/NotFound.tsx
+++ b/apps/nowait-user/src/pages/NotFound/NotFound.tsx
@@ -3,13 +3,8 @@ const NotFound = () => {
return (
-

+
페이지를 찾을 수 없어요
-
- 페이지가 존재하지 않거나, 사용할 수 없는 페이지입니다.
-
- 입력하신 주소가 정확한지 다시 한번 확인해 주세요.
-
);
diff --git a/apps/nowait-user/src/pages/order/home/StorePage.tsx b/apps/nowait-user/src/pages/order/home/StorePage.tsx
index 08dfcb17..5ee6317c 100644
--- a/apps/nowait-user/src/pages/order/home/StorePage.tsx
+++ b/apps/nowait-user/src/pages/order/home/StorePage.tsx
@@ -23,24 +23,30 @@ const StorePage = () => {
//메뉴 추가 시 toast 띄우기
useEffect(() => {
- if (added) showToast("메뉴를 담았습니다");
- navigate(location.pathname, { replace: true });
+ if (added) {
+ showToast("메뉴를 담았습니다");
+ navigate(location.pathname, { replace: true });
+ }
}, [added]);
- const { data: menus, isLoading } = useQuery({
+ const { data: menus, isLoading } = useQuery({
queryKey: ["storeMenus", storeId],
queryFn: () => getStoreMenus(storeId!),
select: (data) => data?.response,
});
- console.log(menus,"asd")
+ console.log(menus, "asd");
return (
{cart && cart.length > 0 && (
@@ -61,4 +67,4 @@ const StorePage = () => {
);
};
-export default StorePage;
\ No newline at end of file
+export default StorePage;
diff --git a/apps/nowait-user/src/pages/order/remittance/RemittancePage.tsx b/apps/nowait-user/src/pages/order/remittance/RemittancePage.tsx
index 1aed4920..98c92a4b 100644
--- a/apps/nowait-user/src/pages/order/remittance/RemittancePage.tsx
+++ b/apps/nowait-user/src/pages/order/remittance/RemittancePage.tsx
@@ -33,6 +33,7 @@ const RemittancePage = () => {
enabled: !!storeId,
select: (data) => data?.response,
});
+
// 정보 없으면 홈으로 이동
useEffect(() => {
if (cart.length === 0) {
diff --git a/apps/nowait-user/src/pages/order/remittance/components/remitOptions/DirectRemitOption.tsx b/apps/nowait-user/src/pages/order/remittance/components/remitOptions/DirectRemitOption.tsx
index 6ab44c91..dddfd5b7 100644
--- a/apps/nowait-user/src/pages/order/remittance/components/remitOptions/DirectRemitOption.tsx
+++ b/apps/nowait-user/src/pages/order/remittance/components/remitOptions/DirectRemitOption.tsx
@@ -3,12 +3,13 @@ import SlideToggle from "../SlideToggle";
import useThrottle from "../../../../../hooks/useThrottle";
import { useToastStore } from "../../../../../stores/toastStore";
import { accountFormat } from "../../../../../utils/accountFormat";
+import BankImage from "../../../../../assets/bankImage.png";
interface PropsType {
remitValue: string;
setRemitValue: React.Dispatch
>;
totalPrice: number;
- account: string;
+ account?: string;
}
const DirectRemitOption = ({
remitValue,
@@ -59,7 +60,8 @@ const DirectRemitOption = ({
diff --git a/apps/nowait-user/src/pages/order/remittance/components/remitOptions/RemitOptions.tsx b/apps/nowait-user/src/pages/order/remittance/components/remitOptions/RemitOptions.tsx
index 395a4183..10b8bb91 100644
--- a/apps/nowait-user/src/pages/order/remittance/components/remitOptions/RemitOptions.tsx
+++ b/apps/nowait-user/src/pages/order/remittance/components/remitOptions/RemitOptions.tsx
@@ -25,7 +25,7 @@ const RemitOptions = ({
isLoading,
}: PropsType) => {
if (isLoading) return ;
-
+
return (
@@ -41,7 +41,7 @@ const RemitOptions = ({
setRemitValue={setRemitValue}
/>
) : null}
- {account && (
+ {account?.trim() !== "" && (
{
const [selectedBooth, setSelectedBooth] = useState(null);
const [isDragging, setIsDragging] = useState(false);
+ const [positionX, setPositionX] = useState(0);
+ const [positionY, setPositionY] = useState(0);
+
const { data: storeMarkers } = useQuery({
queryKey: ["storesMarkers"],
queryFn: getAllStores,
select: (data) => data?.response?.storePageReadResponses,
});
+ // 뷰포트 크기 계산
+ const viewportRef = useRef(null);
+ const viewportWidth = viewportRef.current?.clientWidth ?? 430;
+ const viewportHeight = viewportRef.current?.clientHeight ?? 812;
+
// 부스 + 마커 좌표
const booths = storeMarkers?.map((booth) => ({
...booth,
...boothPosition[booth.storeId],
}));
-
- // 마커 클릭시 나오는 부스 정보
- const detailBooth = booths?.find((booth) => booth.storeId === selectedBooth);
+ console.log(booths, "부스");
+ useEffect(() => {
+ if (!booths || booths.length === 0) return;
+ console.log("실행");
+ const positions = Object.values(boothPosition).map((booth) => ({
+ top: parseFloat(booth.top),
+ left: parseFloat(booth.left),
+ }));
+ const avgTop =
+ positions.reduce((sum, booth) => sum + booth.top, 0) / positions.length;
+ const avgLeft =
+ positions.reduce((sum, booth) => sum + booth.left, 0) / positions.length;
+ const initialX = -((avgLeft / 100) * 1100 - viewportWidth / 2);
+ const initialY = -((avgTop / 100) * 1100 - viewportHeight / 2);
+ setPositionX(initialX);
+ setPositionY(initialY);
+ }, [booths]);
const openBoothButton = (id: number) => {
- console.log(id);
if (selectedBooth === id) {
setSelectedBooth(null);
} else {
@@ -55,16 +77,17 @@ const MapPage = () => {
timeConstant: 0,
}}
dragConstraints={{
- left: -(1100 - 430),
+ left: -(1100 - viewportWidth),
right: 0,
- top: -(1100 - 812),
+ top: -(1100 - viewportHeight),
bottom: 0,
}}
// 클릭, 드래그 구분
onPointerDown={() => setIsDragging(false)}
onDragStart={() => setIsDragging(true)}
- onPointerUp={() => {
+ onPointerUp={(e) => {
if (!isDragging) {
+ if ((e.target as HTMLElement).closest("button")) return;
setSelectedBooth(null);
}
}}
@@ -73,6 +96,8 @@ const MapPage = () => {
height: "1100px",
position: "relative",
cursor: "grab",
+ x: positionX,
+ y: positionY,
}}
>
{
pointerEvents: "none",
userSelect: "none",
}}
- // src={boothMap}
- src="/test-map.png"
+ src={BoothMap}
alt="축제 맵 이미지"
/>
{/* 마커 */}
@@ -120,7 +144,9 @@ const MapPage = () => {
{/* 부스 리스트 */}
{selectedBooth !== null ? (
-
+ booth.storeId === selectedBooth)}
+ />
) : (
)}
diff --git a/apps/nowait-user/src/pages/waiting/boothMap/constants/boothPosition.ts b/apps/nowait-user/src/pages/waiting/boothMap/constants/boothPosition.ts
index 19fd1da7..156c3cad 100644
--- a/apps/nowait-user/src/pages/waiting/boothMap/constants/boothPosition.ts
+++ b/apps/nowait-user/src/pages/waiting/boothMap/constants/boothPosition.ts
@@ -2,5 +2,4 @@ export const boothPosition: Record = {
1 : {top:"52.5%",left:"52.0%"},
2 : {top:"41.2%",left:"50.8%"},
3 : {top:"64.6%",left:"53.0%"}
-
};