From 709cfd060c4582adb99956231c8266a6b745bd52 Mon Sep 17 00:00:00 2001 From: Coow Date: Mon, 2 Oct 2023 00:17:15 +0200 Subject: [PATCH] Changed Swap Score to Flip Score and made the dashboard nicer --- src/dashboard/Panel.tsx | 99 ++++++++++++++++------------------------ src/dashboard/panel.html | 3 +- src/graphics/Index.tsx | 5 +- 3 files changed, 44 insertions(+), 63 deletions(-) diff --git a/src/dashboard/Panel.tsx b/src/dashboard/Panel.tsx index 4b1e524..a61365d 100644 --- a/src/dashboard/Panel.tsx +++ b/src/dashboard/Panel.tsx @@ -5,22 +5,17 @@ export function Panel() { const [leftScore, set_leftScore] = useReplicant('leftScore', 0); const [rightScore, set_rightScore] = useReplicant('rightScore', 0); + + const [flipScore, set_flipScore] = useReplicant('flipScore', false); + const [showScore, set_showScore] = useReplicant('showScore', false); const [showSpoilerOverlay, set_showSpoilerOverlay] = useReplicant('showSpoilerOverlay', true); const [betweenText, set_betweenText] = useReplicant('betweenText', '') - const handleSubmit = (event) => { - event.preventDefault(); - set_leftScore(event.target.leftScore.value) - set_leftScore(event.target.rightScore.value) - } - - const swapScore = (event: any) => { + const FlipScore = (event: any) => { event.preventDefault(); - console.log("Swapping scores") - let temp = leftScore - set_leftScore(rightScore) - set_rightScore(temp) + console.log("Flipping scores") + set_flipScore(!flipScore) } const resetScore = (event: any) => { @@ -31,73 +26,57 @@ export function Panel() { } return ( - <> +
{ set_betweenText(event.target.value) }} /> -
-
-
- - { - set_leftScore(parseInt(event.target.value, 10)); - }} /> -
-
- - -
- - { - set_rightScore(parseInt(event.target.value, 10)); - }} /> +
+
+ +
+
+ +

{leftScore}

+ +
+ + + +
+ +

{rightScore}

+ +
-
+
- set_showScore(!showScore))}/> + set_showScore(!showScore))} />
-
+
- set_showSpoilerOverlay(!showSpoilerOverlay))}/> + set_showSpoilerOverlay(!showSpoilerOverlay))} />
- +
) } diff --git a/src/dashboard/panel.html b/src/dashboard/panel.html index 1d3f722..7515367 100644 --- a/src/dashboard/panel.html +++ b/src/dashboard/panel.html @@ -3,6 +3,7 @@ +