Skip to content

Commit 648f5ee

Browse files
authored
Merge pull request #283 from Nexters/feature/preview-webview
공연 내용 웹뷰 제공
2 parents 299c4ed + 993d55e commit 648f5ee

File tree

9 files changed

+116
-56
lines changed

9 files changed

+116
-56
lines changed

apps/preview/src/App.tsx

+8-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { HelmetProvider } from 'react-helmet-async';
99
import ShowPreviewPage from './pages/ShowPreviewPage';
1010
import { fetcher } from '@boolti/api/src/fetcher';
1111
import NotFound from './components/NotFound';
12-
import ShowPreviewNoticePage from './pages/ShowPreviewNoticePage';
12+
import ShowInfoDetailPage from './pages/ShowInfoDetailPage';
1313

1414
const router = createBrowserRouter([
1515
{
@@ -28,12 +28,16 @@ const router = createBrowserRouter([
2828
errorElement: <NotFound />,
2929
},
3030
{
31-
path: '/show/:showId/notice',
32-
element: <ShowPreviewNoticePage />,
31+
path: '/show/:showId/info',
32+
element: <ShowInfoDetailPage />,
3333
loader: async ({ params }) => {
3434
const showId = params.showId;
3535
if (showId) {
36-
return await fetcher.get<ShowPreviewResponse>(`web/papi/v1/shows/${showId}`);
36+
const response = await Promise.all([
37+
fetcher.get<ShowPreviewResponse>(`web/papi/v1/shows/${showId}`),
38+
fetcher.get<{ count: number }>(`web/papi/v1/shows/${showId}/sold-ticket-counts`),
39+
])
40+
return response;
3741
}
3842
},
3943
errorElement: <NotFound />,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import styled from '@emotion/styled'
2+
3+
const Container = styled.div`
4+
background-color : ${({ theme }) => theme.palette.mobile.grey.g95};
5+
padding: 0 20px;
6+
`
7+
8+
export default {
9+
Container,
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { ShowPreviewResponse } from "@boolti/api";
2+
import { ShowInfoDetail } from "@boolti/ui";
3+
import { format } from "date-fns";
4+
import { useLoaderData } from "react-router-dom";
5+
import Styled from './ShowInfoDetailPage.styles';
6+
7+
const ShowInfoDetailPage: React.FC = () => {
8+
const [show, { count: soldTicketCount }] = useLoaderData() as ShowPreviewResponse;
9+
10+
const {
11+
notice,
12+
salesEndTime,
13+
salesStartTime,
14+
hostName,
15+
isEnded
16+
} = show;
17+
18+
const callLinkClickHandler = () => {
19+
location.href = `tel:${show.hostPhoneNumber}`;
20+
}
21+
22+
const messageLinkClickHandler = () => {
23+
location.href = `sms:${show.hostPhoneNumber}`;
24+
}
25+
26+
return (
27+
<Styled.Container>
28+
<ShowInfoDetail
29+
show={{
30+
salesStartTime: format(new Date(salesStartTime), 'yyyy.MM.dd (E)'),
31+
salesEndTime: format(new Date(salesEndTime), 'yyyy.MM.dd (E)'),
32+
notice,
33+
hostName,
34+
isEnded,
35+
}}
36+
soldTicketCount={soldTicketCount}
37+
onClickCallLink={callLinkClickHandler}
38+
onClickMessageLink={messageLinkClickHandler}
39+
onClickCallLinkMobile={callLinkClickHandler}
40+
onClickMessageLinkMobile={messageLinkClickHandler}
41+
/>
42+
</Styled.Container>
43+
);
44+
}
45+
46+
export default ShowInfoDetailPage;

apps/preview/src/pages/ShowPreviewNoticePage/index.tsx

-25
This file was deleted.

packages/icon/src/components/Tickets.tsx

Whitespace-only changes.

packages/ui/src/components/ShowPreview/ShowInfoDetail.tsx

+24-24
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,39 @@
11
import Styled from './ShowPreview.styles';
2-
import { CallIcon, MessageIcon } from '@boolti/icon';
2+
import { CallIcon, MessageIcon, TicketIcon } from '@boolti/icon';
33

44
import ShowInfoDescription from '../ShowContentMarkdown';
55

66
interface Props {
77
show: {
8-
images: string[];
9-
name: string;
10-
date: string;
11-
startTime: string;
12-
runningTime: string;
138
salesStartTime: string;
149
salesEndTime: string;
15-
placeName: string;
16-
placeStreetAddress: string;
17-
placeDetailAddress: string;
1810
notice: string;
1911
hostName: string;
20-
hostPhoneNumber: string;
12+
isEnded: boolean;
2113
};
14+
soldTicketCount?: number;
2215
hasNoticePage?: boolean;
23-
onClickLink?: () => void;
24-
onClickLinkMobile?: () => void;
16+
onClickCallLink?: () => void;
17+
onClickMessageLink?: () => void;
18+
onClickCallLinkMobile?: () => void;
19+
onClickMessageLinkMobile?: () => void;
2520
onClickViewNotice?: () => void;
2621
}
2722

2823
const ShowInfoDetail = ({
2924
show: {
30-
// date,
31-
// startTime,
32-
// runningTime,
3325
salesStartTime,
3426
salesEndTime,
35-
// placeName,
36-
// placeStreetAddress,
37-
// placeDetailAddress,
3827
notice,
3928
hostName,
29+
isEnded,
4030
},
31+
soldTicketCount,
4132
hasNoticePage,
42-
onClickLink,
43-
onClickLinkMobile,
33+
onClickCallLink,
34+
onClickMessageLink,
35+
onClickCallLinkMobile,
36+
onClickMessageLinkMobile,
4437
onClickViewNotice,
4538
}: Props) => {
4639
return (
@@ -52,6 +45,13 @@ const ShowInfoDetail = ({
5245
<Styled.ShowInfoDescription>
5346
{salesStartTime} - {salesEndTime}
5447
</Styled.ShowInfoDescription>
48+
{isEnded && soldTicketCount !== undefined && (
49+
<Styled.ShowTicketInfoDescription>
50+
<Styled.TicketIcon>
51+
<TicketIcon />
52+
</Styled.TicketIcon> {soldTicketCount}매 판매 완료
53+
</Styled.ShowTicketInfoDescription>
54+
)}
5555
</Styled.ShowInfoGroup>
5656
<Styled.ShowInfoGroup>
5757
<Styled.ShowInfoTitleContainer>
@@ -73,18 +73,18 @@ const ShowInfoDetail = ({
7373
<Styled.ShowHost>
7474
<Styled.ShowHostName>{hostName}</Styled.ShowHostName>
7575
<Styled.ShowHostLink>
76-
<a onClick={onClickLink}>
76+
<a onClick={onClickCallLink}>
7777
<CallIcon />
7878
</a>
79-
<a onClick={onClickLink}>
79+
<a onClick={onClickMessageLink}>
8080
<MessageIcon />
8181
</a>
8282
</Styled.ShowHostLink>
8383
<Styled.ShowHostLinkMobile>
84-
<a onClick={onClickLinkMobile}>
84+
<a onClick={onClickCallLinkMobile}>
8585
<CallIcon />
8686
</a>
87-
<a onClick={onClickLinkMobile}>
87+
<a onClick={onClickMessageLinkMobile}>
8888
<MessageIcon />
8989
</a>
9090
</Styled.ShowHostLinkMobile>

packages/ui/src/components/ShowPreview/ShowPreview.styles.ts

+21
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ const ShowInfoDescription = styled.div<ShowInfoDescriptionProps>`
226226
color: ${({ theme }) => theme.palette.mobile.grey.g30};
227227
overflow-wrap: break-word;
228228
word-break: break-word;
229+
display: flex;
230+
align-items: center;
229231
230232
${({ isFullContent }) =>
231233
isFullContent &&
@@ -238,6 +240,23 @@ const ShowInfoDescription = styled.div<ShowInfoDescriptionProps>`
238240
`}
239241
`;
240242

243+
const ShowTicketInfoDescription = styled.div`
244+
${({ theme }) => theme.typo.b3};
245+
color: ${({ theme }) => theme.palette.mobile.grey.g30};
246+
overflow-wrap: break-word;
247+
word-break: break-word;
248+
display: flex;
249+
align-items: center;
250+
gap: 8px;
251+
margin-top: 4px;
252+
`;
253+
254+
const TicketIcon = styled.div`
255+
display: inline-flex;
256+
align-items: center;
257+
justify-content: center;
258+
`
259+
241260
const ShowInfoDescriptionBadge = styled.div`
242261
display: inline-flex;
243262
align-items: center;
@@ -398,6 +417,8 @@ export default {
398417
ShowInfoTitleTextButton,
399418
ShowInfoSubtitle,
400419
ShowInfoDescription,
420+
ShowTicketInfoDescription,
421+
TicketIcon,
401422
ShowInfoDescriptionBadge,
402423
ShowInfoBox,
403424
ShowHost,

packages/ui/src/components/ShowPreview/index.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ const ShowPreview = ({
130130
<ShowInfoDetail
131131
show={show}
132132
hasNoticePage={hasNoticePage}
133-
onClickLink={onClickLink}
134-
onClickLinkMobile={onClickLinkMobile}
133+
onClickCallLink={onClickLink}
134+
onClickMessageLink={onClickLink}
135+
onClickCallLinkMobile={onClickLinkMobile}
136+
onClickMessageLinkMobile={onClickLinkMobile}
135137
onClickViewNotice={() => {
136138
containerScrollTop.current = containerRef?.current?.scrollTop ?? null;
137139
containerRef?.current?.scrollTo(0, 0);

packages/ui/src/components/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import StepProgressBar from './StepProgressBar';
1616
import Checkbox from './Checkbox';
1717
import StepDialog from './Dialog/StepDialog';
1818
import ShowContentMarkdown from './ShowContentMarkdown';
19+
import ShowInfoDetail from './ShowPreview/ShowInfoDetail';
1920

2021
export {
2122
AgreeCheck,
@@ -35,5 +36,6 @@ export {
3536
StepProgressBar,
3637
Checkbox,
3738
StepDialog,
38-
ShowContentMarkdown
39+
ShowContentMarkdown,
40+
ShowInfoDetail,
3941
};

0 commit comments

Comments
 (0)