diff --git a/src/components/views/Chart/Chart.jsx b/src/components/views/Chart/Chart.jsx index c8d5bdb..25a7dfe 100644 --- a/src/components/views/Chart/Chart.jsx +++ b/src/components/views/Chart/Chart.jsx @@ -8,7 +8,7 @@ export default function Chart ({ data }) { '매출', ]} indexBy="day" - margin={{ top: 20, right: 0, bottom: 30, left: 30 }} + margin={{ top: 20, right: 10, bottom: 30, left: 40 }} padding={0.5} width={710} height={390} @@ -22,6 +22,8 @@ export default function Chart ({ data }) { legendPosition: 'middle', legendOffset: -40, truncateTickAt: 0, + // tickValues: [0, 2, 4, 6, 8, 10], + // format: (value) => `${value.toFixed(1)}`, }} labelSkipWidth={12} labelSkipHeight={12} diff --git a/src/components/views/NavBar/NavBar.css b/src/components/views/NavBar/NavBar.css index 6237dda..6cbe54b 100644 --- a/src/components/views/NavBar/NavBar.css +++ b/src/components/views/NavBar/NavBar.css @@ -6,6 +6,7 @@ background-color: #2e2d2d; display: flex; + flex-direction: column; justify-content: space-around; } @@ -33,10 +34,10 @@ .menu-font { color: #fff; - font-family: Pretendard; + font-family: "Bold"; font-size: 1.25rem; - font-style: normal; - font-weight: 700; + /* font-style: normal; + font-weight: 700; */ line-height: 130%; /* 1.625rem */ letter-spacing: -0.0125rem; } diff --git a/src/pages/Home/Home.jsx b/src/pages/Home/Home.jsx index f11c1d6..6bbb524 100644 --- a/src/pages/Home/Home.jsx +++ b/src/pages/Home/Home.jsx @@ -1,4 +1,5 @@ -import React from "react"; +import axios from "axios"; +import React, { useEffect, useState } from "react"; import Header from "../../components/views/Header/Header2"; import NavBar from "../../components/views/NavBar/NavBar"; import "./Home.css"; @@ -7,6 +8,83 @@ import Receipt from "./Receipt/Receipt"; function Home () { + const apiUrl = process.env.REACT_APP_API_ROOT; + + const [waitInfo, setWaitInfo] = useState({}); + const [makeInfo, setMakeInfo] = useState({}); + const [completeInfo, setCompleteInfo] = useState({}); + + const waitData = () => { + const config = { + withCredentials: true + }; + + axios.get(`${apiUrl}/api/v1/order?status=ORDER`, config) + .then((res) => { + console.log(res); + setWaitInfo(res.data); + }) + .catch((err) => { + console.log(err); + if(err.status === 404 && err.message === "Not found order."){ + setWaitInfo({}); + } + }) + } + + const makeData = () => { + const config = { + withCredentials: true + }; + + axios.get(`${apiUrl}/api/v1/order?status=MAKE`, config) + .then((res) => { + console.log(res); + setMakeInfo(res.data); + }) + .catch((err) => { + console.log(err); + if(err.status === 404 && err.message === "Not found order."){ + setMakeInfo({}); + } + }) + } + + const completeData = () => { + const config = { + withCredentials: true + }; + + axios.get(`${apiUrl}/api/v1/order?status=COMPLETE`, config) + .then((res) => { + console.log(res); + setCompleteInfo(res.data); + }) + .catch((err) => { + console.log(err); + if(err.status === 404 && err.message === "Not found order."){ + setCompleteInfo({}); + } + }) + } + + const fetchData = () => { + waitData(); + makeData(); + completeData(); + } + + useEffect(() => { + fetchData(); + + // const intervalId = setInterval(fetchData, 5000); // 5초마다 실행 + + // return () => clearInterval(intervalId); + + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + return (