|
1 | 1 | import dayjs from 'dayjs'; |
2 | 2 | import { Paper, Stack, Typography } from '@mui/material'; |
3 | 3 | import Grid from '@mui/material/Grid'; |
4 | | -import { PortalEvent, PortalEventStatus } from '@lems/types'; |
| 4 | +import { PortalEventStatus } from '@lems/types'; |
5 | 5 | import LiveIcon from '../live-icon'; |
| 6 | +import { useTranslations } from 'next-intl'; |
6 | 7 |
|
7 | 8 | interface EventStatusProps { |
8 | | - event: PortalEvent; |
9 | 9 | status: PortalEventStatus; |
10 | 10 | } |
11 | 11 |
|
12 | | -const EventStatus: React.FC<EventStatusProps> = ({ event, status }) => { |
| 12 | +const EventStatus: React.FC<EventStatusProps> = ({ status }) => { |
| 13 | + const t = useTranslations('components:events:event-status'); |
| 14 | + |
13 | 15 | const hasCurrentMatch = status.field.match.number > 0; |
14 | 16 | const hasCurrentSession = status.judging.session.number > 0; |
15 | 17 |
|
16 | 18 | return ( |
17 | 19 | <Paper sx={{ p: 2, my: 2, width: '100%' }}> |
18 | 20 | <Stack direction="row" alignItems="center" spacing={2} mb={1}> |
19 | 21 | <Typography variant="h2" maxWidth="90%"> |
20 | | - אירוע פעיל |
| 22 | + {t('active-event')} |
21 | 23 | </Typography> |
22 | 24 | <LiveIcon /> |
23 | 25 | </Stack> |
24 | 26 | <Grid container width="100%"> |
25 | 27 | <Grid size={{ xs: 12, md: 6 }}> |
26 | 28 | {hasCurrentMatch ? ( |
27 | 29 | <> |
28 | | - <Typography variant="h6">מקצה נוכחי - מקצה #{status.field.match.number}</Typography> |
29 | | - <Typography color="text.secondary" gutterBottom> |
30 | | - זמן מתוכנן: {dayjs(status.field.match.time).format('HH:mm')} |
| 30 | + <Typography variant="h6"> |
| 31 | + {t('current-match', { number: status.field.match.number })} |
| 32 | + </Typography> |
| 33 | + <Typography variant="h6"> |
| 34 | + {t('current-match-time', { time: dayjs(status.field.match.time).format('HH:mm') })} |
31 | 35 | </Typography> |
32 | 36 | </> |
33 | 37 | ) : ( |
34 | | - <Typography variant="h6">כל המקצים הושלמו</Typography> |
| 38 | + <Typography variant="h6">{t('all-matches-completed')}</Typography> |
35 | 39 | )} |
36 | 40 | </Grid> |
37 | 41 | <Grid size={{ xs: 12, md: 6 }}> |
38 | 42 | {hasCurrentSession ? ( |
39 | 43 | <> |
40 | | - <Typography variant="h6"> |
41 | | - סבב שיפוט נוכחי - סבב #{status.judging.session.number} |
| 44 | + <Typography color="text.secondary" gutterBottom> |
| 45 | + {t('current-session', { number: status.judging.session.number })} |
42 | 46 | </Typography> |
43 | 47 | <Typography color="text.secondary" gutterBottom> |
44 | | - זמן מתוכנן: {dayjs(status.judging.session.time).format('HH:mm')} |
| 48 | + {t('current-session-time', { |
| 49 | + time: dayjs(status.judging.session.time).format('HH:mm') |
| 50 | + })} |
45 | 51 | </Typography> |
46 | 52 | </> |
47 | 53 | ) : ( |
48 | | - <Typography variant="h6">כל סבבי השיפוט הושלמו</Typography> |
| 54 | + <Typography variant="h6">{t('all-sessions-completed')}</Typography> |
49 | 55 | )} |
50 | 56 | </Grid> |
51 | 57 | </Grid> |
|
0 commit comments