Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/components/Navbar/navbar.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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: "/" },
Expand All @@ -21,6 +22,11 @@ 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);
Expand Down Expand Up @@ -162,9 +168,17 @@ export default function Navbar() {
})}
</ul>

{/* 로그인/로그아웃 버튼 */}
{/* 튜토리얼, 로그인/로그아웃 버튼 */}

<div className="ml-auto pr-5">
<button
onClick={() => {
setShowTutorial(true);
}}
className="text-sm px-4 text-[#E2E2E2] hover:text-white"
>
튜토리얼
</button>
{mounted ? (
auth?.token ? (
<button
Expand All @@ -186,6 +200,7 @@ export default function Navbar() {
<div className="w-[64px] h-[20px]" />
)}
</div>
{showTutorial && <TutorialOverlay onClose={handleCloseTutorial} />}
</nav>
);
}
2 changes: 1 addition & 1 deletion src/components/blocks/Tutorial/TutorialPopup.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React, { useEffect, useState } from "react";
import MainHomeClient from "../MainHome/MainHome.client";
import { useRouter } from "next/navigation";
function TutorialOverlay({ onClose }) {
export function TutorialOverlay({ onClose }) {
const [index, setIndex] = useState(0);
const images = [
"/tuto1.png",
Expand Down