From aa52d4cb18110e9e517dc7aecfe321bc1aeb26f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=BA=C5=A1=20Hlav=C3=A1=C4=8Dik?= Date: Sun, 24 Nov 2024 14:44:20 +0100 Subject: [PATCH] Improve event publication list (#508) fix #504: Improve event publication list --- .../CompetitionPage/CompetitionPage.tsx | 15 +++++++++++---- src/types/api/competition.ts | 5 +++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/components/CompetitionPage/CompetitionPage.tsx b/src/components/CompetitionPage/CompetitionPage.tsx index 6cd2dbc1..b36a31d7 100644 --- a/src/components/CompetitionPage/CompetitionPage.tsx +++ b/src/components/CompetitionPage/CompetitionPage.tsx @@ -83,6 +83,7 @@ export const CompetitionPage: FC = ({ {history_events.map((event) => { const results = event.publication_set.find((p) => p.publication_type === PublicationTypes.RESULTS.id) + const solutions = event.publication_set.find((p) => p.publication_type === PublicationTypes.SOLUTIONS.id) const problems = event.publication_set.find((p) => p.publication_type === PublicationTypes.PROBLEMS.id) return ( @@ -94,15 +95,21 @@ export const CompetitionPage: FC = ({ {results && ( - {results.name} + {PublicationTypes.RESULTS.display_name} )} - {problems && ( - - {problems.name} + {solutions ? ( + + {PublicationTypes.SOLUTIONS.display_name} + ) : ( + problems && ( + + {PublicationTypes.PROBLEMS.display_name} + + ) )} diff --git a/src/types/api/competition.ts b/src/types/api/competition.ts index 4cf41f75..f1851478 100644 --- a/src/types/api/competition.ts +++ b/src/types/api/competition.ts @@ -21,22 +21,27 @@ export const PublicationTypes = { PROBLEMS: { id: 0, name: 'Zadania', + display_name: 'Zadania', }, RESULTS: { id: 1, name: 'Poradia', + display_name: 'Poradie', }, SOLUTIONS: { id: 2, name: 'Brožúra', + display_name: 'Brožúra', }, INVITATION: { id: 3, name: 'Pozvánka', + display_name: 'Pozvánka', }, LEAFLET: { id: 4, name: 'Časopisy', + display_name: 'Časopis', }, }