Skip to content

Commit

Permalink
Redesign Competition Archive
Browse files Browse the repository at this point in the history
  • Loading branch information
Matushl committed Nov 23, 2024
1 parent 4abad55 commit 1742230
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 21 deletions.
51 changes: 31 additions & 20 deletions src/components/CompetitionPage/CompetitionPage.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import {Stack, Typography} from '@mui/material'
import Grid from '@mui/material/Unstable_Grid2'
import {useQuery} from '@tanstack/react-query'
import axios from 'axios'
import {useRouter} from 'next/router'
import {FC, useEffect} from 'react'
import {FC, Fragment, useEffect} from 'react'

import {Link} from '@/components/Clickable/Link'
import {Competition, Event} from '@/types/api/competition'
import {Competition, Event, PublicationTypes} from '@/types/api/competition'
import {BannerContainer} from '@/utils/BannerContainer'

import {UpcomingOrCurrentEventInfo} from './UpcomingOrCurrentEventInfo'
Expand Down Expand Up @@ -78,26 +79,36 @@ export const CompetitionPage: FC<CompetitionPageProps> = ({
</Typography>
)}
</Stack>
<Stack>
<Typography variant="h2">Archív</Typography>

<Stack gap={1}>
{history_events.map((event) => (
<Stack key={event.id} direction="row" sx={{justifyContent: 'space-between'}}>
<Typography variant="h3" component="span">
{name} {event.school_year}
</Typography>
<Stack direction="row" sx={{gap: {xs: 1, sm: 2}}}>
{event.publication_set.map((publication) => (
<Link variant="button2" key={publication.id} href={`/api${publication.file}`}>
{publication.name}
<Grid container spacing={2}>
{history_events.map((event) => {
const results = event.publication_set.find((p) => p.publication_type === PublicationTypes.RESULTS.id)
const problems = event.publication_set.find((p) => p.publication_type === PublicationTypes.PROBLEMS.id)
return (
<Fragment key={event.id}>
<Grid xs={8}>
<Typography variant="h2" component="span">
{name} {event.school_year}
</Typography>
</Grid>
<Grid xs={2} display="flex" justifyContent="end">
{results && (
<Link variant="button2" key={results.id} href={`/api${results.file}`}>
{results.name}
</Link>
))}
</Stack>
</Stack>
))}
</Stack>
</Stack>
)}
</Grid>
<Grid xs={2} display="flex" justifyContent="end">
{problems && (
<Link variant="button2" key={problems.id} href={`/api${problems.file}`}>
{problems.name}
</Link>
)}
</Grid>
</Fragment>
)
})}
</Grid>
</Stack>
)
}
2 changes: 1 addition & 1 deletion src/types/api/competition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const PublicationTypes = {
},
RESULTS: {
id: 1,
name: 'Výsledky',
name: 'Poradia',
},
SOLUTIONS: {
id: 2,
Expand Down

0 comments on commit 1742230

Please sign in to comment.