From 16d3cd154516379b70d8174c99af986fdeaf9618 Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Sun, 14 Apr 2024 14:55:01 +0200 Subject: [PATCH] store theme, improved random theme --- tank-frontend/src/App.tsx | 5 +- tank-frontend/src/ClientScreen.tsx | 15 +++-- tank-frontend/src/Scoreboard.tsx | 6 +- tank-frontend/src/index.tsx | 4 -- tank-frontend/src/theme.ts | 98 ++++++++++++++++++++---------- 5 files changed, 81 insertions(+), 47 deletions(-) diff --git a/tank-frontend/src/App.tsx b/tank-frontend/src/App.tsx index 1759ffd..eb0fbf7 100644 --- a/tank-frontend/src/App.tsx +++ b/tank-frontend/src/App.tsx @@ -10,6 +10,7 @@ import Row from "./components/Row.tsx"; import Scoreboard from "./Scoreboard.tsx"; import Button from "./components/Button.tsx"; import './App.css'; +import {getRandomTheme, useStoredTheme} from "./theme.ts"; const getNewNameId = () => ({ id: crypto.randomUUID(), @@ -17,6 +18,7 @@ const getNewNameId = () => ({ }); export default function App() { + const [theme, setTheme] = useStoredTheme(); const [nameId, setNameId] = useStoredObjectState('access', getNewNameId); const [isLoggedIn, setLoggedIn] = useState(false); @@ -32,13 +34,14 @@ export default function App() { return

CCCB-Tanks!

+