Skip to content

Commit 9bb313c

Browse files
committed
2 parents eeabd3b + e86aea3 commit 9bb313c

8 files changed

Lines changed: 221 additions & 47 deletions

File tree

apps/ticket/src/app/(pages)/event/[eventId]/booking/[bookingId]/confirmed/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type Props = {
1414

1515
/**
1616
* 이벤트 예매 확정 페이지
17+
* @deprecated
1718
*/
1819
const ConfirmedPage = async ({ params }: Props) => {
1920
const { bookingId } = await params;

apps/ticket/src/app/(pages)/event/[eventId]/time-table/_clientBoundary/TimeTableErrorBoundary/index.tsx

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
import { ReactNode } from "react";
44

5-
import { Button, Flex, Typography } from "@permit/design-system";
65
import { ErrorBoundary, ErrorHandler } from "@/shared/clientBoundary/ErrorBoundary";
76
import { isAxiosErrorResponse } from "@/shared/types/axioxError";
87

8+
import { TimeTableErrorFallback } from "../TimeTableErrorFallback";
9+
910
type Props = {
1011
children: ReactNode;
1112
eventId: string;
@@ -17,30 +18,11 @@ export const TimeTableErrorBoundary = ({ children, eventId }: Props) => {
1718
return <ErrorBoundary handlers={timeTableErrorHandlers({ eventId })}>{children}</ErrorBoundary>;
1819
};
1920

20-
const timeTableErrorHandlers = ({ eventId }: { eventId?: string }): ErrorHandler[] => [
21+
const timeTableErrorHandlers = ({ eventId }: { eventId: string }): ErrorHandler[] => [
2122
{
2223
isError: (error) => isTimeTableNotRegisteredError(error),
2324
fallback: () => {
24-
return (
25-
<Flex
26-
direction="column"
27-
align="center"
28-
justify="center"
29-
gap={16}
30-
style={{ height: "calc(100vh - 150px)" }}
31-
>
32-
<Typography type="title20">아직 타임테이블이 등록되지 않았어요.</Typography>
33-
<Button
34-
variant="primary"
35-
size="md"
36-
onClick={() => {
37-
window.location.href = `/event/${eventId}`;
38-
}}
39-
>
40-
이벤트 보기
41-
</Button>
42-
</Flex>
43-
);
25+
return <TimeTableErrorFallback eventId={eventId} />;
4426
},
4527
},
4628
];
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.header {
2+
// margin-bottom: 8px;
3+
padding: 12px 16px;
4+
}
5+
6+
.back_button {
7+
width: 90px;
8+
height: 32px;
9+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
"use client";
2+
3+
import { useRouter } from "next/navigation";
4+
import classNames from "classnames/bind";
5+
6+
import { Button, Flex, Typography } from "@permit/design-system";
7+
import { useEventDetailQuery } from "@/data/events/getEventDetail/queries";
8+
import { LoadingWithLayout } from "@/shared/components/LoadingWithLayout";
9+
10+
import styles from "./index.module.scss";
11+
12+
const cx = classNames.bind(styles);
13+
14+
type Props = {
15+
eventId: string;
16+
};
17+
18+
export const TimeTableErrorFallback = ({ eventId }: Props) => {
19+
const router = useRouter();
20+
21+
const {
22+
data: eventDetailData,
23+
isLoading,
24+
error,
25+
} = useEventDetailQuery({
26+
eventId,
27+
});
28+
29+
const handleBackButtonClick = () => {
30+
router.push(`/event/${eventId}`);
31+
};
32+
33+
if (isLoading) {
34+
return <LoadingWithLayout />;
35+
}
36+
37+
if (error) {
38+
throw error;
39+
}
40+
41+
return (
42+
<>
43+
<header className={cx("header")}>
44+
<Flex gap={8} justify="space-between">
45+
<Flex direction="column" gap={16}>
46+
<Typography type="title20">{eventDetailData?.eventName}</Typography>
47+
48+
<Button
49+
className={cx("back_button")}
50+
variant="secondary"
51+
onClick={handleBackButtonClick}
52+
>
53+
{"< back"}
54+
</Button>
55+
56+
<Flex gap={8}>
57+
<Button
58+
variant="secondary"
59+
onClick={() => router.push(`/event/${eventId}/time-table`)}
60+
>
61+
{"Timetable"}
62+
</Button>
63+
<Button
64+
variant="secondary"
65+
onClick={() => router.push(`/event/${eventId}/time-table/site-map`)}
66+
>
67+
{"Sitemap"}
68+
</Button>
69+
</Flex>
70+
</Flex>
71+
<></>
72+
</Flex>
73+
</header>
74+
75+
<Flex
76+
direction="column"
77+
align="center"
78+
justify="center"
79+
gap={16}
80+
style={{ height: "calc(100vh - 150px)" }}
81+
>
82+
<Typography type="title20">아직 타임테이블이 등록되지 않았어요.</Typography>
83+
<Button
84+
variant="primary"
85+
size="md"
86+
onClick={() => {
87+
window.location.href = `/event/${eventId}`;
88+
}}
89+
>
90+
이벤트 보기
91+
</Button>
92+
</Flex>
93+
</>
94+
);
95+
};

apps/ticket/src/app/(pages)/event/[eventId]/time-table/site-map/_clientBoundary/SiteMapErrorBoundary/index.tsx

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,26 @@
22

33
import { ReactNode } from "react";
44

5-
import { Button, Flex, Typography } from "@permit/design-system";
65
import { ErrorBoundary, ErrorHandler } from "@/shared/clientBoundary/ErrorBoundary";
76
import { AxiosErrorResponse, isAxiosErrorResponse } from "@/shared/types/axioxError";
87

8+
import { SiteMapErrorFallback } from "../SiteMapErrorFallback";
9+
910
type Props = {
1011
children: ReactNode;
12+
eventId: string;
1113
};
1214

1315
const NOT_FOUND_SITE_MAP_ERROR_CODE = 40429;
1416

15-
export const SiteMapErrorBoundary = ({ children }: Props) => {
16-
return <ErrorBoundary handlers={siteMapErrorHandlers}>{children}</ErrorBoundary>;
17+
export const SiteMapErrorBoundary = ({ children, eventId }: Props) => {
18+
return <ErrorBoundary handlers={siteMapErrorHandlers({ eventId })}>{children}</ErrorBoundary>;
1719
};
1820

19-
const siteMapErrorHandlers: ErrorHandler[] = [
21+
const siteMapErrorHandlers = ({ eventId }: { eventId: string }): ErrorHandler[] => [
2022
{
2123
isError: (error) => isSiteMapNotRegisteredError(error as AxiosErrorResponse),
22-
fallback: () => (
23-
<Flex
24-
direction="column"
25-
align="center"
26-
justify="center"
27-
gap={16}
28-
style={{ height: "calc(100vh - 150px)" }}
29-
>
30-
<Typography type="title20">아직 사이트맵이 등록되지 않았어요.</Typography>
31-
<Button
32-
variant="primary"
33-
size="md"
34-
onClick={() => {
35-
window.location.href = "/";
36-
}}
37-
>
38-
홈으로 이동
39-
</Button>
40-
</Flex>
41-
),
24+
fallback: () => <SiteMapErrorFallback eventId={eventId} />,
4225
},
4326
];
4427

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.header {
2+
// margin-bottom: 8px;
3+
padding: 12px 16px;
4+
}
5+
6+
.back_button {
7+
width: 90px;
8+
height: 32px;
9+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
"use client";
2+
3+
import { useRouter } from "next/navigation";
4+
import classNames from "classnames/bind";
5+
6+
import { Button, Flex, Typography } from "@permit/design-system";
7+
import { useEventDetailQuery } from "@/data/events/getEventDetail/queries";
8+
import { LoadingWithLayout } from "@/shared/components/LoadingWithLayout";
9+
10+
import styles from "./index.module.scss";
11+
12+
const cx = classNames.bind(styles);
13+
14+
type Props = {
15+
eventId: string;
16+
};
17+
18+
export const SiteMapErrorFallback = ({ eventId }: Props) => {
19+
const router = useRouter();
20+
21+
const {
22+
data: eventDetailData,
23+
isLoading,
24+
error,
25+
} = useEventDetailQuery({
26+
eventId,
27+
});
28+
29+
const handleBackButtonClick = () => {
30+
router.push(`/event/${eventId}`);
31+
};
32+
33+
if (isLoading) {
34+
return <LoadingWithLayout />;
35+
}
36+
37+
if (error) {
38+
throw error;
39+
}
40+
41+
return (
42+
<>
43+
<header className={cx("header")}>
44+
<Flex gap={8} justify="space-between">
45+
<Flex direction="column" gap={16}>
46+
<Typography type="title20">{eventDetailData?.eventName}</Typography>
47+
48+
<Button
49+
className={cx("back_button")}
50+
variant="secondary"
51+
onClick={handleBackButtonClick}
52+
>
53+
{"< back"}
54+
</Button>
55+
56+
<Flex gap={8}>
57+
<Button
58+
variant="secondary"
59+
onClick={() => router.push(`/event/${eventId}/time-table`)}
60+
>
61+
{"Timetable"}
62+
</Button>
63+
<Button
64+
variant="secondary"
65+
onClick={() => router.push(`/event/${eventId}/time-table/site-map`)}
66+
>
67+
{"Sitemap"}
68+
</Button>
69+
</Flex>
70+
</Flex>
71+
<></>
72+
</Flex>
73+
</header>
74+
75+
<Flex
76+
direction="column"
77+
align="center"
78+
justify="center"
79+
gap={16}
80+
style={{ height: "calc(100vh - 150px)" }}
81+
>
82+
<Typography type="title20">아직 사이트맵이 등록되지 않았어요.</Typography>
83+
<Button
84+
variant="primary"
85+
size="md"
86+
onClick={() => {
87+
window.location.href = `/event/${eventId}`;
88+
}}
89+
>
90+
이벤트 보기
91+
</Button>
92+
</Flex>
93+
</>
94+
);
95+
};

apps/ticket/src/app/(pages)/event/[eventId]/time-table/site-map/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default async function SiteMapPage({ params }: Props) {
2020
qc.prefetchQuery(siteMapOptions({ eventId }));
2121

2222
return (
23-
<SiteMapErrorBoundary>
23+
<SiteMapErrorBoundary eventId={eventId}>
2424
<HydrationBoundary state={dehydrate(qc)}>
2525
<Suspense fallback={<LoadingWithLayout />}>
2626
<SiteMapClient eventId={eventId} />

0 commit comments

Comments
 (0)