1- import { FC } from 'react' ;
1+ import { FC , ReactNode } from 'react' ;
22import { Container } from 'react-bootstrap' ;
3+ import { TimeData } from 'web-utility' ;
34
5+ import { TimeRange } from '../../TimeRange' ;
46import type { HackathonAwardsMeta } from './Awards' ;
57import styles from './Schedule.module.less' ;
68
@@ -16,11 +18,13 @@ export interface HackathonScheduleFact extends HackathonAwardsMeta {
1618}
1719
1820export interface HackathonScheduleItem extends Record <
19- 'id' | 'phase' | 'title' | 'dateText' | ' description',
21+ 'id' | 'phase' | 'title' | 'description' ,
2022 string
2123> {
2224 facts : HackathonScheduleFact [ ] ;
2325
26+ endedAt ?: TimeData ;
27+ startedAt ?: TimeData ;
2428 stageGoal ?: string ;
2529 tone : HackathonScheduleTone ;
2630}
@@ -30,16 +34,21 @@ export interface HackathonScheduleProps extends Record<
3034 string
3135> {
3236 items : HackathonScheduleItem [ ] ;
33- keyDates ?: Record < 'date' | 'label' , string > [ ] ;
34- overviewPills : string [ ] ;
37+ keyDates ?: {
38+ label : string ;
39+ startedAt ?: TimeData ;
40+ endedAt ?: TimeData ;
41+ } [ ] ;
42+ overviewPills : ReactNode [ ] ;
3543}
3644
3745const ScheduleCard : FC < HackathonScheduleItem & Record < 'phaseLabel' | 'stageGoalLabel' , string > > = ( {
38- dateText,
3946 description,
47+ endedAt,
4048 facts,
4149 phase,
4250 phaseLabel,
51+ startedAt,
4352 stageGoal,
4453 stageGoalLabel,
4554 title,
@@ -52,7 +61,9 @@ const ScheduleCard: FC<HackathonScheduleItem & Record<'phaseLabel' | 'stageGoalL
5261 < span className = { `${ styles . dayNo } d-inline-flex align-items-center` } >
5362 { phaseLabel } { phase }
5463 </ span >
55- < time className = { styles . dayDate } > { dateText } </ time >
64+ < span className = { styles . dayDate } >
65+ < TimeRange start = { startedAt } end = { endedAt } />
66+ </ span >
5667 </ div >
5768
5869 < h3 className = { `${ styles . dayTitle } mt-3 mb-2` } > { title } </ h3 >
@@ -108,8 +119,8 @@ export const HackathonSchedule: FC<HackathonScheduleProps & { phaseLabel: string
108119 < ul
109120 className = { `list-unstyled ${ styles . scheduleOverview } d-flex flex-wrap justify-content-center gap-3 mb-4` }
110121 >
111- { overviewPills . map ( pill => (
112- < li key = { pill } className = { styles . schedulePill } >
122+ { overviewPills . map ( ( pill , index ) => (
123+ < li key = { index } className = { styles . schedulePill } >
113124 { pill }
114125 </ li >
115126 ) ) }
@@ -128,12 +139,14 @@ export const HackathonSchedule: FC<HackathonScheduleProps & { phaseLabel: string
128139
129140 { keyDates ?. [ 0 ] && (
130141 < ul className = { `list-unstyled ${ styles . keyDates } mt-4` } >
131- { keyDates . map ( ( { date , label } , index ) => (
142+ { keyDates . map ( ( { startedAt , endedAt , label } , index ) => (
132143 < li
133- key = { `${ date } -${ label } ` }
144+ key = { `${ startedAt || '' } - ${ endedAt || '' } -${ label } ` }
134145 className = { `${ styles . keyDateCard } d-grid gap-1 ${ index % 2 ? styles . keyDateCardWarn : '' } ` }
135146 >
136- < strong className = { styles . keyDateValue } > { date } </ strong >
147+ < strong className = { styles . keyDateValue } >
148+ < TimeRange start = { startedAt } end = { endedAt } format = "MM-DD" />
149+ </ strong >
137150 < span className = { styles . keyDateLabel } > { label } </ span >
138151 </ li >
139152 ) ) }
0 commit comments