From 98e213ba4457698bfde0799497ae658867b51d04 Mon Sep 17 00:00:00 2001 From: iilj Date: Wed, 9 Dec 2020 20:00:16 +0900 Subject: [PATCH] Resolve #131, fetch current contests --- src/index.css | 10 ++++++++-- src/utils/TypedCachedApiClient.ts | 6 +++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/index.css b/src/index.css index 6ddcaa8..484cefc 100644 --- a/src/index.css +++ b/src/index.css @@ -51,11 +51,17 @@ h4 { fill: url(#ggold); } -.contest-other-table tr { +.contest-other-table tbody tr { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } -.contest-other-table tr td { +.contest-other-table tbody tr:nth-of-type(odd) { + background-color: rgba(0, 0, 0, 0.025); +} +.contest-other-table tbody tr:hover { + background-color: rgba(0, 0, 0, 0.05); +} +.contest-other-table tbody tr td { flex: auto; word-break: break-word; } diff --git a/src/utils/TypedCachedApiClient.ts b/src/utils/TypedCachedApiClient.ts index 1dc1359..11f6d3a 100644 --- a/src/utils/TypedCachedApiClient.ts +++ b/src/utils/TypedCachedApiClient.ts @@ -27,6 +27,8 @@ export type UserParam = 'id' | 'name' | 'twitter'; const fetchContests = () => fetchJson(`${STATIC_API_BASE_URL}/contest/past`); +const fetchCurrentContests = () => + fetchJson(`${STATIC_API_BASE_URL}/contest/current`); const fetchProblems = () => fetchJson(`${STATIC_API_BASE_URL}/problems`); const fetchLanguages = () => @@ -65,7 +67,9 @@ let CACHED_CONTESTS: Contest[]; export const cachedContestArray = async (): Promise => { if (CACHED_CONTESTS === undefined) { try { - CACHED_CONTESTS = (await fetchContests()).concat(OpenContests); + CACHED_CONTESTS = (await fetchCurrentContests()) + .concat(await fetchContests()) + .concat(OpenContests); } catch (e) { console.log(e); CACHED_CONTESTS = [];