Skip to content

Commit

Permalink
Merge pull request sherlock-protocol#282 from sherlock-protocol/feat/…
Browse files Browse the repository at this point in the history
…audit-repo-link

feat: include audit repo link in contest details
  • Loading branch information
frimoldi authored Jan 16, 2023
2 parents 5ba1192 + 5885d71 commit 7944f52
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/hooks/api/contests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export type Contest = {
fullPayment: number
judgingPrizePool?: number
jugdingEndDate?: number // Timestamp in seconds.
repo: string
}

export type Scoreboard = {
Expand All @@ -55,6 +56,7 @@ type GetContestsResponseData = {
full_payment: number
judging_ends_at?: number
judging_prize_pool: number | null
template_repo_name: string
}[]

export const contestsQueryKey = "contests"
Expand All @@ -77,6 +79,7 @@ export const useContests = () =>
fullPayment: d.full_payment,
judgingPrizePool: d.judging_prize_pool ?? undefined,
jugdingEndDate: d.judging_ends_at,
repo: d.template_repo_name,
}))
})

Expand All @@ -97,6 +100,7 @@ type GetContestResponseData = {
full_payment: number
judging_prize_pool: number | null
judging_ends_at?: number
template_repo_name: string
}

export const contestQueryKey = (id: number) => ["contest", id]
Expand All @@ -121,6 +125,7 @@ export const useContest = (id: number) =>
fullPayment: response.full_payment,
judgingPrizePool: response.judging_prize_pool ?? undefined,
jugdingEndDate: response.judging_ends_at,
repo: response.template_repo_name,
}
})

Expand Down
9 changes: 9 additions & 0 deletions src/pages/ContestDetails/ContestDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,15 @@ export const ContestDetails = () => {
The judging contest starts as soon as the audit contest ends.
</Text>
)}
{contest.status === "JUDGING" && !contestant?.audit && (
<Button
variant="secondary"
onClick={() => window.open(`https://github.com/${contest.repo}`)}
>
<FaGithub />
&nbsp;Audit repository
</Button>
)}
<Button variant="alternate" onClick={handleJoinJudgingContest}>
Judge Contest
</Button>
Expand Down

0 comments on commit 7944f52

Please sign in to comment.