From 8960cd0c7ddbe90c4f9bfd62f3ff320149e1b454 Mon Sep 17 00:00:00 2001 From: Dominic Zimmer Date: Fri, 28 Oct 2022 18:00:05 +0200 Subject: [PATCH] Touch frontend --- frontend/src/Client.tsx | 2 +- frontend/src/TVMode.css | 42 +++++++++++++++++++++++++++++++++++++++-- frontend/src/TVMode.tsx | 23 +++++++++++++++------- 3 files changed, 57 insertions(+), 10 deletions(-) diff --git a/frontend/src/Client.tsx b/frontend/src/Client.tsx index f6ef2e0..7ed56d9 100644 --- a/frontend/src/Client.tsx +++ b/frontend/src/Client.tsx @@ -44,7 +44,7 @@ const Client = () => { return (
-
+
State:
{JSON.stringify(state)}
ButtonMap:
{mapToBitvector(buttonMap).map(s => s.toString()).join(" ")}
diff --git a/frontend/src/TVMode.css b/frontend/src/TVMode.css index 02d8785..87ecc56 100644 --- a/frontend/src/TVMode.css +++ b/frontend/src/TVMode.css @@ -1,6 +1,9 @@ +span { + color: white; +} .stream > div { - width: 250px; - height: 50vh; + width: 300px; + height: 1080px; background-color: #00ff00; padding: 5px; display: flex; @@ -11,11 +14,46 @@ flex-direction: row; justify-content: space-between; } + .timer { font-weight: bold; + text-align: right; +} +.subtitle { + font-weight: bold; } +.mode-democracy { + color: #00b7ff; +} +.mode-anarchy { + color: #ff2500; +} +.mode-random { + background: linear-gradient(90deg, rgba(255,0,0,1) 0%, rgba(255,154,0,1) 10%, rgba(208,222,33,1) 20%, rgba(79,220,74,1) 30%, rgba(63,218,216,1) 40%, rgba(47,201,226,1) 50%, rgba(28,127,238,1) 60%, rgba(95,21,242,1) 70%, rgba(186,12,248,1) 80%, rgba(251,7,217,1) 90%, rgba(255,0,0,1) 100%); + color: transparent; + -webkit-background-clip: text; +} .mode { font-weight: bold; text-transform: uppercase; + text-align: center; + font-size: 32pt; +} +.row { + display: flex; + flex-direction: row; + justify-content: space-between; + padding: 0px 10px; +} + +.vote { + font-size: 24pt; + text-transform: uppercase; + display: flex; + justify-content: space-between; + gap: 30px; +} +.voting { + margin: auto; } \ No newline at end of file diff --git a/frontend/src/TVMode.tsx b/frontend/src/TVMode.tsx index af3d6c0..0435f43 100644 --- a/frontend/src/TVMode.tsx +++ b/frontend/src/TVMode.tsx @@ -1,6 +1,7 @@ -import { useEffect, useState } from 'react'; +import { CSSProperties, useEffect, useState } from 'react'; import './TVMode.css'; -import { WGPPState } from './types'; +import './Client.css'; +import { buttonTypeList, WGPPState } from './types'; const TVMode = () => { @@ -36,15 +37,23 @@ const TVMode = () => { }; }, []) + const totalCount = buttonTypeList.reduce((acc, v) => (state?.votes?.[v]??0) + acc, 0); + return
{state === undefined ? Loading... :
-
- Mode: {state.mode} -
- {Math.round(state.timeUntilNextMode ?? 0)}s ⏱️ -
+ {state.mode} +
+ next: {state.nextMode} + {Math.round(state.timeUntilNextMode ?? 0)}s ⏱️ +
+
+ {buttonTypeList.map((b, index) => +
+ {b} {state?.votes?.[b] ? Math.round(state?.votes?.[b] ?? 0 / totalCount / 100) : ""} +
+ )}
Current state: