From 4a7eade9f95151ffa6d3053e689bd2e71678b0f2 Mon Sep 17 00:00:00 2001 From: matushl Date: Thu, 16 Nov 2023 01:05:00 +0100 Subject: [PATCH] fix after review --- .../CompetitionPage/CompetitionPage.tsx | 15 +++++++-------- src/components/StaticSites/Texts.module.scss | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/components/CompetitionPage/CompetitionPage.tsx b/src/components/CompetitionPage/CompetitionPage.tsx index 8a03f73b..f3915ea8 100644 --- a/src/components/CompetitionPage/CompetitionPage.tsx +++ b/src/components/CompetitionPage/CompetitionPage.tsx @@ -2,13 +2,12 @@ import {useRouter} from 'next/router' import {FC, Fragment} from 'react' import {Link} from '@/components/Clickable/Clickable' -import {Competition, Event} from '@/types/api/generated/competition' +import {Competition, Event} from '@/types/api/competition' import {BannerContainer} from '@/utils/BannerContainer' import {formatDate} from '@/utils/formatDate' import styles from './competition.module.scss' -// TODO: skusime to opravit v API - `history_events` je nespravne vygenerovane ako `any` type OurCompetition = Omit & {history_events: Event[]} type CompetitionPageProps = { @@ -20,9 +19,9 @@ export const CompetitionPage: FC = ({ }) => { const {setBannerText} = BannerContainer.useContainer() - const startDate = formatDate(upcoming_or_current_event?.start) - const endDate = formatDate(upcoming_or_current_event?.end) - setBannerText(upcoming_or_current_event ? `${name} sa bude konať ${startDate}` : '') + const startDate = upcoming_or_current_event ? formatDate(upcoming_or_current_event.start) : null + const endDate = upcoming_or_current_event ? formatDate(upcoming_or_current_event.end) : null + setBannerText(startDate ? `${name} sa bude konať ${startDate}` : '') const router = useRouter() const rulesLink = `${router.asPath}/pravidla` @@ -39,8 +38,8 @@ export const CompetitionPage: FC = ({

Nadchádzajúci ročník:

- {upcoming_or_current_event.start &&

Odkedy? {startDate}

} - {upcoming_or_current_event.end &&

Dokedy? {endDate}

} + {startDate &&

Odkedy? {startDate}

} + {endDate &&

Dokedy? {endDate}

} {upcoming_or_current_event.publication_set.length > 0 && (

Pozvánka @@ -77,7 +76,7 @@ export const CompetitionPage: FC = ({

Archív:

{/* TODO: asi zjednotit styly, neriesit with/without publications */} - {competition_type.name === 'Tábor' ? ( + {competition_type?.name === 'Tábor' ? (
{history_events.map((event) => ( diff --git a/src/components/StaticSites/Texts.module.scss b/src/components/StaticSites/Texts.module.scss index dca6773e..2e6417d0 100644 --- a/src/components/StaticSites/Texts.module.scss +++ b/src/components/StaticSites/Texts.module.scss @@ -15,5 +15,5 @@ } .p { - padding-bottom: 1rem; + margin: 1rem 0; } \ No newline at end of file