Skip to content

Commit

Permalink
Fix links to publications (#536)
Browse files Browse the repository at this point in the history
* Fix links to publications

* Open files in new tab
  • Loading branch information
mmihalik authored Dec 14, 2024
1 parent 03818f6 commit 761846d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
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

0 comments on commit 761846d

Please sign in to comment.