diff --git a/visions/server/Taskfile.yml b/visions/server/Taskfile.yml new file mode 100644 index 0000000..58152e8 --- /dev/null +++ b/visions/server/Taskfile.yml @@ -0,0 +1,14 @@ +version: '3' + +tasks: + build: + cmds: + - cargo build + + test: + cmds: + - cargo watch -x test + + server: + cmds: + - cargo watch -x run diff --git a/visions/ui/Taskfile.yml b/visions/ui/Taskfile.yml new file mode 100644 index 0000000..823ef51 --- /dev/null +++ b/visions/ui/Taskfile.yml @@ -0,0 +1,7 @@ +version: '3' + +tasks: + dev: + cmds: + - npm run start + diff --git a/visions/ui/src/plugins/Candela/Charsheet.css b/visions/ui/src/plugins/Candela/Charsheet.css index c940466..6c63076 100644 --- a/visions/ui/src/plugins/Candela/Charsheet.css +++ b/visions/ui/src/plugins/Candela/Charsheet.css @@ -16,4 +16,40 @@ width: 33%; } +.action-group { + position: relative; + border: 2px solid black; + border-radius: 4px; + padding-left: 8px; + padding-bottom: 8px; +} + +.action-group:before { + content: " "; + position: absolute; + z-index: -1; + top: 2px; + left: 2px; + right: 2px; + bottom: 2px; + border: 2px solid black; +} + +.action-group > h1 { + margin: 4px; + margin-left: -4px; + padding-left: 4px; + background-color: black; + color: white; +} + +.action-group__action { + margin: 2px; +} + +.action-group__dots { + margin: 0px; + padding: 0px; + padding-left: 16px; +} diff --git a/visions/ui/src/plugins/Candela/Charsheet.tsx b/visions/ui/src/plugins/Candela/Charsheet.tsx index 44729e6..09cf46e 100644 --- a/visions/ui/src/plugins/Candela/Charsheet.tsx +++ b/visions/ui/src/plugins/Candela/Charsheet.tsx @@ -7,7 +7,7 @@ export type Guage = { } export type Action = { - guilded: boolean, + gilded: boolean, score: number, } @@ -20,6 +20,7 @@ export type ActionGroup = { } type Nerve = { + type_: "nerve", drives: Guage, resistances: Guage, move: Action, @@ -28,6 +29,7 @@ type Nerve = { } type Cunning = { + type_: "cunning", drives: Guage, resistances: Guage, sway: Action, @@ -36,6 +38,7 @@ type Cunning = { } type Intuition = { + type_: "intuition", drives: Guage, resistances: Guage, survey: Action, @@ -62,11 +65,6 @@ interface CharsheetProps { sheet: Charsheet, } -interface ActionDriveProps { - groupName: string, - group: Nerve | Cunning | Intuition, -} - interface GuageProps { current: number, max: number, @@ -76,15 +74,67 @@ const GuageElement = ({ current, max }: GuageProps) => { } -const ActionDriveElement = ({ groupName, group }: ActionDriveProps) => { +function assertNever(value: never) { + throw new Error("Unexpected value: " + value); +} - if ("move" in group) { - return
-- Nerve --
; - } else if ("sway" in group) { - return
-- Cunning --
; - } else { - return
-- Intuition --
; +interface ActionElementProps { + name: string, + gilded: boolean, + value: number, +} + +const ActionElement = ({name, gilded, value}: ActionElementProps) => { + let dots = []; + for (let i = 0; i < value; i++) { + dots.push("\u25ef"); } + let diamond = gilded ? "\u25c6" : "\u25c7"; + return (
+

{diamond} {name}

+
{dots}
+
); +} + +interface ActionGroupElementProps { + group: Nerve | Cunning | Intuition; +} + +const ActionGroupElement = ({group}: ActionGroupElementProps) => { + var title; + var elements = []; + + switch (group.type_) { + case "nerve": { + title =
Nerve
+ elements.push(); + elements.push(); + elements.push(); + break + } + case "cunning": { + title =
Cunning
+ elements.push(); + elements.push(); + elements.push(); + break + } + case "intuition": { + title =
Intuition
+ elements.push(); + elements.push(); + elements.push(); + break + } + default: { + assertNever(group); + } + } + + return (
+

{title}

+ {elements} +
) } const CharsheetElement_ = ({ sheet }: CharsheetProps) => { @@ -104,9 +154,9 @@ const CharsheetElement_ = ({ sheet }: CharsheetProps) => {
- - - + + +
Role and Specialty
Marks, Scars, Relationships
@@ -125,26 +175,29 @@ export const CharsheetElement = () => { question: 'What were the contents of that book?', role: 'Slink', nerve: { + type_: "nerve", drives: { current: 2, max: 2 }, resistances: { current: 0, max: 3 }, - move: { guilded: false, score: 0 }, - strike: { guilded: false, score: 0 }, - control: { guilded: true, score: 0 }, - }, + move: { gilded: false, score: 2 }, + strike: { gilded: false, score: 1 }, + control: { gilded: true, score: 0 }, + } as Nerve, cunning: { + type_: "cunning", drives: { current: 1, max: 1 }, resistances: { current: 0, max: 3 }, - sway: { guilded: false, score: 0 }, - read: { guilded: false, score: 0 }, - hide: { guilded: false, score: 0 }, - }, + sway: { gilded: false, score: 0 }, + read: { gilded: false, score: 0 }, + hide: { gilded: false, score: 0 }, + } as Cunning, intuition: { + type_: "intuition", drives: { current: 0, max: 0 }, resistances: { current: 0, max: 3 }, - survey: { guilded: false, score: 0 }, - focus: { guilded: false, score: 0 }, - sense: { guilded: false, score: 0 }, - } + survey: { gilded: false, score: 0 }, + focus: { gilded: false, score: 0 }, + sense: { gilded: false, score: 0 }, + } as Intuition }; return