diff --git a/front-end/src/apps/event-monitor/event-monitor.tsx b/front-end/src/apps/event-monitor/event-monitor.tsx index ed5e181d..20c8ae09 100644 --- a/front-end/src/apps/event-monitor/event-monitor.tsx +++ b/front-end/src/apps/event-monitor/event-monitor.tsx @@ -1,4 +1,11 @@ -import { Card, CardContent, CardHeader, Grid, Typography } from '@mui/material'; +import { + Card, + CardActions, + CardContent, + CardHeader, + Grid, + Typography +} from '@mui/material'; import { FC, useEffect, useState } from 'react'; import { DefaultLayout } from 'src/layouts/default-layout'; import { MatchSocketEvent, MatchKey } from '@toa-lib/models'; @@ -7,6 +14,7 @@ import CheckCircleIcon from '@mui/icons-material/CheckCircle'; import ErrorIcon from '@mui/icons-material/Error'; import { useMatchAll } from 'src/api/use-match-data'; import { useTeamIdentifiersForEventKey } from 'src/hooks/use-team-identifier'; +import { DateTime } from 'luxon'; interface MonitorCardProps { field: number; @@ -88,115 +96,126 @@ const MonitorCard: FC = ({ field, url }) => { /> - - - - - {match && match.participants ? ( - <> - {' '} - {identifiers[match?.participants?.[0].teamKey]} - - ) : ( - '---' - )} - - - - - - {match && match.participants ? ( - <> - {identifiers[match?.participants?.[3].teamKey]}{' '} - - - ) : ( - '---' - )} - - + + + {match && match.participants ? ( + <> + {' '} + {identifiers[match?.participants?.[0].teamKey]} + + ) : ( + '---' + )} + + + + + + {match && match.participants ? ( + <> + {identifiers[match?.participants?.[3].teamKey]}{' '} + + + ) : ( + '---' + )} + + - - - {match && match.participants ? ( - <> - {' '} - {identifiers[match?.participants?.[1].teamKey]} - - ) : ( - '---' - )} - - - - vs. - - - - {match && match.participants ? ( - <> - {identifiers[match?.participants?.[4].teamKey]}{' '} - - - ) : ( - '---' - )} - - + + + {match && match.participants ? ( + <> + {' '} + {identifiers[match?.participants?.[1].teamKey]} + + ) : ( + '---' + )} + + + + vs. + + + + {match && match.participants ? ( + <> + {identifiers[match?.participants?.[4].teamKey]}{' '} + + + ) : ( + '---' + )} + + - - - {match && match.participants ? ( - <> - {' '} - {identifiers[match?.participants?.[2].teamKey]} - - ) : ( - '---' - )} - - - - - - {match && match.participants ? ( - <> - {identifiers[match?.participants?.[5].teamKey]}{' '} - - - ) : ( - '---' - )} - - + + + {match && match.participants ? ( + <> + {' '} + {identifiers[match?.participants?.[2].teamKey]} + + ) : ( + '---' + )} + + + + + + {match && match.participants ? ( + <> + {identifiers[match?.participants?.[5].teamKey]}{' '} + + + ) : ( + '---' + )} + + - - - {match ? match.redScore : '--'} - - - - - - {match ? match.blueScore : '--'} - - - + + + {match ? match.redScore : '--'} + + + + + + {match ? match.blueScore : '--'} + + + + {match + ? DateTime.now() <= DateTime.fromISO(match.startTime) + ? DateTime.now() + .diff(DateTime.fromISO(match.scheduledTime)) + .shiftTo('hours', 'minutes') + .toFormat(`h'h' m'm' 'behind'`) + : DateTime.fromISO(match.scheduledTime) + .diff(DateTime.now()) + .shiftTo('hours', 'minutes') + .toFormat(`h'h' m'm' 'ahead'`) + : ''} + + ); }; @@ -205,22 +224,19 @@ export const EventMonitor: FC = () => { return ( - + + + + - + - + - - - - -
HERE
-
- +