Skip to content

Commit 680d8bc

Browse files
committed
chore: 중간 저장
1 parent ae98321 commit 680d8bc

2 files changed

Lines changed: 49 additions & 8 deletions

File tree

apps/pyconkr/src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { Test } from "./components/pages/test.tsx";
1111
import { IS_DEBUG_ENV } from "./consts";
1212
import { useAppContext } from "./contexts/app_context";
1313
import BackendAPISchemas from "../../../packages/common/src/schemas/backendAPI";
14+
import { SessionTimeTable } from "../../../packages/common/src/components/mdx_components/session_timetable.tsx";
1415

1516
export const App: React.FC = () => {
1617
const backendAPIClient = Common.Hooks.BackendAPI.useBackendClient();
@@ -47,6 +48,7 @@ export const App: React.FC = () => {
4748
<Route element={<MainLayout />}>
4849
{IS_DEBUG_ENV && <Route path="/debug" element={<Test />} />}
4950
<Route path="/account/sign-in" element={<ShopSignInPage />} />
51+
<Route path="/test" element={<SessionTimeTable />} />
5052
<Route path="/sponsors/:id" element={<SponsorDetailPage />} />
5153
<Route path="/pages/:id" element={<PageIdParamRenderer />} />
5254
<Route path="*" element={<RouteRenderer />} />

packages/common/src/components/mdx_components/session_timetable.tsx

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
import * as React from "react";
22
import BackendAPISchemas from "../../schemas/backendAPI";
3-
import { Box, Button, CircularProgress, Stack, styled, Typography } from "@mui/material";
3+
import { Box, Button, Stack, styled, Typography } from "@mui/material";
44
import { ErrorBoundary, Suspense } from "@suspensive/react";
55
import { ErrorFallback } from "../error_handler";
66
import Hooks from "../../hooks";
77
import { BackendAPIClient } from "../../apis/client";
88
import { StyledDivider } from "./styled_divider";
9+
import * as R from "remeda";
910

1011

12+
type Position = {
13+
readonly left: number;
14+
readonly top: number;
15+
readonly width: number;
16+
readonly height: number;
17+
}
18+
1119
type SessionTimeTableSlotType = {
1220
session: BackendAPISchemas.SessionSchema;
13-
startRow: number;
14-
endRow: number;
15-
startDateTime: Date;
16-
endDateTime: Date;
21+
position: Position;
1722
}
1823

1924
type SessionDate = {
@@ -48,7 +53,8 @@ const SessionTimeTableItem: React.FC<{ data: SessionTimeTableSlotType }> = ({ da
4853
const sessionCategories = data.session.categories;
4954

5055
return (
51-
<SessionTimeTableItemContainer direction="column">
56+
<SessionTimeTableItemBox position={data.position} >
57+
<SessionTimeTableItemContainer direction="column">
5258
<SessionTimeTableItemTagContainer direction="row">
5359
{sessionCategories.map((category) => (
5460
<CategoryButtonStyle>
@@ -59,15 +65,23 @@ const SessionTimeTableItem: React.FC<{ data: SessionTimeTableSlotType }> = ({ da
5965
<SessionTitle children={data.session.title} />
6066
<SpeakerName children={data.session.speakers ? data.session.speakers[0].nickname : ""} />
6167
</SessionTimeTableItemContainer>
68+
</SessionTimeTableItemBox>
6269
);
6370
}
6471

72+
const ErrorHeading = styled(Typography)({
73+
fontSize: "1em",
74+
fontWeight: 400,
75+
lineHeight: 1.25,
76+
textDecoration: "none",
77+
whiteSpace: "pre-wrap",
78+
});
79+
6580
export const SessionTimeTable: React.FC = ErrorBoundary.with(
6681
{ fallback: ErrorFallback },
6782
Suspense.with(
68-
{ fallback: <CircularProgress /> },
83+
{ fallback: <ErrorHeading>{"세션 목록을 불러오는 중 입니다."}</ErrorHeading> },
6984
() => {
70-
7185
const SessionDateTab: React.FC = () => {
7286
const convertLanguage = (dateString: SessionDate) => {
7387
const language: "ko" | "en" = "ko";
@@ -103,6 +117,20 @@ export const SessionTimeTable: React.FC = ErrorBoundary.with(
103117
});
104118
}, [sessions, selectedDate]);
105119

120+
const filteredSessionTimeTableSlots: SessionTimeTableSlotType[] = React.useMemo(() => {
121+
let data: SessionTimeTableSlotType[] = [];
122+
filteredSessions.map(session => {
123+
data.push({
124+
session: session,
125+
left: 1,
126+
top: 2,
127+
width: 3,
128+
height: 4
129+
})
130+
});
131+
return data;
132+
}, [filteredSessions, selectedDate])
133+
106134
return (
107135
<>
108136
<SessionDateTab />
@@ -112,6 +140,16 @@ export const SessionTimeTable: React.FC = ErrorBoundary.with(
112140
)
113141
)
114142

143+
const SessionTimeTableItemBox = styled(Box)<{position: Position}>(({position}) => ({
144+
alignItems: "center",
145+
justifyContent: "center",
146+
position: "absolute" as const,
147+
left: position.left,
148+
top: position.top,
149+
width: position.width,
150+
height: position.height,
151+
}));
152+
115153
const SessionTimeTableItemContainer = styled(Stack)({
116154
alignItems: "center",
117155
justifyContent: "center"
@@ -183,3 +221,4 @@ const CategoryButtonStyle = styled(Button)(({ theme }) => ({
183221
whiteSpace: "pre-wrap",
184222
});
185223

224+

0 commit comments

Comments
 (0)