From 0be4a34bb1b8cbb597bff66ad318881b7ab12e38 Mon Sep 17 00:00:00 2001 From: YeIn kim <2076070@ewhain.net> Date: Wed, 7 May 2025 11:00:51 +0900 Subject: [PATCH 1/4] =?UTF-8?q?feature=20|=20sprint1=20|=20FRB-67=20|=20?= =?UTF-8?q?=EB=AA=A8=EB=8B=88=ED=84=B0=EB=A7=81=20=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=EC=8B=9C=EC=9E=91=20|=20=EA=B9=80=EC=98=88=EC=9D=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit + 추가: 사이드바 새로고침 시 위치가 제대로 표시되지 않던 문제 해결 --- src/App.jsx | 4 ++ src/Sidebar.jsx | 21 ++++++--- src/components/MonitorBox.jsx | 11 +++++ src/mock_data/mock_zonelist.js | 27 ++++++++++++ src/pages/Certifiaction.jsx | 7 +++ src/pages/Monitoring.jsx | 31 +++++++++++++ src/pages/Settings.jsx | 81 ++++++++++++++-------------------- src/styles/style.css | 39 +++++++++++++++- 8 files changed, 167 insertions(+), 54 deletions(-) create mode 100644 src/components/MonitorBox.jsx create mode 100644 src/mock_data/mock_zonelist.js create mode 100644 src/pages/Certifiaction.jsx create mode 100644 src/pages/Monitoring.jsx diff --git a/src/App.jsx b/src/App.jsx index 06156ab..1ffe70c 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -3,6 +3,8 @@ import Home from "./pages/Home"; import Sidebar from "./Sidebar"; import "./styles/style.css"; import Settings from "./pages/Settings"; +import Monitoring from "./pages/Monitoring"; +import Certification from "./pages/Certifiaction"; export default function App() { return ( @@ -13,6 +15,8 @@ export default function App() { } /> } /> + } /> + } /> diff --git a/src/Sidebar.jsx b/src/Sidebar.jsx index e733e30..400c232 100644 --- a/src/Sidebar.jsx +++ b/src/Sidebar.jsx @@ -1,4 +1,4 @@ -import { Link } from "react-router-dom"; +import { Link, useLocation } from "react-router-dom"; import MenuIcon from "./assets/menu_icon.svg?react"; import HomeIcon from "./assets/home_icon.svg?react"; import MonitorIcon from "./assets/monitor_icon.svg?react"; @@ -7,12 +7,23 @@ import AwardIcon from "./assets/award_icon.svg?react"; import BellIcon from "./assets/bell_icon.svg?react"; import CloseIcon from "./assets/close_icon.svg?react"; import Logo from "./assets/temp_logo.svg?react"; -import { useRef, useState } from "react"; +import { useEffect, useRef, useState } from "react"; export default function Sidebar() { - const [isOpen, setIsOpen] = useState(false); + const [isOpen, setIsOpen] = useState(true); const alram_count = 3; + const location = useLocation(); const [currentPage, setCurrentPage] = useState("Home"); + useEffect(() => { + if (location.pathname === "/") setCurrentPage("Home"); + else if (location.pathname.startsWith("/monitoring")) + setCurrentPage("Monitor"); + else if (location.pathname.startsWith("/settings")) + setCurrentPage("Sensor"); + else if (location.pathname.startsWith("/certification")) + setCurrentPage("Certification"); + }, [location.pathname]); + return (