Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ feat: 첫 방문 사용자 about페이지로 리다이렉트 #324

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jungmyunggi
Copy link
Collaborator

🔨 테스크

Issue

첫 방문 사용자 체크 후 about페이지로 리다이렉트

  • localStore에 visit-flag를 생성하여 첫방문 체크를 했습니다.

메인페이지 접근 시 스크롤 최상단으로 이동

  • about페이지에서 메인페이지에 접근하기 위해서 아래로 내려가있던 스크롤이 메인페이지에서도 그대로 유지되어 메인페이지 접근 시 해당 스크롤 위치까지 내려가는 현상이 있어서 수정했습니다.

📋 작업 내용

  • useVisitStore를 생성하여 hasVistied 상태를 저장하고 localStore에 flag를 생성하도록 구현했습니다.
import { create } from "zustand";

import { persist, createJSONStorage } from "zustand/middleware";

interface VisitState {
  hasVisited: boolean;
  setVisited: () => void;
}

export const useVisitStore = create<VisitState>()(
  persist(
    (set) => ({
      hasVisited: false,
      setVisited: () => set({ hasVisited: true }),
    }),
    {
      name: "visit-flag",
      storage: createJSONStorage(() => localStorage),
    }
  )
);
  • 메인페이지 접근 시 스크롤을 최상단으로 올리기 위해 MainContent.tsx에 useEffect를 활용하여 스크롤을 올렸습니다.

📷 스크린 샷

image

@jungmyunggi jungmyunggi added the ✨ Feature 기능 구현 label Mar 7, 2025
@jungmyunggi jungmyunggi added this to the 리팩토링을 한다. milestone Mar 7, 2025
@jungmyunggi jungmyunggi requested a review from junyeokk March 7, 2025 03:36
@jungmyunggi jungmyunggi self-assigned this Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature 기능 구현
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FE] 페이지 첫 접근시 about페이지를 보여주도록 수정
1 participant