Skip to content

Commit 3a16eb0

Browse files
authored
Merge pull request #132 from iilj/feature/#131_contest_current
Resolve #131, fetch current contests
2 parents 083434d + 98e213b commit 3a16eb0

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/index.css

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,17 @@ h4 {
5151
fill: url(#ggold);
5252
}
5353

54-
.contest-other-table tr {
54+
.contest-other-table tbody tr {
5555
display: grid;
5656
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
5757
}
58-
.contest-other-table tr td {
58+
.contest-other-table tbody tr:nth-of-type(odd) {
59+
background-color: rgba(0, 0, 0, 0.025);
60+
}
61+
.contest-other-table tbody tr:hover {
62+
background-color: rgba(0, 0, 0, 0.05);
63+
}
64+
.contest-other-table tbody tr td {
5965
flex: auto;
6066
word-break: break-word;
6167
}

src/utils/TypedCachedApiClient.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export type UserParam = 'id' | 'name' | 'twitter';
2727

2828
const fetchContests = () =>
2929
fetchJson<Contest[]>(`${STATIC_API_BASE_URL}/contest/past`);
30+
const fetchCurrentContests = () =>
31+
fetchJson<Contest[]>(`${STATIC_API_BASE_URL}/contest/current`);
3032
const fetchProblems = () =>
3133
fetchJson<Problem[]>(`${STATIC_API_BASE_URL}/problems`);
3234
const fetchLanguages = () =>
@@ -65,7 +67,9 @@ let CACHED_CONTESTS: Contest[];
6567
export const cachedContestArray = async (): Promise<Contest[]> => {
6668
if (CACHED_CONTESTS === undefined) {
6769
try {
68-
CACHED_CONTESTS = (await fetchContests()).concat(OpenContests);
70+
CACHED_CONTESTS = (await fetchCurrentContests())
71+
.concat(await fetchContests())
72+
.concat(OpenContests);
6973
} catch (e) {
7074
console.log(e);
7175
CACHED_CONTESTS = [];

0 commit comments

Comments
 (0)