Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upravene zarovania #376

Merged
merged 2 commits into from
May 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 35 additions & 41 deletions src/components/CompetitionPage/CompetitionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,7 @@ type CompetitionPageProps = {
}

export const CompetitionPage: FC<CompetitionPageProps> = ({
competition: {
id,
name,
who_can_participate,
description,
upcoming_or_current_event,
competition_type,
history_events,
},
competition: {id, name, who_can_participate, description, upcoming_or_current_event, history_events},
}) => {
const {setBannerMessages} = BannerContainer.useContainer()

Expand All @@ -48,11 +40,17 @@ export const CompetitionPage: FC<CompetitionPageProps> = ({

return (
<Stack gap={3}>
{who_can_participate && <Typography variant="body1">Súťaž je určená pre {who_can_participate}</Typography>}
<Typography variant="body1">
{who_can_participate && `Súťaž je určená pre ${who_can_participate}.`}
{description && ` ${description}`}
</Typography>

{description && <Typography variant="body1">{description}</Typography>}

<Stack alignSelf="center">
<Stack
sx={{
mt: 0.5,
alignItems: 'end',
}}
>
<Link variant="button2" href={rulesLink}>
Pravidlá
</Link>
Expand All @@ -73,23 +71,23 @@ export const CompetitionPage: FC<CompetitionPageProps> = ({
</Typography>
)}
{upcoming_or_current_event.publication_set.length > 0 && (
<Stack alignSelf="center">
<Stack sx={{alignItems: 'end'}}>
<Link variant="button2" href={`/api/${upcoming_or_current_event.publication_set[0].file}`}>
Pozvánka
</Link>
</Stack>
)}
{upcoming_or_current_event.registration_link && (
<>
<Typography variant="body1">{upcoming_or_current_event.registration_link.additional_info}</Typography>
<Typography variant="body1">
<b>Registrácia prebieha do:</b> {formatDateTime(upcoming_or_current_event.registration_link.end)}
</Typography>
<Stack alignSelf="center">
<Stack sx={{alignItems: 'end'}}>
<Link variant="button2" href={upcoming_or_current_event.registration_link.url}>
Registračný formulár
</Link>
</Stack>
<Typography variant="body1">{upcoming_or_current_event.registration_link.additional_info}</Typography>
</>
)}
</Stack>
Expand All @@ -99,36 +97,32 @@ export const CompetitionPage: FC<CompetitionPageProps> = ({
</Typography>
)}
</Stack>

<Stack>
<Typography variant="h2">Archív</Typography>
{/* TODO: asi zjednotit styly, neriesit with/without publications */}
{competition_type?.name === 'Tábor' ? (
kovacspe marked this conversation as resolved.
Show resolved Hide resolved
<Stack gap={1}>
{history_events.map((event) => (
<Typography key={event.id} variant="h3" component="span">
{name + ' '} {event.school_year}

<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>
) : (
<Stack gap={1}>
{history_events.map((event) => (
<Stack key={event.id} direction="row" gap={20}>
<Typography variant="h3" component="span">
{name} {event.school_year}
</Typography>
<Stack direction="row" gap={2}>
{event.publication_set.map((publication) => (
<Link variant="button2" key={publication.id} href={`/api/${publication.file}`}>
{publication.name}
</Link>
))}
</Stack>
<Stack direction="row" gap={2}>
{event.publication_set.map((publication) => (
<Link variant="button2" key={publication.id} href={`/api/${publication.file}`}>
{publication.name}
</Link>
))}
</Stack>
))}
</Stack>
)}
</Stack>
))}
</Stack>
</Stack>
</Stack>
)
Expand Down
Loading