Skip to content
11 changes: 9 additions & 2 deletions src/features/event/ui/EventList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ interface EventListComponentProps {
tag?: TagType;
}

const categoryToKorean: Record<CategoryType, string> = {
DEVELOPMENT_STUDY: '개발 스터디',
NETWORKING: '네트워킹',
HACKATHON: '해커톤',
CONFERENCE: '컨퍼런스',
};

const EventList = ({ category, tag }: EventListComponentProps) => {
const navigate = useNavigate();

Expand Down Expand Up @@ -58,9 +65,9 @@ const EventList = ({ category, tag }: EventListComponentProps) => {
{data?.pages[0]?.items.length === 0 ? (
<div className="sm:text-12 md:text-14 lg:text-16 py-8 text-placeholderText ">
{tag ? (
<div>생성된 이벤트가 없습니다.</div>
<div>열린 이벤트가 없습니다.</div>
) : category ? (
<div>생성된 {category} 이벤트가 없습니다.</div>
<div>열린 {categoryToKorean[category]} 이벤트가 없습니다.</div>
) : null}
</div>
) : (
Expand Down
10 changes: 9 additions & 1 deletion src/pages/home/ui/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ const MainPage = () => {
link: `/event-details/${event.id}`,
}));

const handleRefresh = () => {
if (location.pathname === '/') {
window.location.reload();
} else {
navigate('/');
}
};

return (
<div className="flex flex-col items-center pb-24">
<Header
Expand All @@ -38,7 +46,7 @@ const MainPage = () => {
/>
}
leftButtonClassName="sm:text-lg md:text-xl lg:text-2xl font-extrabold font-nexon"
leftButtonClick={() => {}}
leftButtonClick={handleRefresh}
leftButtonLabel="같이가요"
rightContent={
isLoggedIn ? (
Expand Down
14 changes: 3 additions & 11 deletions src/pages/menu/ui/MenuPage.tsx
Original file line number Diff line number Diff line change
@@ -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) => {
Expand All @@ -13,17 +11,11 @@ const handleIconClick = (navigate: (path: string) => void, path: string) => {

const MenuPage = () => {
const navigate = useNavigate();
const buttonData = getButtonData();

return (
<>
<Header
centerContent="카테고리"
rightContent={
<button type="button" className="w-5 z-10" onClick={() => navigate('/search')}>
<img src={searchIcon} alt="Search Icon" className="w-4" />
</button>
}
/>
<Header centerContent="메뉴" />
<div className={`${flexColumn} gap-4 px-8 md:px-10 mt-8`}>
{buttonData.map((button, index) => (
<div key={button.label}>
Expand Down
27 changes: 20 additions & 7 deletions src/shared/types/menuType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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; // 아이콘 경로
Expand All @@ -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;
};
6 changes: 1 addition & 5 deletions src/widgets/main/ui/BottomBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}}
>
<img src={item.icon} alt={`${item.label}Icon`} className={`${item.iconClassName} object-contain`} />
Expand Down