From 20f342ae427e0b21e6852bb70e9592263957eb70 Mon Sep 17 00:00:00 2001 From: matushl Date: Sun, 24 Nov 2024 14:17:24 +0100 Subject: [PATCH] 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', }, }