From 0202b7bd59c1722aa4222a2d87f32a4f5ed8ec3a Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Wed, 27 Nov 2024 10:56:11 -0500 Subject: [PATCH] Set up a drive guage for candela drives --- visions/ui/src/App.tsx | 5 ++ visions/ui/src/plugins/Candela/Charsheet.css | 57 ++++++++++++++++++- visions/ui/src/plugins/Candela/Charsheet.tsx | 30 ++++------ .../plugins/Candela/DriveGuage/DriveGuage.css | 44 ++++++++++++++ .../plugins/Candela/DriveGuage/DriveGuage.tsx | 23 ++++++++ visions/ui/src/views/Design/Design.css | 4 ++ visions/ui/src/views/Design/Design.tsx | 19 +++++++ 7 files changed, 162 insertions(+), 20 deletions(-) create mode 100644 visions/ui/src/plugins/Candela/DriveGuage/DriveGuage.css create mode 100644 visions/ui/src/plugins/Candela/DriveGuage/DriveGuage.tsx create mode 100644 visions/ui/src/views/Design/Design.css create mode 100644 visions/ui/src/views/Design/Design.tsx diff --git a/visions/ui/src/App.tsx b/visions/ui/src/App.tsx index c0f28a4..fb49c72 100644 --- a/visions/ui/src/App.tsx +++ b/visions/ui/src/App.tsx @@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'; import './App.css'; import { Client } from './client'; import { createBrowserRouter, RouterProvider } from 'react-router-dom'; +import { DesignPage } from './views/Design/Design'; import { GmView } from './views/GmView/GmView'; import { WebsocketProvider } from './components/WebsocketProvider'; import { PlayerView } from './views/PlayerView/PlayerView'; @@ -32,6 +33,10 @@ const App = ({ client }: AppProps) => { { path: "/candela", element: + }, + { + path: "/design", + element: } ]); return ( diff --git a/visions/ui/src/plugins/Candela/Charsheet.css b/visions/ui/src/plugins/Candela/Charsheet.css index 6c63076..d3d2440 100644 --- a/visions/ui/src/plugins/Candela/Charsheet.css +++ b/visions/ui/src/plugins/Candela/Charsheet.css @@ -36,7 +36,10 @@ border: 2px solid black; } -.action-group > h1 { +.action-group__header { + display: flex; + font-size: xx-large; + justify-content: space-between; margin: 4px; margin-left: -4px; padding-left: 4px; @@ -53,3 +56,55 @@ padding: 0px; padding-left: 16px; } + +.action-group__guage-column { + width: 10px; + height: 100%; + margin: 2px; +} + +.action-group__guage-top { + position: relative; + background-color: white; + margin-bottom: 2px; +} + +.action-group__guage-top:before { + content: " "; + position: absolute; + z-index: -1; + top: 2px; + right: 2px; + bottom: 2px; + left: 2px; + border: 1px solid black; +} + +.action-group__guage-top_filled { + background-color: black; + margin-bottom: 2px; +} + +.action-group__guage-bottom { + background-color: white; + height: 8px; +} + +.action-group__guage-bottom_filled { + background-color: black; + height: 8px; +} + +.action-group__guage-bottom:before { + content: " "; + position: absolute; + z-index: -1; + top: 1px; + left: 1px; + right: 1px; + bottom: 1px; +} + +.action-group__guage { + display: flex; +} diff --git a/visions/ui/src/plugins/Candela/Charsheet.tsx b/visions/ui/src/plugins/Candela/Charsheet.tsx index 09cf46e..3d679cb 100644 --- a/visions/ui/src/plugins/Candela/Charsheet.tsx +++ b/visions/ui/src/plugins/Candela/Charsheet.tsx @@ -1,5 +1,10 @@ import React from 'react'; import './Charsheet.css'; +import { DriveGuage } from './DriveGuage/DriveGuage'; + +function assertNever(value: never) { + throw new Error("Unexpected value: " + value); +} export type Guage = { current: number, @@ -65,26 +70,13 @@ interface CharsheetProps { sheet: Charsheet, } -interface GuageProps { - current: number, - max: number, -} - -const GuageElement = ({ current, max }: GuageProps) => { - -} - -function assertNever(value: never) { - throw new Error("Unexpected value: " + value); -} - interface ActionElementProps { name: string, gilded: boolean, value: number, } -const ActionElement = ({name, gilded, value}: ActionElementProps) => { +const ActionElement = ({ name, gilded, value }: ActionElementProps) => { let dots = []; for (let i = 0; i < value; i++) { dots.push("\u25ef"); @@ -100,27 +92,27 @@ interface ActionGroupElementProps { group: Nerve | Cunning | Intuition; } -const ActionGroupElement = ({group}: ActionGroupElementProps) => { +const ActionGroupElement = ({ group }: ActionGroupElementProps) => { var title; var elements = []; switch (group.type_) { case "nerve": { - title =
Nerve
+ title =
Nerve
elements.push(); elements.push(); elements.push(); break } case "cunning": { - title =
Cunning
+ title =
Cunning
elements.push(); elements.push(); elements.push(); break } case "intuition": { - title =
Intuition
+ title =
Intuition
elements.push(); elements.push(); elements.push(); @@ -132,7 +124,7 @@ const ActionGroupElement = ({group}: ActionGroupElementProps) => { } return (
-

{title}

+ {title} {elements}
) } diff --git a/visions/ui/src/plugins/Candela/DriveGuage/DriveGuage.css b/visions/ui/src/plugins/Candela/DriveGuage/DriveGuage.css new file mode 100644 index 0000000..74cbac1 --- /dev/null +++ b/visions/ui/src/plugins/Candela/DriveGuage/DriveGuage.css @@ -0,0 +1,44 @@ +.drive-guages_on-light { + background-color: white; +} + +.drive-guage { + display: flex; +} + +.drive-guage__element { + border: 1px solid black; + margin: 1px; + background-color: white; +} + +.drive-guage__spacer { + margin: 1px; +} + +.drive-guage__top { + margin: 1px; + width: 8px; + border: 1px solid black; + background-color: white; +} + +.drive-guage__top_filled { + background-color: black; +} + +.drive-guage__bottom { + margin: 1px; + border: 1px solid black; + width: 8px; + height: 8px; + background-color: white; +} + +.drive-guage__bottom_filled { + background-color: black; +} + +.drive-guages_on-dark { + background-color: black; +} diff --git a/visions/ui/src/plugins/Candela/DriveGuage/DriveGuage.tsx b/visions/ui/src/plugins/Candela/DriveGuage/DriveGuage.tsx new file mode 100644 index 0000000..c159144 --- /dev/null +++ b/visions/ui/src/plugins/Candela/DriveGuage/DriveGuage.tsx @@ -0,0 +1,23 @@ +import React from 'react'; +import './DriveGuage.css'; + +interface Guage { + current: number; + max: number; +} + +export const DriveGuage = ({ current, max }: Guage) => { + let components = []; + for (let i = 0; i < 9; i++) { + components.push(
+ {i < current ?
 
: +
 
} + {i < max ?
 
: +
 
} +
) + } + components.splice(3, 1,
 
); + return (
+ {components} +
) +} diff --git a/visions/ui/src/views/Design/Design.css b/visions/ui/src/views/Design/Design.css new file mode 100644 index 0000000..96ef6a1 --- /dev/null +++ b/visions/ui/src/views/Design/Design.css @@ -0,0 +1,4 @@ +.section { + border: 2px solid black; + border-radius: 4px; +} diff --git a/visions/ui/src/views/Design/Design.tsx b/visions/ui/src/views/Design/Design.tsx new file mode 100644 index 0000000..45b248e --- /dev/null +++ b/visions/ui/src/views/Design/Design.tsx @@ -0,0 +1,19 @@ +import React from 'react'; +import { DriveGuage } from '../../plugins/Candela/DriveGuage/DriveGuage'; + +const DriveGuages = () => { + return (
+
+ +
+
+ +
+
); +} + +export const DesignPage = () => { + return (
+ +
); +}