Skip to content

Commit

Permalink
Merge pull request #233 from BCSDLab/feature/#223-make_event_add
Browse files Browse the repository at this point in the history
[이벤트 추가] 이벤트 추가 페이지 구현
  • Loading branch information
chaeseungyun authored Apr 11, 2024
2 parents 82fc41f + eb8db12 commit b671671
Show file tree
Hide file tree
Showing 23 changed files with 711 additions and 10 deletions.
124 changes: 124 additions & 0 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/fsevents-patch-21ad2b1333-8.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.43.9",
"react-quill": "^2.0.0",
"react-router-dom": "^6.9.0",
"react-scripts": "5.0.1",
"react-toastify": "^10.0.4",
Expand Down
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Toast from 'component/common/Toast';
import { UserType } from 'model/auth';
import Coop from 'page/Coop';
import useUserTypeStore from 'store/userType';
import AddingEvent from 'page/AddingEvent';

interface ProtectedRouteProps {
userTypeRequired: UserType;
Expand Down Expand Up @@ -59,6 +60,7 @@ function App() {
<Route path="/owner/order-management" element={<PageNotFound />} />
<Route path="/owner/sales-management" element={<PageNotFound />} />
<Route path="/owner/shop-add" element={<PageNotFound />} />
<Route path="/owner/event-add/:id" element={<AddingEvent />} />
</Route>
</Route>
<Route element={<ProtectedRoute userTypeRequired="COOP" />}>
Expand Down
3 changes: 3 additions & 0 deletions src/api/shop/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ShopListRes } from 'model/shopInfo/allShopInfo';
import { accessClient, client } from 'api';
import { OwnerShop } from 'model/shopInfo/ownerShop';
import { NewMenu } from 'model/shopInfo/newMenu';
import { EventInfo } from 'model/shopInfo/event';

export const getMyShopList = async () => {
const { data } = await accessClient.get<MyShopListRes>('/owner/shops');
Expand Down Expand Up @@ -39,3 +40,5 @@ export const modifyMenu = (menuId:number, param:NewMenu) => accessClient.put(`/o
export const putShop = (id: number, data: OwnerShop) => accessClient.put(`/owner/shops/${id}`, data);

export const deleteMenu = (menuId:number) => accessClient.delete(`/owner/shops/menus/${menuId}`);

export const addEvent = (id: string, eventInfo: EventInfo) => accessClient.post(`owner/shops/${id}/event`, eventInfo);
5 changes: 5 additions & 0 deletions src/assets/svg/mystore/delete.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions src/component/common/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ function Header() {
},
});
};

if ((pathname === '/owner/add-menu' || pathname.startsWith('/owner/modify-menu/')) && isMobile) {
if ((pathname === '/owner/add-menu' || pathname.startsWith('/owner/modify-menu/') || pathname.startsWith('/owner/event-add/')) && isMobile) {
return (
<header className={styles['add-menu-header']}>
<button
Expand All @@ -60,7 +59,11 @@ function Header() {
>
<BackArrowIcon title="뒤로 가기 버튼" />
</button>
<div className={styles['add-menu-header__caption']}>{pathname === '/owner/add-menu' ? '메뉴추가' : '메뉴수정'}</div>
<div className={styles['add-menu-header__caption']}>
{pathname === '/owner/add-menu' && '메뉴추가'}
{pathname.startsWith('/owner/event-add/') && '이벤트/공지 작성하기'}
{pathname.startsWith('/owner/modify-menu/') && '메뉴수정'}
</div>
</header>
);
}
Expand Down
12 changes: 6 additions & 6 deletions src/layout/OwnerLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export default function OwnerLayout() {
return (
<div>
{user && (
<>
{location.pathname !== '/owner/shop-registration' && <Header />}
<ErrorBoundary message="에러가 발생했습니다.">
<Outlet />
</ErrorBoundary>
</>
<>
{location.pathname !== '/owner/shop-registration' && <Header />}
<ErrorBoundary message="에러가 발생했습니다.">
<Outlet />
</ErrorBoundary>
</>
)}
</div>
);
Expand Down
11 changes: 11 additions & 0 deletions src/model/shopInfo/event.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import z from 'zod';

export const EventInfo = z.object({
title: z.string(),
content: z.string(),
thumbnail_images: z.array(z.string()),
start_date: z.string(),
end_date: z.string(),
});

export type EventInfo = z.infer<typeof EventInfo>;
Loading

0 comments on commit b671671

Please sign in to comment.