diff --git a/src/components/CompetitionPage/CompetitionPage.tsx b/src/components/CompetitionPage/CompetitionPage.tsx index 9b54b563..6cd2dbc1 100644 --- a/src/components/CompetitionPage/CompetitionPage.tsx +++ b/src/components/CompetitionPage/CompetitionPage.tsx @@ -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' @@ -78,26 +79,36 @@ export const CompetitionPage: FC = ({ )} - - Archív - - {history_events.map((event) => ( - - - {name} {event.school_year} - - - {event.publication_set.map((publication) => ( - - {publication.name} + + {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 ( + + + + {name} {event.school_year} + + + + {results && ( + + {results.name} - ))} - - - ))} - - + )} + + + {problems && ( + + {problems.name} + + )} + + + ) + })} + ) } diff --git a/src/types/api/competition.ts b/src/types/api/competition.ts index 42ab37df..4cf41f75 100644 --- a/src/types/api/competition.ts +++ b/src/types/api/competition.ts @@ -24,7 +24,7 @@ export const PublicationTypes = { }, RESULTS: { id: 1, - name: 'Výsledky', + name: 'Poradia', }, SOLUTIONS: { id: 2,