Skip to content

Commit 28d741d

Browse files
강소영 사원 은행/카드DX1팀 (soyoung526@lgcns.com강소영 사원 은행/카드DX1팀 (soyoung526@lgcns.com
authored andcommitted
chore: 중간 저장
1 parent 4f49b10 commit 28d741d

File tree

2 files changed

+190
-0
lines changed

2 files changed

+190
-0
lines changed
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
import * as React from "react";
2+
import BackendAPISchemas from "../../schemas/backendAPI";
3+
import { Box, Button, CircularProgress, Stack, styled, Typography } from "@mui/material";
4+
import { ErrorBoundary, Suspense } from "@suspensive/react";
5+
import { ErrorFallback } from "../error_handler";
6+
import Hooks from "../../hooks";
7+
import { BackendAPIClient } from "../../apis/client";
8+
import { StyledDivider } from "./styled_divider";
9+
10+
11+
type SessionTimeTableSlotType = {
12+
session: BackendAPISchemas.SessionSchema;
13+
startRow: number;
14+
endRow: number;
15+
startDateTime: Date;
16+
endDateTime: Date;
17+
}
18+
19+
type SessionDate = {
20+
index: number;
21+
date: Date;
22+
ko: string;
23+
en: string;
24+
}
25+
26+
const sessionDates: SessionDate[] = [
27+
{
28+
index: 1,
29+
date: new Date(2025, 8, 15),
30+
ko: "8월 15일 금요일",
31+
en: "August 15 (Fri)"
32+
},
33+
{
34+
index: 2,
35+
date: new Date(2025, 8, 16),
36+
ko: "8월 16일 토요일",
37+
en: "August 16 (Sat)"
38+
},
39+
{
40+
index: 3,
41+
date: new Date(2025, 8, 17),
42+
ko: "8월 17일 일요일",
43+
en: "August 17 (Sun)"
44+
}
45+
];
46+
47+
const SessionTimeTableItem: React.FC<{ data: SessionTimeTableSlotType }> = ({ data }) => {
48+
const sessionCategories = data.session.categories;
49+
50+
return (
51+
<SessionTimeTableItemContainer direction="column">
52+
<SessionTimeTableItemTagContainer direction="row">
53+
{sessionCategories.map((category) => (
54+
<CategoryButtonStyle>
55+
{category.name}
56+
</CategoryButtonStyle>
57+
))}
58+
</SessionTimeTableItemTagContainer>
59+
<SessionTitle children={data.session.title} />
60+
<SpeakerName children={data.session.speakers ? data.session.speakers[0].nickname : ""} />
61+
</SessionTimeTableItemContainer>
62+
);
63+
}
64+
65+
export const SessionTimeTable: React.FC = ErrorBoundary.with(
66+
{ fallback: ErrorFallback },
67+
Suspense.with(
68+
{ fallback: <CircularProgress /> },
69+
() => {
70+
71+
const SessionDateTab: React.FC = () => {
72+
const convertLanguage = (dateString: SessionDate) => {
73+
const language: "ko" | "en" = "ko";
74+
if (language === "ko") {
75+
return dateString.ko;
76+
} else {
77+
return dateString.en;
78+
}
79+
}
80+
81+
return (
82+
<SessionDateTabContainer>
83+
<StyledDivider />
84+
{sessionDates.map(sessionDate => {
85+
return (
86+
<SessionDateItemContainer direction="column">
87+
<SessionDateTitle children={"Day " + sessionDate.index} isSelected={sessionDate.date.toDateString() === selectedDate} />
88+
<SessionDateSubTitle children={convertLanguage(sessionDate)} isSelected={sessionDate.date.toDateString() === selectedDate} />
89+
</SessionDateItemContainer>)
90+
})}
91+
<StyledDivider />
92+
</SessionDateTabContainer>
93+
);
94+
}
95+
96+
const backendAPIClient = Hooks.BackendAPI.useBackendClient();
97+
const { data: sessions } = Hooks.BackendAPI.useSessionsQuery(backendAPIClient);
98+
const [sessionData, setSessionData] = React.useState(sessions);
99+
const [selectedDate, setSelectedDate] = React.useState("");
100+
const filteredSessions = React.useMemo(() => {
101+
return sessions.filter((session) => {
102+
return selectedDate === session.schedule.startTime.toDateString();
103+
});
104+
}, [sessions, selectedDate]);
105+
106+
return (
107+
<>
108+
<SessionDateTab />
109+
</>
110+
);
111+
}
112+
)
113+
)
114+
115+
const SessionTimeTableItemContainer = styled(Stack)({
116+
alignItems: "center",
117+
justifyContent: "center"
118+
});
119+
120+
const SessionTimeTableItemTagContainer = styled(Stack)({
121+
alignItems: "center",
122+
justifyContent: "center",
123+
});
124+
125+
const SessionDateTabContainer = styled(Box)({
126+
alignItems: "center",
127+
justifyContent: "center"
128+
});
129+
130+
const SessionDateItemContainer = styled(Stack)({
131+
alignItems: "center",
132+
justifyContent: "center"
133+
});
134+
135+
const SessionDateTitle = styled(Typography)<{isSelected: boolean}>(({theme, isSelected}) => ({
136+
fontSize: "1.5em",
137+
fontWeight: 400,
138+
lineHeight: 1.25,
139+
textDecoration: "none",
140+
whiteSpace: "pre-wrap",
141+
color: isSelected ? theme.palette.primary.main : theme.palette.primary.light
142+
}));
143+
144+
const SessionDateSubTitle = styled(Typography)<{isSelected: boolean}>(({theme, isSelected}) => ({
145+
fontSize: "1.5em",
146+
fontWeight: 400,
147+
lineHeight: 1.25,
148+
textDecoration: "none",
149+
whiteSpace: "pre-wrap",
150+
color: isSelected ? theme.palette.primary.main : theme.palette.primary.light
151+
}));
152+
153+
const CategoryButtonStyle = styled(Button)(({ theme }) => ({
154+
flexGrow: 0,
155+
flexShrink: 0,
156+
flexBasis: "14rem",
157+
158+
wordBreak: "keep-all",
159+
whiteSpace: "nowrap",
160+
161+
// backgroundColor: selected ? theme.palette.primary.light : "transparent",
162+
// color: selected ? theme.palette.primary.main : theme.palette.primary.light, // main or light color로 지정
163+
backgroundColor: "transparent",
164+
color: theme.palette.primary.light,
165+
"&:hover": {
166+
color: theme.palette.primary.dark,
167+
},
168+
}));
169+
170+
const SessionTitle = styled(Typography)({
171+
fontSize: "1.5em",
172+
fontWeight: 600,
173+
lineHeight: 1.25,
174+
textDecoration: "none",
175+
whiteSpace: "pre-wrap",
176+
});
177+
178+
const SpeakerName = styled(Typography)({
179+
fontSize: "1em",
180+
fontWeight: 400,
181+
lineHeight: 1.25,
182+
textDecoration: "none",
183+
whiteSpace: "pre-wrap",
184+
});
185+

packages/common/src/schemas/backendAPI.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ namespace BackendAPISchemas {
8585
biography: string;
8686
image: string | null;
8787
}[];
88+
schedule: {
89+
startTime: Date;
90+
endTime: Date;
91+
roomName: string;
92+
}
8893
};
8994

9095
export const isObjectErrorResponseSchema = (obj?: unknown): obj is BackendAPISchemas.ErrorResponseSchema => {

0 commit comments

Comments
 (0)