diff options
| -rw-r--r-- | frontend/app/states/play.ts | 9 | ||||
| -rw-r--r-- | frontend/app/states/watch.ts | 9 |
2 files changed, 8 insertions, 10 deletions
diff --git a/frontend/app/states/play.ts b/frontend/app/states/play.ts index 3acefbf..7bf4b4e 100644 --- a/frontend/app/states/play.ts +++ b/frontend/app/states/play.ts @@ -16,15 +16,14 @@ type ExecutionStatus = components["schemas"]["ExecutionStatus"]; type LatestGameState = components["schemas"]["LatestGameState"]; export const gameStateKindAtom = atom<GameStateKind>((get) => { - const startedAt = get(gameStartedAtAtom); - if (!startedAt) { - return "waiting"; - } - const now = get(currentTimestampAtom); if (!now) { return "loading"; } + const startedAt = get(gameStartedAtAtom); + if (!startedAt) { + return "waiting"; + } const durationSeconds = get(durationSecondsAtom); const finishedAt = startedAt + durationSeconds; if (now < startedAt) { diff --git a/frontend/app/states/watch.ts b/frontend/app/states/watch.ts index 463c2cd..14a70b4 100644 --- a/frontend/app/states/watch.ts +++ b/frontend/app/states/watch.ts @@ -16,15 +16,14 @@ type LatestGameState = components["schemas"]["LatestGameState"]; type RankingEntry = components["schemas"]["RankingEntry"]; export const gameStateKindAtom = atom<GameStateKind>((get) => { - const startedAt = get(gameStartedAtAtom); - if (!startedAt) { - return "waiting"; - } - const now = get(currentTimestampAtom); if (!now) { return "loading"; } + const startedAt = get(gameStartedAtAtom); + if (!startedAt) { + return "waiting"; + } const durationSeconds = get(durationSecondsAtom); const finishedAt = startedAt + durationSeconds; if (now < startedAt) { |
