From 648324c50535935b4848ce164ee9dff18ff9f171 Mon Sep 17 00:00:00 2001 From: Lynn Date: Sat, 8 Jan 2022 00:01:19 +0100 Subject: [PATCH] Set-seed UI --- src/App.css | 8 +++++++- src/App.tsx | 22 ++++++++++++++++++---- src/Game.tsx | 20 ++++++++++++++++---- src/common.json | 2 -- src/util.ts | 4 +++- 5 files changed, 44 insertions(+), 12 deletions(-) diff --git a/src/App.css b/src/App.css index ef91d90..89fe02b 100644 --- a/src/App.css +++ b/src/App.css @@ -163,4 +163,10 @@ a:active { .App-about { margin-top: -1rem; line-height: 1.4; -} \ No newline at end of file +} + +.Game-seed-info { + opacity: 0.5; + margin-top: 1em; + font-variant-numeric: tabular-nums; +} diff --git a/src/App.tsx b/src/App.tsx index 0991b45..75bce03 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,6 @@ import "./App.css"; import common from "./common.json"; -import { dictionarySet, pick } from "./util"; +import { dictionarySet, pick, seed } from "./util"; import Game from "./Game"; import { names } from "./names"; import { useState } from "react"; @@ -18,6 +18,19 @@ function App() { {about ? "Close" : "About"} +
+ + (document.location = seed + ? "/" + : "?seed=" + + new Date().toISOString().replace(/-/g, "").slice(0, 8)) + } + > + {seed ? "Random" : "Today's"} + +
{about && (

@@ -49,8 +62,7 @@ function App() {
R is correct! The third letter is R .
- D occurs elsewhere in the target - word. + D occurs elsewhere in the target word.

Let's move the D in our next guess: @@ -77,7 +89,9 @@ function App() { /> Got it!

- Report issues here, or tweet @chordbug. + Report issues{" "} + here, or + tweet @chordbug.
)}