diff --git a/README.md b/README.md index 2081322..0a8daa2 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# UpAndDown-Client -About [오르락내리락] 과거의 차트로 공부하고! 나만의 종목으로 예측까지 해보는 주식 차트 학습 서비스 +# Candly-Client +About [Candly] 과거의 차트로 공부하고! 나만의 종목으로 예측까지 해보는 주식 차트 학습 서비스 diff --git a/src/components/Navbar/navbar.client.tsx b/src/components/Navbar/navbar.client.tsx index 8893c6e..edd10e5 100644 --- a/src/components/Navbar/navbar.client.tsx +++ b/src/components/Navbar/navbar.client.tsx @@ -6,11 +6,12 @@ import Link from "next/link"; import { checkUserStatus, getStock } from "@/services/userStock-service"; import { useAuthStore } from "@/stores/authStore"; import Image from "next/image"; +import { TutorialOverlay } from "../blocks/Tutorial/TutorialPopup.client"; const menuItems = [ { label: "홈", href: "/" }, { label: "연습문제", href: "/practice" }, - { label: "실전투자", href: "/investment", dynamic: true }, + { label: "실전예측", href: "/investment", dynamic: true }, { label: "랭킹", href: "/ranking" }, { label: "마이페이지", href: "/mypage" }, ]; @@ -21,9 +22,15 @@ export default function Navbar() { const auth = useAuthStore((s) => s.auth); const clearAuth = useAuthStore((s) => s.clearAuth); const loginRequiredPaths = ["/", "/practice", "/ranking", "/mypage"]; + const [showTutorial, setShowTutorial] = useState(false); + const handleCloseTutorial = () => { + localStorage.setItem("hideTutorial", "true"); + setShowTutorial(false); + }; - // hydration mismatch 방지용 const [mounted, setMounted] = useState(false); + const [menuOpen, setMenuOpen] = useState(false); + useEffect(() => { setMounted(true); }, []); @@ -31,28 +38,13 @@ export default function Navbar() { const handleInvestClick = async () => { try { - if (!auth?.token) { - console.warn("로그인 필요"); - return router.push("/auth/login"); - } + if (!auth?.token) return router.push("/auth/login"); const status = await checkUserStatus(auth.token); - //("이미 연동 완료된 user: ", status.hasHoldings); - - if (status.hasHoldings) { - const stockData = await getStock(auth.token); - const firstCode = stockData.stocks[0]?.stock_code._id; - //console.log("주식 조회", firstCode); - if (firstCode) { - router.push(`/investment/${firstCode}`); - } else { - router.push("/investment"); - } - } else { - router.push("/investment"); - } + const stockData = await getStock(auth.token); + const firstCode = stockData.stocks[0]?.stock_code._id; + router.push(firstCode ? `/investment/${firstCode}` : "/investment"); } catch (err) { - console.error("실전투자 이동 중 오류:", err); router.push("/investment"); } }; @@ -60,9 +52,7 @@ export default function Navbar() { const handleLogout = async () => { try { await fetch("/api/auth/logout", { method: "POST" }); - } catch (e) { - console.warn("서버 로그아웃 실패"); - } + } catch {} sessionStorage.removeItem("token"); clearAuth(); router.replace("/auth/login"); @@ -72,16 +62,18 @@ export default function Navbar() { router.push("/auth/login"); }; + const navButtonClass = (isActive: boolean) => + "text-base transition-colors cursor-pointer " + + (isActive + ? "text-[#396FFB] hover:text-blue-500 font-semibold" + : "text-[#E2E2E2] hover:text-white"); + return ( -