From 7d5ff51e1ca733b72e6bd5c2579e71b90122cdfe Mon Sep 17 00:00:00 2001 From: FF Date: Mon, 22 Sep 2025 08:45:12 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=BB=A4=EB=AE=A4=EB=8B=88=ED=8B=B0=20n?= =?UTF-8?q?avbar=20=EC=9E=90=EC=9C=A0=EA=B2=8C=EC=8B=9C=ED=8C=90=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/Community/CommunityFeed/index.tsx | 12 +++++++-- .../_components/CommunityNavigator.tsx | 25 ++++++++++--------- apps/web/src/stores/communityStore.ts | 2 +- apps/web/src/types/community.ts | 9 ++++++- 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/apps/web/src/pages/Community/CommunityFeed/index.tsx b/apps/web/src/pages/Community/CommunityFeed/index.tsx index 6c1512c..713afa9 100644 --- a/apps/web/src/pages/Community/CommunityFeed/index.tsx +++ b/apps/web/src/pages/Community/CommunityFeed/index.tsx @@ -8,6 +8,7 @@ import type { Post, Category } from '@/types/community'; import { getPostsCursor } from '@/api/posts'; import { useNativeBridgeStore } from '@/stores/nativeBridgeStore'; import type { ServerPostType } from '@/api/posts'; +import { useCommunityStore } from '@/stores/communityStore'; type RouteType = 'all' | 'free' | 'proof' | 'share' | 'mate' | 'my'; @@ -15,7 +16,7 @@ const DEFAULT_PAGE_LIMIT = 10; const TITLE_MAP: Record = { all: '전체', - free: '자유', + free: '자유 게시판', proof: '인증샷', share: '경로 공유', mate: '러닝메이트 구해요!', @@ -45,6 +46,8 @@ export default function CommunityFeed() { const { type: rawType } = useParams<{ type?: string }>(); const [searchParams] = useSearchParams(); + const setActiveNav = useCommunityStore((s) => s.setActiveNav); + const routeType: RouteType = rawType === 'free' || rawType === 'proof' || @@ -185,8 +188,13 @@ export default function CommunityFeed() { return () => io.disconnect(); }, [canLoadMore, loading, loadMore]); + const handleOnBack = useCallback(() => { + setActiveNav(undefined); + window.history.back(); + }, [setActiveNav]); + return ( - window.history.back()}> + {error && {error}} diff --git a/apps/web/src/pages/Community/_components/CommunityNavigator.tsx b/apps/web/src/pages/Community/_components/CommunityNavigator.tsx index e498931..8de045b 100644 --- a/apps/web/src/pages/Community/_components/CommunityNavigator.tsx +++ b/apps/web/src/pages/Community/_components/CommunityNavigator.tsx @@ -6,6 +6,7 @@ const PATH_BY_KEY = { route: '/community/feed/share', run: '/community/feed/mate', photo: '/community/feed/proof', + free: '/community/feed/free', all: '/community', } as const; @@ -23,14 +24,6 @@ export default function CommunityNavigator() { return ( - - 경로 - + 경로 + + - 전체보기 + 자유게시판 ); diff --git a/apps/web/src/stores/communityStore.ts b/apps/web/src/stores/communityStore.ts index 2b6a056..c6c506d 100644 --- a/apps/web/src/stores/communityStore.ts +++ b/apps/web/src/stores/communityStore.ts @@ -12,7 +12,7 @@ type Actions = { }; export const useCommunityStore = create()((set) => ({ - activeNav: 'home', + activeNav: undefined, filter: 'ALL', setActiveNav: (k) => set({ activeNav: k }), setFilter: (c) => set({ filter: c }), diff --git a/apps/web/src/types/community.ts b/apps/web/src/types/community.ts index 33289e9..30f2799 100644 --- a/apps/web/src/types/community.ts +++ b/apps/web/src/types/community.ts @@ -28,4 +28,11 @@ export interface Comment { authorInfo?: AuthorObj; } -export type NavKey = 'home' | 'photo' | 'route' | 'run' | 'all'; +export type NavKey = + | 'home' + | 'photo' + | 'route' + | 'run' + | 'free' + | 'all' + | undefined;