diff --git a/src/features/event/ui/EventList.tsx b/src/features/event/ui/EventList.tsx index 7a965d3d..44566765 100644 --- a/src/features/event/ui/EventList.tsx +++ b/src/features/event/ui/EventList.tsx @@ -16,6 +16,13 @@ interface EventListComponentProps { tag?: TagType; } +const categoryToKorean: Record = { + DEVELOPMENT_STUDY: '개발 스터디', + NETWORKING: '네트워킹', + HACKATHON: '해커톤', + CONFERENCE: '컨퍼런스', +}; + const EventList = ({ category, tag }: EventListComponentProps) => { const navigate = useNavigate(); @@ -58,9 +65,9 @@ const EventList = ({ category, tag }: EventListComponentProps) => { {data?.pages[0]?.items.length === 0 ? (
{tag ? ( -
생성된 이벤트가 없습니다.
+
열린 이벤트가 없습니다.
) : category ? ( -
생성된 {category} 이벤트가 없습니다.
+
열린 {categoryToKorean[category]} 이벤트가 없습니다.
) : null}
) : ( diff --git a/src/pages/home/ui/MainPage.tsx b/src/pages/home/ui/MainPage.tsx index c1a40338..3e8e6802 100644 --- a/src/pages/home/ui/MainPage.tsx +++ b/src/pages/home/ui/MainPage.tsx @@ -26,6 +26,14 @@ const MainPage = () => { link: `/event-details/${event.id}`, })); + const handleRefresh = () => { + if (location.pathname === '/') { + window.location.reload(); + } else { + navigate('/'); + } + }; + return (
{ /> } leftButtonClassName="sm:text-lg md:text-xl lg:text-2xl font-extrabold font-nexon" - leftButtonClick={() => {}} + leftButtonClick={handleRefresh} leftButtonLabel="같이가요" rightContent={ isLoggedIn ? ( diff --git a/src/pages/menu/ui/MenuPage.tsx b/src/pages/menu/ui/MenuPage.tsx index 770ea081..82937703 100644 --- a/src/pages/menu/ui/MenuPage.tsx +++ b/src/pages/menu/ui/MenuPage.tsx @@ -1,10 +1,8 @@ import { flexColumn } from '../../../../design-system/styles/flex'; import HorizontalCardButton from '../../../../design-system/ui/buttons/HorizontalCardButton'; import { useNavigate } from 'react-router-dom'; - -import searchIcon from '../../../../design-system/icons/Search.svg'; import Header from '../../../../design-system/ui/Header'; -import { buttonData } from '../../../shared/types/menuType'; +import { getButtonData } from '../../../shared/types/menuType'; import BottomBar from '../../../widgets/main/ui/BottomBar'; const handleIconClick = (navigate: (path: string) => void, path: string) => { @@ -13,17 +11,11 @@ const handleIconClick = (navigate: (path: string) => void, path: string) => { const MenuPage = () => { const navigate = useNavigate(); + const buttonData = getButtonData(); return ( <> -
navigate('/search')}> - Search Icon - - } - /> +
{buttonData.map((button, index) => (
diff --git a/src/shared/types/menuType.ts b/src/shared/types/menuType.ts index 35043968..06bae778 100644 --- a/src/shared/types/menuType.ts +++ b/src/shared/types/menuType.ts @@ -8,6 +8,7 @@ import SelectedEvent from '../../..//design-system/icons/SelectedEvent.svg'; import SelectedHost from '../../../public/assets/menu/SelectedHost.svg'; import SelectedLogout from '../../../public/assets/menu/SelectedLogout.svg'; import SelectedSetting from '../../../public/assets/menu/SelectedSetting.svg'; +import useAuthStore from '../../app/provider/authStore'; export interface buttonData { iconPath: string; // 아이콘 경로 @@ -16,10 +17,22 @@ export interface buttonData { path: string; // 경로 } -export const buttonData: buttonData[] = [ - { iconPath: Ticket, hoverIconPath: SelectedTicket, label: '구입한 티켓', path: '/menu/myTicket' }, - { iconPath: Host, hoverIconPath: SelectedHost, label: '내 호스트', path: '/menu/myHost' }, - { iconPath: Event, hoverIconPath: SelectedEvent, label: '이벤트 주최하기', path: '/event-creation' }, - { iconPath: Setting, hoverIconPath: SelectedSetting, label: '마이페이지', path: '/menu/myPage' }, - { iconPath: Logout, hoverIconPath: SelectedLogout, label: '로그아웃', path: '/menu/logout' }, -]; +export const getButtonData = (): buttonData[] => { + const isLoggedIn = useAuthStore.getState().isLoggedIn; + + const baseButtons: buttonData[] = [ + { iconPath: Ticket, hoverIconPath: SelectedTicket, label: '구입한 티켓', path: '/menu/myTicket' }, + { iconPath: Host, hoverIconPath: SelectedHost, label: '내 호스트', path: '/menu/myHost' }, + { iconPath: Event, hoverIconPath: SelectedEvent, label: '이벤트 주최하기', path: '/event-creation' }, + { iconPath: Setting, hoverIconPath: SelectedSetting, label: '마이페이지', path: '/menu/myPage' }, + ]; + + if (isLoggedIn) { + return [ + ...baseButtons, + { iconPath: Logout, hoverIconPath: SelectedLogout, label: '로그아웃', path: '/menu/logout' }, + ]; + } + + return baseButtons; +}; diff --git a/src/widgets/main/ui/BottomBar.tsx b/src/widgets/main/ui/BottomBar.tsx index c724fadb..6484b4d0 100644 --- a/src/widgets/main/ui/BottomBar.tsx +++ b/src/widgets/main/ui/BottomBar.tsx @@ -10,11 +10,7 @@ const BottomBar = () => { key={index} className="flex flex-col justify-center items-center w-24 h-20 cursor-pointer" onClick={() => { - if (location.pathname === item.path) { - navigate(-1); - } else { - navigate(item.path); - } + navigate(item.path); }} > {`${item.label}Icon`}