-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
88637d6
commit ac0bd1e
Showing
4 changed files
with
63 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { GetServerSideProps, GetServerSidePropsContext, NextPage } from 'next'; | ||
import dayjs from 'dayjs'; | ||
import { Typography, Container, Stack, Divider, Paper } from '@mui/material'; | ||
import { PortalActivity, PortalEvent, RobotGameMatchStage } from '@lems/types'; | ||
import { fetchEvent, fetchGeneralSchedule } from '../../../../lib/api'; | ||
import StyledEventSubtitle from '../../../../components/events/styled-event-subtitle'; | ||
|
||
interface Props { | ||
event: PortalEvent; | ||
schedule: PortalActivity<'general'>[]; | ||
} | ||
|
||
const Page: NextPage<Props> = ({ event, schedule }) => { | ||
return ( | ||
<Container maxWidth="md" sx={{ mt: 2 }}> | ||
<Typography variant="h2">לוח זמנים כללי</Typography> | ||
<StyledEventSubtitle event={event} /> | ||
<Stack component={Paper} spacing={1} p={2} mt={2}> | ||
{schedule.length === 0 && <Typography variant="body1">אין לוח זמנים כללי</Typography>} | ||
{schedule.map((activity, index) => ( | ||
<Stack | ||
key={index} | ||
spacing={2} | ||
direction="row" | ||
alignItems="center" | ||
divider={<Divider orientation="vertical" flexItem sx={{ borderWidth: 1 }} />} | ||
> | ||
<Typography sx={{ dir: 'ltr' }} variant="body1" fontWeight={500}> | ||
{dayjs(activity.time).format('HH:mm')} | ||
</Typography> | ||
<Typography variant="body1">{activity.name}</Typography> | ||
</Stack> | ||
))} | ||
</Stack> | ||
</Container> | ||
); | ||
}; | ||
|
||
export const getServerSideProps: GetServerSideProps = async (ctx: GetServerSidePropsContext) => { | ||
const eventId = ctx.params?.id as string; | ||
|
||
const { event } = await fetchEvent(eventId); | ||
const schedule = await fetchGeneralSchedule(eventId); | ||
return { props: { event, schedule } }; | ||
}; | ||
|
||
export default Page; |