11import * as React from "react" ;
22import 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" ;
44import { ErrorBoundary , Suspense } from "@suspensive/react" ;
55import { ErrorFallback } from "../error_handler" ;
66import Hooks from "../../hooks" ;
77import { BackendAPIClient } from "../../apis/client" ;
88import { 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+
1119type SessionTimeTableSlotType = {
1220 session : BackendAPISchemas . SessionSchema ;
13- startRow : number ;
14- endRow : number ;
15- startDateTime : Date ;
16- endDateTime : Date ;
21+ position : Position ;
1722}
1823
1924type 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+
6580export 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+
115153const 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