diff --git a/public/favicon.ico b/public/favicon.ico index a11777c..7457c6e 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/public/index.html b/public/index.html index aa069f2..50095ca 100644 --- a/public/index.html +++ b/public/index.html @@ -24,7 +24,7 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> - React App + ReadyVery diff --git a/src/App.js b/src/App.js index 198841d..299ac14 100644 --- a/src/App.js +++ b/src/App.js @@ -1,5 +1,5 @@ -import axios from 'axios'; -import React, { Suspense } from 'react'; +import axios from "axios"; +import React, { Suspense } from "react"; import { useCookies } from "react-cookie"; import { Route, Routes, useNavigate } from "react-router-dom"; import { RecoilRoot } from "recoil"; @@ -8,7 +8,7 @@ import Mypage from "../src/pages/Mypage/Mypage"; import SalesPage from "../src/pages/Sales/Sales"; import "./App.css"; import Auth from "./hoc/auth.jsx"; -import useInterval from './hooks/useInterval.jsx'; +import useInterval from "./hooks/useInterval.jsx"; import HomePage from "./pages/Home/Home"; import MainPage from "./pages/Main/MainPage.jsx"; @@ -22,41 +22,42 @@ function App() { const NewInventoryPage = Auth(InventoryPage, true); const NewSalesPage = Auth(SalesPage, true); const NewMyPage = Auth(Mypage, true); - + const expiredTime = 1000 * 60 * 60 * 24; useInterval(() => { - if( - cookies.refreshToken !== 'undefined' && - cookies.refreshToken !== undefined && - cookies.refreshToken - ){ + if ( + cookies.refreshToken !== "undefined" && + cookies.refreshToken !== undefined && + cookies.refreshToken + ) { const config = { withCredentials: true, - } - axios.get(`${apiUrl}/api/v1/refresh/token`, config) + }; + axios + .get(`${apiUrl}/api/v1/refresh/token`, config) .then((response) => { console.log(response); if (!response.data) { - removeCookies(); - navigate('/'); + removeCookies(); + navigate("/"); } }) .catch((err) => { navigate("/"); - }) + }); } }, expiredTime - 60000); return (
Loading...
}> - - } /> - } /> - } /> - } /> - } /> - + + } /> + } /> + } /> + } /> + } /> + diff --git a/src/Atom/order.jsx b/src/Atom/order.jsx index 5248e23..5c614c7 100644 --- a/src/Atom/order.jsx +++ b/src/Atom/order.jsx @@ -1,23 +1,20 @@ import { atom } from "recoil"; -export const orders = atom( - { - key: "orders", // 전역적으로 고유한 값 - default: { - id: 0, //db 인덱스 - orderNum: 0, // 그날의 그가게의 주문번호 - pickUp: "", - foodies: [ - { - name: "", - count: 0, - options: [""], - }, - ], - phone: "", // 고객의 전화번호 - time: "", // 주문시간 - payment: "", - price: 0, - }, - } // 초깃값 -); +export const ordercnt = atom({ + key: "ordercnt", + default: { + pending: 0, + progress: 0, + complete: 0, + }, +}); + +export const selectStatus = atom({ + key: "selectStatus", + default: "null", +}); + +export const selectOrder = atom({ + key: "selectOrder", + default: null, +}); diff --git a/src/Atom/status.jsx b/src/Atom/status.jsx index b795518..3af86b4 100644 --- a/src/Atom/status.jsx +++ b/src/Atom/status.jsx @@ -6,66 +6,62 @@ export const storeState = atom({ default: false, // 초깃값 }); -export const orderState = atom({ - key: "orderState", - default: { - wait: 1, - progress: 0, - complete: 0, - }, +export const soundState = atom({ + key: "soundState", + default: true, }); export const isAuthenticatedState = atom({ - key: 'isAuthenticatedState', + key: "isAuthenticatedState", default: false, }); export const getAuthenticatedSelector = selector({ - key: 'auth/get', - get: async ({get}) => { + key: "auth/get", + get: async ({ get }) => { return get(isAuthenticatedState); }, - set: ({set}) => { + set: ({ set }) => { set(isAuthenticatedState, (currentValue) => !currentValue); - } -}) + }, +}); export const loginState = atom({ - key: 'loginState', + key: "loginState", default: { accessToken: null, - expiredTime: null + expiredTime: null, }, }); export const userState = atom({ - key: 'userState', + key: "userState", dafault: null, -}) +}); export const getUserSelector = selector({ - key: 'user/get', - get: async ({get, set}) => { - try{ + key: "user/get", + get: async ({ get, set }) => { + try { const apiUrl = process.env.REACT_APP_API_ROOT; const config = { - withCredentials: true + withCredentials: true, }; - const response = await axios.get(`${apiUrl}/api/v1/auth`, config) + const response = await axios.get(`${apiUrl}/api/v1/auth`, config); const userData = response.data; // if (JSON.stringify(userState) !== JSON.stringify(userData)) { // // 다르면 userInfo 업데이트 // // set(userState, userData); // } return userData; - } catch (err){ - // 에러처리 - return "404"; + } catch (err) { + // 에러처리 + return "404"; } }, - set: ({set}, newValue) => { - set(userState, newValue) - } -}) \ No newline at end of file + set: ({ set }, newValue) => { + set(userState, newValue); + }, +}); diff --git a/src/assets/Very.mp3 b/src/assets/Very.mp3 new file mode 100644 index 0000000..986edb3 Binary files /dev/null and b/src/assets/Very.mp3 differ diff --git a/src/assets/icons/icon_downArrow_black.svg b/src/assets/icons/icon_downArrow_black.svg new file mode 100644 index 0000000..59b42ee --- /dev/null +++ b/src/assets/icons/icon_downArrow_black.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/components/views/Audio/AudioPlayer.jsx b/src/components/views/Audio/AudioPlayer.jsx new file mode 100644 index 0000000..33f8bae --- /dev/null +++ b/src/components/views/Audio/AudioPlayer.jsx @@ -0,0 +1,11 @@ +import VeryMp3 from "../../../assets/Very.mp3"; + +const AudioPlayer = () => { + const audio = new Audio(VeryMp3); + audio.play().catch((error) => { + // Autoplay was prevented, handle it here + console.error("Autoplay prevented:", error); + }); +}; + +export default AudioPlayer; diff --git a/src/components/views/Button/pendingButton.jsx b/src/components/views/Button/pendingButton.jsx new file mode 100644 index 0000000..6a7ea80 --- /dev/null +++ b/src/components/views/Button/pendingButton.jsx @@ -0,0 +1,53 @@ +import React from "react"; +import { Button, Col, Row } from "react-bootstrap"; + +const pendingButton = ({ handleRefuseModal, handleReceiveModal }) => { + return ( + + +
+ +
+ + +
+ +
+ +
+ ); +}; + +export default pendingButton; diff --git a/src/components/views/Header/Header.css b/src/components/views/Header/Header.css index 121d6c3..204594d 100644 --- a/src/components/views/Header/Header.css +++ b/src/components/views/Header/Header.css @@ -1,12 +1,12 @@ .header { /* width: 100%; */ - min-width: 73.75rem; + min-width: 64rem; /* min-width: 64rem; */ height: 5.5rem; background-color: #2e2d2d; } -.header2{ +.header2 { position: absolute; top: 0; bottom: 0; @@ -19,18 +19,18 @@ z-index: 101; } -.header2-wrapper{ +.header2-wrapper { display: flex; justify-content: space-between; } -.head-container2{ +.head-container2 { width: 23.6rem; display: flex; justify-content: space-evenly; } -.header-img-wrapper{ +.header-img-wrapper { display: flex; } @@ -49,7 +49,7 @@ align-items: center; } -.store-img__wrapper{ +.store-img__wrapper { margin: 0 0.5625rem; } diff --git a/src/components/views/Header/Header.jsx b/src/components/views/Header/Header.jsx index 361a2ea..92e614a 100644 --- a/src/components/views/Header/Header.jsx +++ b/src/components/views/Header/Header.jsx @@ -1,7 +1,7 @@ -import React, { useState } from "react"; +import React from "react"; import { Col, Row } from "react-bootstrap"; -import { useRecoilValue } from "recoil"; -import { storeState } from "../../../Atom/status"; +import { useRecoilState, useRecoilValue } from "recoil"; +import { soundState, storeState } from "../../../Atom/status"; import StoreOff from "../../../assets/icons/Header/CloseLight.svg"; //영업종료 import LOGO from "../../../assets/icons/Header/LOGO.svg"; //로고 import StoreOn from "../../../assets/icons/Header/OpenLight.svg"; //영업중 @@ -11,10 +11,16 @@ import "./Header.css"; const Header = () => { const Store = useRecoilValue(storeState); - const [Sound, setSound] = useState(1); + const [Sound, setSound] = useRecoilState(soundState); - const onClickHandler = (e) => { - setSound(!Sound); + const ClickTrue = () => { + setSound(true); + console.log(Sound); + }; + + const ClickFalse = () => { + setSound(false); + console.log(Sound); }; return ( @@ -27,19 +33,23 @@ const Header = () => { {!Store ? (
-
Open
+
+ Open +
영업중
) : (
-
Close
+
+ Close +
영업종료
)} {Sound ? ( - SoundOn + SoundOn ) : ( - SoundOff + SoundOff )} diff --git a/src/components/views/NavBar/NavBar.jsx b/src/components/views/NavBar/NavBar.jsx index 5dace46..5ff9426 100644 --- a/src/components/views/NavBar/NavBar.jsx +++ b/src/components/views/NavBar/NavBar.jsx @@ -12,13 +12,22 @@ import "../NavBar/NavBar.css"; const NavBar = () => { const currentPath = window.location.pathname; // 현재 경로 가져오기 - + const apiUrl = process.env.REACT_APP_API_ROOT; const [Store] = useRecoilState(storeState); // 영업여부 const setStoreState = useRecoilCallback(({ set }) => async () => { + console.log(Store, storeState); set(storeState, !Store); }); const onClickHandler = (e) => { setStoreState(); + // axios + // .post(`${apiUrl}+/api/v1/store/sales`) + // .then((Store) => { + // console.log(Store); + // }) + // .catch((error) => { + // console.error(error); + // }); }; return ( diff --git a/src/components/views/Order/OrderBox.jsx b/src/components/views/Order/OrderBox.jsx index c5af5d8..96bc53b 100644 --- a/src/components/views/Order/OrderBox.jsx +++ b/src/components/views/Order/OrderBox.jsx @@ -1,11 +1,26 @@ -const OrderBox = ({ orderProps: { orderNum, time, pickUp, price } }) => { +import React from "react"; + +const OrderBox = ({ onSelect, order, selectedOrderId }) => { + const { id, orderNum, time, pickUp, price } = order; + const isSelected = id === selectedOrderId; + + const onClickHandler = () => { + onSelect(isSelected ? null : order); + }; return ( <> -
+
{orderNum} {time} {pickUp} - {price} + {price}원 +
); diff --git a/src/hoc/auth.jsx b/src/hoc/auth.jsx index 770fff7..8168b87 100644 --- a/src/hoc/auth.jsx +++ b/src/hoc/auth.jsx @@ -1,61 +1,59 @@ -import moment from 'moment'; -import { useEffect } from 'react'; -import { useCookies } from 'react-cookie'; -import { useLocation, useNavigate } from 'react-router-dom'; -import { useRecoilValue, useSetRecoilState } from 'recoil'; -import { getUserSelector, loginState } from '../Atom/status'; +import { useCookies } from "react-cookie"; +import { useLocation, useNavigate } from "react-router-dom"; +import { useRecoilValue, useSetRecoilState } from "recoil"; +import { getUserSelector, loginState } from "../Atom/status"; function Auth(SpecificComponent, option) { - function AuthenticationCheck(props) { - const navigate = useNavigate(); - const location = useLocation(); - const userInfo = useRecoilValue(getUserSelector); - const setIsLoggedIn = useSetRecoilState(loginState); - const [cookies] = useCookies(['accessToken']); + function AuthenticationCheck(props) { + const navigate = useNavigate(); + const location = useLocation(); + const userInfo = useRecoilValue(getUserSelector); + const setIsLoggedIn = useSetRecoilState(loginState); + const [cookies] = useCookies(["accessToken"]); - - useEffect(() => { - const isAuth = window.localStorage.getItem("isAuthenticated") - if(userInfo === "404" && location.pathname !== "/"){ - navigate("/"); - } else { - if(!isAuth && cookies?.accessToken) { - // 첫 로그인 시 - window.localStorage.setItem("isAuthenticated", true); - setIsLoggedIn({ - accessToken: getAccessTokenFromCookie(), - expiredTime: moment().add(1, "hour").format("yyyy-MM-DD HH:mm:ss") - }); - navigate("/home"); - alert("로그인에 성공하셨습니다."); - } else{ - if(cookies?.accessToken && location.pathname === "/"){ - // 로그인 상태에서 로그인 화면으로 갔을 경우 - navigate("/home"); - } - } - } + /* + useEffect(() => { + const isAuth = window.localStorage.getItem("isAuthenticated"); + if (userInfo === "404" && location.pathname !== "/") { + navigate("/"); + } else { + if (!isAuth && cookies?.accessToken) { + // 첫 로그인 시 + window.localStorage.setItem("isAuthenticated", true); + setIsLoggedIn({ + accessToken: getAccessTokenFromCookie(), + expiredTime: moment().add(1, "hour").format("yyyy-MM-DD HH:mm:ss"), + }); + navigate("/home"); + alert("로그인에 성공하셨습니다."); + } else { + if (cookies?.accessToken && location.pathname === "/") { + // 로그인 상태에서 로그인 화면으로 갔을 경우 + navigate("/home"); + } + } + } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []);*/ return ; -} -return AuthenticationCheck; + } + return AuthenticationCheck; } export const getAccessTokenFromCookie = () => { const cookieString = document.cookie; - if(cookieString){ + if (cookieString) { const cookies = cookieString.split("; "); - for (const cookie of cookies) { - const [name, value] = cookie.split("="); - if (name === "accessToken") { - return value; + for (const cookie of cookies) { + const [name, value] = cookie.split("="); + if (name === "accessToken") { + return value; + } } } - } return null; }; -export default Auth; \ No newline at end of file +export default Auth; diff --git a/src/pages/Home/DetailHome.css b/src/pages/Home/DetailHome.css deleted file mode 100644 index ce2a1ea..0000000 --- a/src/pages/Home/DetailHome.css +++ /dev/null @@ -1,44 +0,0 @@ -.orderWait { - display: flex; - flex-wrap: wrap; - align-content: flex-start; - - width: 100%; - /* height: 100%; */ - overflow-y: auto; -} - -.listTable { - display: flex; - flex-wrap: wrap; - align-content: flex-start; - - width: 100%; - - margin: auto; -} - -.indexTable { - color: #4f4f4f; - font-family: "Light"; - font-size: 1.375rem; - font-style: normal; - font-weight: 600; - line-height: 100%; /* 1.375rem */ -} - -.Wait-Row { - display: flex; - flex-wrap: wrap; - align-content: center; - - width: 100%; - height: 3.125rem; - margin: auto; - color: #4f4f4f; - font-family: "Light"; - font-size: 1.375rem; - font-style: normal; - font-weight: 600; - line-height: 100%; /* 1.375rem */ -} diff --git a/src/pages/Home/Home.jsx b/src/pages/Home/Home.jsx index 745dd5a..280746e 100644 --- a/src/pages/Home/Home.jsx +++ b/src/pages/Home/Home.jsx @@ -17,7 +17,7 @@ function Home () { > - + { + const { pending, progress, complete } = useRecoilValue(ordercnt); + const [status, setStatus] = useState({ Wait: true, Progress: false, @@ -33,7 +37,7 @@ function MainHome (props) { }; return ( - + @@ -61,12 +65,12 @@ function MainHome (props) { borderRadius: "0.875rem", backgroundColor: status.Progress ? "#d82356" : "#FFFFFF", fontFamily: status.Wait ? "ExtraBold" : "SemiBold", - fontSize: "1.5625rem", + fontSize: "1.1rem", color: status.Progress ? "#FFFFFF" : "#838383", border: "none", }} > - 제조중 0 + 제조중 {progress} @@ -78,12 +82,12 @@ function MainHome (props) { borderRadius: "0.875rem", backgroundColor: status.Complete ? "#d82356" : "#FFFFFF", fontFamily: status.Wait ? "ExtraBold" : "SemiBold", - fontSize: "1.5625rem", + fontSize: "1.1rem", color: status.Complete ? "#FFFFFF" : "#838383", border: "none", }} > - 제조•픽업완료 0 + 제조•픽업완료 {complete} diff --git a/src/pages/Home/Receipt.css b/src/pages/Home/Receipt.css deleted file mode 100644 index 88a4023..0000000 --- a/src/pages/Home/Receipt.css +++ /dev/null @@ -1,75 +0,0 @@ -.rounded-rectangle { - width: 100%; /* 너비 설정 */ - height: 97%; /* 높이 설정 */ - background-color: #F5F5F5; /* 배경색 설정 */ - border-radius: 1.875rem; /* 모서리를 둥글게 만드는 값 */ - color: #000; /* 텍스트 색상 설정 */ - box-shadow: 0px 0.25rem 0.375rem rgba(0, 0, 0, 0.25); -} - -.Box { - width: 100%; /* 너비 설정 */ - height: 100%; /* 높이 설정 */ - /* height: 42.5rem; */ - /* padding-top: 5%; */ - /* padding-left: 0; */ -} - -.receiptHeader { - padding-top: 10%; - padding-left: 10%; - display: flex; -} - -.receipt-header { - color: #000; - text-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25); - font-family: "Bold"; - font-size: 1.75rem; - font-weight: 800; - line-height: 130%; /* 2.275rem */ - letter-spacing: -0.0175rem; -} - -.receipt-btn__wrapper{ - /* width: 80%; - margin: 0 auto; */ - height: 100%; - display: flex; - align-items: center; - justify-content: center; -} - -.receiptButton { - display: flex; - height: 5.5rem; -} - -.receiptTextBox { - display: flex; - justify-content: space-between; - - padding: 3% 7% 1% 7%; -} - - -.receipt-text { - color: #4f4f4f; - font-family: "Light"; - font-size: 1.25rem; - font-weight: 600; - line-height: 130%; /* 1.625rem */ - font-size: 1.25rem; - font-family: "SemiBold"; - letter-spacing: -0.0125rem; -} - -.receipt-divider { - width: 19.4375rem; - height: 0rem; - - border-top: 1px solid #838383; /* 색상과 굵기를 조절할 수 있습니다. */ - margin: 20px 0; /* 위아래 여백을 조절할 수 있습니다. */ - - transform: translate(10%, -50%); -} diff --git a/src/pages/Home/Receipt/Receipt.css b/src/pages/Home/Receipt/Receipt.css index fc4c38a..fda5f4e 100644 --- a/src/pages/Home/Receipt/Receipt.css +++ b/src/pages/Home/Receipt/Receipt.css @@ -1,6 +1,6 @@ .rounded-rectangle { width: 23.75rem; - height: 44.875rem; + height: 43rem; background-color: #f5f5f5; /* 배경색 설정 */ border-radius: 1.875rem; /* 모서리를 둥글게 만드는 값 */ text-align: center; /* 가운데 정렬 */ @@ -17,6 +17,14 @@ padding-left: 0; } +.nullReceipt { + display: flex; + flex-direction: column; + flex-wrap: wrap; + + padding-top: 60%; +} + .receiptHeader { padding-top: 10%; padding-left: 10%; @@ -33,6 +41,13 @@ letter-spacing: -0.0175rem; } +.receipt-btn__wrapper { + padding: 10% 10% 5% 7%; + + display: flex; + justify-content: space-between; +} + .receiptButton { display: flex; height: 5.5rem; @@ -83,12 +98,29 @@ transform: translate(10%, -50%); } +.receipt-btn { + width: 8.75rem; + height: 2.8125rem; + border: 2px solid; + border-radius: 1.5625rem; + background-color: #d82356; + font-family: "SemiBold"; + font-size: 1.375rem; + color: #ffffff; + + display: flex; + justify-content: center; + align-items: center; +} + /* 모달 */ .modal-wrapper { position: absolute; - bottom: 0; + top: calc(59% - 21.5rem); + left: calc(100% - 23rem); + width: 23.75rem; - height: 44.875rem; + height: 43rem; background-color: rgba(0, 0, 0, 0.5); border-radius: 1.875rem; @@ -97,10 +129,11 @@ .modal-box { position: absolute; - bottom: calc(68% - 30.9375rem); + top: calc(100% - 30.8rem); + left: calc(100% - 23.75rem); width: 23.75rem; - height: 30.9375rem; + height: 30.8rem; background-color: #fff; border-radius: 1.875rem; z-index: 101; @@ -132,7 +165,7 @@ display: flex; flex-direction: column; justify-content: space-between; - height: 10.9375rem; + height: 12.9375rem; } .modal-box-choose-btn { diff --git a/src/pages/Home/Receipt/Receipt.jsx b/src/pages/Home/Receipt/Receipt.jsx index ce5dfae..7a71763 100644 --- a/src/pages/Home/Receipt/Receipt.jsx +++ b/src/pages/Home/Receipt/Receipt.jsx @@ -1,19 +1,16 @@ -import React, { useState } from "react"; -import { Button, Col, Row } from "react-bootstrap"; -import X from "../../../assets/icons/X.svg"; +import React from "react"; +import { useRecoilState } from "recoil"; +import { selectOrder, selectStatus } from "../../../Atom/order"; +import loading from "../../../assets/icons/loading.svg"; import "./Receipt.css"; -const Receipt = () => { - const [ReceiveModal, setReceiveModal] = useState(false); - const [RefuseModal, setRefuseModal] = useState(false); - - const handleReceiveModal = () => { - setReceiveModal((prev) => !prev); - }; +import CompleteReceipt from "./StatusReceipt/CompleteReceipt"; +import PendingReceipt from "./StatusReceipt/PendingReceipt"; +import ProgressReceipt from "./StatusReceipt/ProgressReceipt"; - const handleRefuseModal = () => { - setRefuseModal((prev) => !prev); - }; +const Receipt = () => { + const [Status, setStatus] = useRecoilState(selectStatus); + const [Order, setOrder] = useRecoilState(selectOrder); const orderInfo = { orders: [ @@ -35,145 +32,43 @@ const Receipt = () => { }, ], }; + return (
- {orderInfo.orders.map((order) => ( -
-
- 주문번호 {order.orderNum} -
- - -
- -
- - -
- -
- -
-
- 주문시간 - {order.time} -
-
- 고객연락처 - {order.phone} -
-
-
- 주문내역 -
-
- {order.foodies[0].name} - {order.foodies[0].count} -
-
- {order.foodies[0].options.map((option) => ( - └ {option} - ))} -
-
-
- 결제수단 - {order.payment} -
-
- 결제금액 - {/* 100원 단위 ,처리 여유로우면 하기 */} - {order.price}원 -
-
- ))} - {RefuseModal && ( -
-
-
- close -
-
-
접수 거부 사유를 선택해주세요
-
-
-
재료소진
-
가게사정
-
기타
-
-
-
- )} - {ReceiveModal && ( -
-
-
- close -
-
-
제조 시간을 선택해주세요
-
-
- - -
5분
- - -
10분
- -
- - -
15분
- - -
20분
- -
- - -
25분
- - -
30분
- -
-
+
+ {Status === "pending" ? ( + + ) : Status === "progress" ? ( + + ) : //
progress
+ Status === "complete" ? ( + + ) : ( + //
complete
+
+ loading + 주문을 선택해주세요
-
- )} + )} +
); }; diff --git a/src/pages/Home/Receipt/StatusReceipt/CompleteReceipt.jsx b/src/pages/Home/Receipt/StatusReceipt/CompleteReceipt.jsx new file mode 100644 index 0000000..130c406 --- /dev/null +++ b/src/pages/Home/Receipt/StatusReceipt/CompleteReceipt.jsx @@ -0,0 +1,80 @@ +import React, { useState } from "react"; + +const CompleteReceipt = ({ + orderProps: { orderNum, time, phone, foodies, payment, price }, +}) => { + const [ReceiveModal, setReceiveModal] = useState(false); + const [RefuseModal, setRefuseModal] = useState(false); + + const handleReceiveModal = () => { + console.log(ReceiveModal); + setReceiveModal((prev) => !prev); + }; + + const handleRefuseModal = () => { + setRefuseModal((prev) => !prev); + }; + const orderInfo = { + orders: [ + { + id: 123, //db 인덱스 + orderNum: 2, // 그날의 그가게의 주문번호 + pickUp: "픽업", + foodies: [ + { + name: "아메리카노", + count: 3, + options: ["샷 추가", "휘핑", "ICE", "그란데"], + }, + ], + phone: "010-6439-3547", // 고객의 전화번호 + time: "21/11/08 11:44:30", // 주문시간 + payment: "현대카드", + price: 8500, + }, + ], + }; + + return ( +
+
+ 주문번호 {orderNum} + + +
+
+ 주문시간 + {time} +
+
+ 고객연락처 + {phone} +
+
+
+ 주문내역 +
+
+ {foodies[0].name} + {foodies[0].count} +
+
+ {foodies[0].options.map((option) => ( + └ {option} + ))} +
+
+
+ 결제수단 + {payment} +
+
+ 결제금액 + {/* 100원 단위 ,처리 여유로우면 하기 */} + {price}원 +
+
+ ); +}; + +export default CompleteReceipt; diff --git a/src/pages/Home/Receipt/StatusReceipt/PendingReceipt.jsx b/src/pages/Home/Receipt/StatusReceipt/PendingReceipt.jsx new file mode 100644 index 0000000..53a9338 --- /dev/null +++ b/src/pages/Home/Receipt/StatusReceipt/PendingReceipt.jsx @@ -0,0 +1,163 @@ +import React, { useState } from "react"; +import { Button, Col, Row } from "react-bootstrap"; +import X from "../../../../assets/icons/X.svg"; + +const PendingReceipt = ({ orderProps }) => { + const { orderNum, time, phone, foodies, payment, price } = orderProps; + + const [ReceiveModal, setReceiveModal] = useState(false); + const [RefuseModal, setRefuseModal] = useState(false); + + const handleReceiveModal = () => { + console.log(ReceiveModal); + setReceiveModal((prev) => !prev); + }; + + const handleRefuseModal = () => { + setRefuseModal((prev) => !prev); + }; + + return ( +
+
+ 주문번호 {orderNum} +
+ + +
+ +
+ + +
+ +
+ +
+
+ 주문시간 + {time} +
+
+ 고객연락처 + {phone} +
+
+
+ 주문내역 +
+
+ {foodies[0].name} + {foodies[0].count} +
+
+ {foodies[0].options.map((option) => ( + └ {option} + ))} +
+
+
+ 결제수단 + {payment} +
+
+ 결제금액 + {/* 100원 단위 ,처리 여유로우면 하기 */} + {price}원 +
+ + {/* 주문거부모달창 */} + {RefuseModal && ( +
+
+
+ close +
+
+
접수 거부 사유를 선택해주세요
+
+
+
재료소진
+
가게사정
+
기타
+
+
+
+ )} + + {/* 주문수락모달창 */} + {ReceiveModal && ( +
+
+
+ close +
+
+
제조 시간을 선택해주세요
+
+
+ + +
5분
+ + +
10분
+ +
+ + +
15분
+ + +
20분
+ +
+ + +
25분
+ + +
30분
+ +
+
+
+
+ )} +
+ ); +}; + +export default PendingReceipt; diff --git a/src/pages/Home/Receipt/StatusReceipt/ProgressReceipt.jsx b/src/pages/Home/Receipt/StatusReceipt/ProgressReceipt.jsx new file mode 100644 index 0000000..51c2422 --- /dev/null +++ b/src/pages/Home/Receipt/StatusReceipt/ProgressReceipt.jsx @@ -0,0 +1,54 @@ +import React from "react"; + +const ProgressReceipt = ({ + orderProps: { orderNum, time, phone, foodies, payment, price }, +}) => { + const onClickBtn = () => { + console.log("제조완료"); + }; + + return ( +
+
+ 주문번호 {orderNum} + + +
+
+ 주문시간 + {time} +
+
+ 고객연락처 + {phone} +
+
+
+ 주문내역 +
+
+ {foodies[0].name} + {foodies[0].count} +
+
+ {foodies[0].options.map((option) => ( + └ {option} + ))} +
+
+
+ 결제수단 + {payment} +
+
+ 결제금액 + {/* 100원 단위 ,처리 여유로우면 하기 */} + {price}원 +
+
+ ); +}; + +export default ProgressReceipt; diff --git a/src/pages/Home/StatusHome/Complete.jsx b/src/pages/Home/StatusHome/Complete.jsx index b8dd236..29c34bf 100644 --- a/src/pages/Home/StatusHome/Complete.jsx +++ b/src/pages/Home/StatusHome/Complete.jsx @@ -1,7 +1,143 @@ -import React from "react"; +import React, { useEffect, useState } from "react"; +import { useRecoilState } from "recoil"; +import { ordercnt, selectOrder, selectStatus } from "../../../Atom/order"; +import downArrow from "../../../assets/icons/icon_downArrow_black.svg"; +import OrderBox from "../../../components/views/Order/OrderBox"; +import "./DetailHome.css"; const Complete = () => { - return
Complete
; + const [orderCount, setOrderCount] = useRecoilState(ordercnt); // Recoil 상태 가져오기 + const [orderSelect, setOrderSelect] = useRecoilState(selectOrder); + const [statusSelect, setStatusSelect] = useRecoilState(selectStatus); + + const orderInfo = { + orders: [ + { + id: 123, //db 인덱스 + orderNum: 2, // 그날의 그가게의 주문번호 + pickUp: "픽업", + foodies: [ + { + name: "아메리카노", + count: 3, + options: ["샷 추가", "휘핑", "ICE", "그란데"], + }, + ], + phone: "010-6439-3547", // 고객의 전화번호 + time: "21/11/08 11:44:30", // 주문시간 + payment: "현대카드", + price: 8500, + }, + { + id: 124, //db 인덱스 + orderNum: 3, // 그날의 그가게의 주문번호 + pickUp: "매장", + foodies: [ + { + name: "아메리카누", + count: 3, + options: ["샷 추가 *100 ", "휘핑 *1000", "HOT", "그란데"], + }, + ], + phone: "010-7679-3547", // 고객의 전화번호 + time: "23/11/08 11:44:30", // 주문시간 + payment: "현대카드", + price: 78500, + }, + { + id: 125, + orderNum: 4, + pickUp: "픽업", + foodies: [ + { + name: "아메리카노", + count: 3, + options: ["샷 추가", "휘핑", "ICE", "그란데"], + }, + ], + phone: "010-6439-3547", // 고객의 전화번호 + time: "21/11/08 11:44:30", // 주문시간 + payment: "현대카드", + price: 8500, + }, + { + id: 126, + orderNum: 5, + pickUp: "매장", + foodies: [ + { + name: "아메리카노", + count: 3, + options: ["샷 추가", "휘핑", "ICE", "그란데"], + }, + ], + phone: "010-6439-3547", // 고객의 전화번호 + time: "21/11/08 11:44:30", // 주문시간 + payment: "현대카드", + price: 8500, + }, + ], + }; + + const [selectedOrderId, setSelectedOrderId] = useState(null); + const [isRecentFirst, setIsRecentFirst] = useState(false); + + const sortedOrders = isRecentFirst + ? [...orderInfo.orders].reverse() + : orderInfo.orders; + + const onClickHandler = (selectedOrder) => { + setOrderSelect(selectedOrder); + if (selectedOrder === null) { + setStatusSelect("null"); + } else { + setStatusSelect("complete"); + } + setSelectedOrderId(selectedOrder ? selectedOrder.id : null); + }; + + useEffect(() => { + // OrderBox가 생성될 때마다 개수 증가 + setOrderCount((prev) => ({ ...prev, complete: orderInfo.orders.length })); + }, [orderInfo.orders.length, setOrderCount]); + + return ( +
+
+ 주문번호 + 주문일시 + 픽업유무 + 주문금액 + {isRecentFirst ? ( + setIsRecentFirst(!isRecentFirst)} + > + 과거순 + new + + ) : ( + setIsRecentFirst(!isRecentFirst)} + > + 최신순 + new + + )} +
+
+ {sortedOrders.map((order) => ( + + ))} +
+
+ ); }; export default Complete; diff --git a/src/pages/Home/StatusHome/DetailHome.css b/src/pages/Home/StatusHome/DetailHome.css index edf4b34..fa9de71 100644 --- a/src/pages/Home/StatusHome/DetailHome.css +++ b/src/pages/Home/StatusHome/DetailHome.css @@ -1,6 +1,7 @@ .Order-wrapper { width: 100%; /* height: 100%; */ + padding: 0%; } .Order-title__wrapper { @@ -26,51 +27,44 @@ } .Order-content__wrapper { - width: 100%; + padding: 0%; + height: calc(46.25rem - 5.0625rem); /* height: calc(42.5rem - 5.0625rem); */ overflow-y: auto; -} -.mainInven-category-content__box { display: flex; - - width: 100%; - min-width: calc(73.75rem - 8.875rem); - height: 3.6875rem; - border-bottom: #dadada solid 0.125rem; + flex-direction: column; } -.mainInven-category-content__box.selected { - background-color: rgba(216, 35, 86, 0.15); -} +.Order-content__box { + width: 33.375rem; + padding: 2% 0% 2% 0%; -.mainInven-category-content__box span { - font-size: 1.5625rem; - font-family: "Medium"; - color: #4f4f4f; - line-height: 3.6875rem; -} + border-top: 2px solid #838383; -.mainInven-category-checkbox { - height: 2.1875rem; - width: 2.1875rem; - border: #dadada solid 0.1875rem; - border-radius: 0.125rem; + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: flex-start; + align-items: center; } -/* -.mainInven-category-checkbox.selected { - background: #d82356 url("../../assets/icons/icon_check.svg") no-repeat center - center; - - border: none; -} */ .Order-content__span { - width: 15%; - min-width: 8.3125rem; + width: 6.275rem; display: flex; justify-content: center; align-items: center; + + color: #000; + font-family: "Medium"; + font-size: 1.25rem; + font-weight: 500; + line-height: 100%; /* 1.25rem */ +} + +.Arrowicon { + width: 1.25rem; + height: 1.25rem; } diff --git a/src/pages/Home/StatusHome/Progress.jsx b/src/pages/Home/StatusHome/Progress.jsx index 82994ac..e52df2b 100644 --- a/src/pages/Home/StatusHome/Progress.jsx +++ b/src/pages/Home/StatusHome/Progress.jsx @@ -1,7 +1,143 @@ -import React from "react"; +import React, { useEffect, useState } from "react"; +import { useRecoilState } from "recoil"; +import { ordercnt, selectOrder, selectStatus } from "../../../Atom/order"; +import downArrow from "../../../assets/icons/icon_downArrow_black.svg"; +import OrderBox from "../../../components/views/Order/OrderBox"; +import "./DetailHome.css"; const Progress = () => { - return
Progress
; + const [orderCount, setOrderCount] = useRecoilState(ordercnt); // Recoil 상태 가져오기 + const [orderSelect, setOrderSelect] = useRecoilState(selectOrder); + const [statusSelect, setStatusSelect] = useRecoilState(selectStatus); + + const orderInfo = { + orders: [ + { + id: 123, //db 인덱스 + orderNum: 2, // 그날의 그가게의 주문번호 + pickUp: "픽업", + foodies: [ + { + name: "아메리카노", + count: 3, + options: ["샷 추가", "휘핑", "ICE", "그란데"], + }, + ], + phone: "010-6439-3547", // 고객의 전화번호 + time: "21/11/08 11:44:30", // 주문시간 + payment: "현대카드", + price: 8500, + }, + { + id: 124, //db 인덱스 + orderNum: 3, // 그날의 그가게의 주문번호 + pickUp: "매장", + foodies: [ + { + name: "아메리카누", + count: 3, + options: ["샷 추가 *100 ", "휘핑 *1000", "HOT", "그란데"], + }, + ], + phone: "010-7679-3547", // 고객의 전화번호 + time: "23/11/08 11:44:30", // 주문시간 + payment: "현대카드", + price: 78500, + }, + { + id: 125, + orderNum: 4, + pickUp: "픽업", + foodies: [ + { + name: "아메리카노", + count: 3, + options: ["샷 추가", "휘핑", "ICE", "그란데"], + }, + ], + phone: "010-6439-3547", // 고객의 전화번호 + time: "21/11/08 11:44:30", // 주문시간 + payment: "현대카드", + price: 8500, + }, + { + id: 126, + orderNum: 5, + pickUp: "매장", + foodies: [ + { + name: "아메리카노", + count: 3, + options: ["샷 추가", "휘핑", "ICE", "그란데"], + }, + ], + phone: "010-6439-3547", // 고객의 전화번호 + time: "21/11/08 11:44:30", // 주문시간 + payment: "현대카드", + price: 8500, + }, + ], + }; + + const [selectedOrderId, setSelectedOrderId] = useState(null); + const [isRecentFirst, setIsRecentFirst] = useState(false); + + const sortedOrders = isRecentFirst + ? [...orderInfo.orders].reverse() + : orderInfo.orders; + + const onClickHandler = (selectedOrder) => { + setOrderSelect(selectedOrder); + if (selectedOrder === null) { + setStatusSelect("null"); + } else { + setStatusSelect("progress"); + } + setSelectedOrderId(selectedOrder ? selectedOrder.id : null); + }; + + useEffect(() => { + // OrderBox가 생성될 때마다 개수 증가 + setOrderCount((prev) => ({ ...prev, progress: orderInfo.orders.length })); + }, [orderInfo.orders.length, setOrderCount]); + + return ( +
+
+ 주문번호 + 주문일시 + 픽업유무 + 주문금액 + {isRecentFirst ? ( + setIsRecentFirst(!isRecentFirst)} + > + 과거순 + new + + ) : ( + setIsRecentFirst(!isRecentFirst)} + > + 최신순 + new + + )} +
+
+ {sortedOrders.map((order) => ( + + ))} +
+
+ ); }; export default Progress; diff --git a/src/pages/Home/StatusHome/Wait.jsx b/src/pages/Home/StatusHome/Wait.jsx index 5ffd64c..26d03b2 100644 --- a/src/pages/Home/StatusHome/Wait.jsx +++ b/src/pages/Home/StatusHome/Wait.jsx @@ -1,43 +1,110 @@ -import React from "react"; +import React, { useEffect, useState } from "react"; +import { useRecoilState } from "recoil"; +import { ordercnt, selectOrder, selectStatus } from "../../../Atom/order"; +import downArrow from "../../../assets/icons/icon_downArrow_black.svg"; +import OrderBox from "../../../components/views/Order/OrderBox"; import "./DetailHome.css"; const Wait = () => { - // const orderInfo = { - // orders: [ - // { - // id: 123, //db 인덱스 - // orderNum: 2, // 그날의 그가게의 주문번호 - // pickUp: "픽업", - // foodies: [ - // { - // name: "아메리카노", - // count: 3, - // options: ["샷 추가", "휘핑", "ICE", "그란데"], - // }, - // ], - // phone: "010-6439-3547", // 고객의 전화번호 - // time: "21/11/08 11:44:30", // 주문시간 - // payment: "현대카드", - // price: 8500, - // }, - // { - // id: 133, //db 인덱스 - // orderNum: 33, // 그날의 그가게의 주문번호 - // pickUp: "매장", - // foodies: [ - // { - // name: "아메리카누", - // count: 3, - // options: ["샷 추가 *100 ", "휘핑 *1000", "HOT", "그란데"], - // }, - // ], - // phone: "010-7679-3547", // 고객의 전화번호 - // time: "23/11/08 11:44:30", // 주문시간 - // payment: "현대카드", - // price: 78500, - // }, - // ], - // }; + const [orderCount, setOrderCount] = useRecoilState(ordercnt); // Recoil 상태 가져오기 + const [orderSelect, setOrderSelect] = useRecoilState(selectOrder); + const [statusSelect, setStatusSelect] = useRecoilState(selectStatus); + + const orderInfo = { + orders: [ + { + id: 123, //db 인덱스 + orderNum: 2, // 그날의 그가게의 주문번호 + pickUp: "픽업", + foodies: [ + { + name: "아메리카노", + count: 3, + options: ["샷 추가", "휘핑", "ICE", "그란데"], + }, + ], + phone: "010-6439-3547", // 고객의 전화번호 + time: "21/11/08 11:44:30", // 주문시간 + payment: "현대카드", + price: 8500, + }, + { + id: 124, //db 인덱스 + orderNum: 3, // 그날의 그가게의 주문번호 + pickUp: "매장", + foodies: [ + { + name: "아메리카누", + count: 3, + options: ["샷 추가 *100 ", "휘핑 *1000", "HOT", "그란데"], + }, + ], + phone: "010-7679-3547", // 고객의 전화번호 + time: "23/11/08 11:44:30", // 주문시간 + payment: "현대카드", + price: 78500, + }, + { + id: 125, + orderNum: 4, + pickUp: "픽업", + foodies: [ + { + name: "아메리카노", + count: 3, + options: ["샷 추가", "휘핑", "ICE", "그란데"], + }, + ], + phone: "010-6439-3547", // 고객의 전화번호 + time: "21/11/08 11:44:30", // 주문시간 + payment: "현대카드", + price: 8500, + }, + { + id: 126, + orderNum: 5, + pickUp: "매장", + foodies: [ + { + name: "아메리카노", + count: 3, + options: ["샷 추가", "휘핑", "ICE", "그란데"], + }, + ], + phone: "010-6439-3547", // 고객의 전화번호 + time: "21/11/08 11:44:30", // 주문시간 + payment: "현대카드", + price: 8500, + }, + ], + }; + + const [selectedOrderId, setSelectedOrderId] = useState(null); + const [isRecentFirst, setIsRecentFirst] = useState(false); + + const sortedOrders = isRecentFirst + ? [...orderInfo.orders].reverse() + : orderInfo.orders; + + const onClickHandler = (selectedOrder) => { + setOrderSelect(selectedOrder); + if (selectedOrder === null) { + setStatusSelect("null"); + } else { + setStatusSelect("pending"); + } + setSelectedOrderId(selectedOrder ? selectedOrder.id : null); + }; + + useEffect(() => { + /* + while (orderInfo.orders.length !== 0 && soundState) { + AudioPlayer(); + }*/ + + // OrderBox가 생성될 때마다 개수 증가 + setOrderCount((prev) => ({ ...prev, pending: orderInfo.orders.length })); + }, [orderInfo.orders.length, setOrderCount]); return (
@@ -46,29 +113,34 @@ const Wait = () => { 주문일시 픽업유무 주문금액 - {/* 최신순 */} - {/*
- - {category} - {isCategoryOpen ? (downArrow) : (upArrow)} -
*/} - 최신순 + {isRecentFirst ? ( + setIsRecentFirst(!isRecentFirst)} + > + 과거순 + new + + ) : ( + setIsRecentFirst(!isRecentFirst)} + > + 최신순 + new + + )}
- - {/*
- {orderInfo.map((orders) => ( -
- -
+
+ {sortedOrders.map((order) => ( + ))} -
*/} +
); };