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

Fix links to publications #536

Merged
merged 2 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
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
15 changes: 5 additions & 10 deletions src/components/Archive/Archive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ type MyEvent = Omit<Event, 'publication_set'> & {
}

const PublicationButton: FC<{
publicationId: number
publicationName: string
}> = ({publicationId, publicationName}) => {
publication: Publication
}> = ({publication}) => {
return (
<Link variant="button2" href={`/api/competition/publication/${publicationId}/download`} target="_blank">
Časopis {publicationName}
<Link variant="button2" href={`/api${publication.file}`} target="_blank">
{publication.name}
</Link>
)
}
Expand Down Expand Up @@ -79,11 +78,7 @@ export const Archive: FC = () => {
<ResultsButton eventYear={event.year} eventSeason={event.season_code} />
<ProblemsButton eventYear={event.year} eventSeason={event.season_code} />
{event.publication_set.map((publication) => (
<PublicationButton
key={publication.id}
publicationId={publication.id}
publicationName={publication.name}
/>
<PublicationButton key={publication.id} publication={publication} />
))}
</Stack>
</Stack>
Expand Down
6 changes: 3 additions & 3 deletions src/components/CompetitionPage/CompetitionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,19 @@ export const CompetitionPage: FC<CompetitionPageProps> = ({
</Grid>
<Grid xs={2} display="flex" justifyContent="end">
{results && (
<Link variant="button2" key={results.id} href={`/api${results.file}`}>
<Link variant="button2" key={results.id} href={`/api${results.file}`} target="_blank">
{PublicationTypes.RESULTS.display_name}
</Link>
)}
</Grid>
<Grid xs={2} display="flex" justifyContent="end">
{solutions ? (
<Link variant="button2" key={solutions.id} href={`/api${solutions.file}`}>
<Link variant="button2" key={solutions.id} href={`/api${solutions.file}`} target="_blank">
{PublicationTypes.SOLUTIONS.display_name}
</Link>
) : (
problems && (
<Link variant="button2" key={problems.id} href={`/api${problems.file}`}>
<Link variant="button2" key={problems.id} href={`/api${problems.file}`} target="_blank">
{PublicationTypes.PROBLEMS.display_name}
</Link>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/PublicationUploader/PublicationUploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const PublicationUploader: FC<PublicationUploaderProps> = ({semesterId, o
<Stack direction="row" gap={2} alignItems="center">
<Typography variant="body1">{order}. Časopis:</Typography>
{publication && (
<Link variant="button2" href={`/api/competition/publication/${publication.id}/download`}>
<Link variant="button2" href={`/api${publication.file}`} target="_blank">
{publication.name}
</Link>
)}
Expand Down
Loading