@@ -52,17 +52,19 @@ const DateChip = styled("div")({
5252 } ,
5353} ) ;
5454
55- const DateMonth = styled ( "div" ) ( {
56- fontSize : "9px" ,
57- textTransform : "uppercase" ,
58- letterSpacing : "0.08em" ,
59- color : "var(--mui-palette-secondary-main)" ,
60- fontWeight : 700 ,
61- lineHeight : 1.2 ,
62- "[data-today] &" : {
63- color : "var(--mui-palette-primary-main)" ,
64- } ,
65- } ) ;
55+ const DateMonth = styled ( "div" ) < { $labelFontSize ?: number } > (
56+ ( { $labelFontSize } ) => ( {
57+ fontSize : $labelFontSize ? `${ $labelFontSize } px` : "9px" ,
58+ textTransform : "uppercase" ,
59+ letterSpacing : "0.08em" ,
60+ color : "var(--mui-palette-secondary-main)" ,
61+ fontWeight : 700 ,
62+ lineHeight : 1.2 ,
63+ "[data-today] &" : {
64+ color : "var(--mui-palette-primary-main)" ,
65+ } ,
66+ } ) ,
67+ ) ;
6668
6769const DateDay = styled ( "div" ) ( {
6870 fontSize : "16px" ,
@@ -170,11 +172,16 @@ export default function EventListRow({ event }: EventListRowProps) {
170172 i18n : { language : locale } ,
171173 } = useTranslation ( [ DASHBOARD ] ) ;
172174
175+ const now = new Date ( ) ;
173176 const startDate = timestamp2Date ( event . startTime ! ) ;
174- const isToday = startDate . toDateString ( ) === new Date ( ) . toDateString ( ) ;
177+ const endDate = event . endTime ? timestamp2Date ( event . endTime ) : null ;
178+ const isOngoing = endDate !== null && startDate <= now && endDate >= now ;
179+ const isToday = ! isOngoing && startDate . toDateString ( ) === now . toDateString ( ) ;
175180 const todayLabel = t ( "dashboard:events.today_label" ) ;
176- const todayFontSize =
177- todayLabel . length <= 5 ? 9 : todayLabel . length <= 7 ? 8 : 7 ;
181+ const nowLabel = t ( "dashboard:now_label" ) ;
182+ const chipLabel = isOngoing ? nowLabel : todayLabel ;
183+ const chipFontSize =
184+ chipLabel . length <= 5 ? 9 : chipLabel . length <= 7 ? 8 : 7 ;
178185 const month = localizeMonthAbbreviation ( startDate , {
179186 locale,
180187 timezone : BROWSER_TIMEZONE ,
@@ -195,11 +202,13 @@ export default function EventListRow({ event }: EventListRowProps) {
195202
196203 return (
197204 < RowLink href = { routeToEvent ( event . eventId , event . slug ) } >
198- < DateChip data-today = { isToday || undefined } >
199- < DateMonth style = { isToday ? { fontSize : todayFontSize } : undefined } >
200- { isToday ? todayLabel : month }
205+ < DateChip data-today = { isToday || isOngoing || undefined } >
206+ < DateMonth
207+ $labelFontSize = { isToday || isOngoing ? chipFontSize : undefined }
208+ >
209+ { isOngoing ? nowLabel : isToday ? todayLabel : month }
201210 </ DateMonth >
202- { ! isToday && < DateDay > { day } </ DateDay > }
211+ { ! isToday && ! isOngoing && < DateDay > { day } </ DateDay > }
203212 </ DateChip >
204213 < ContentWrapper >
205214 < TitleRow >
0 commit comments