From 42b81e2128fef184cb030ab69735102c72d3d511 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Tue, 21 Mar 2023 14:29:44 -0400 Subject: [PATCH 1/6] Identification --- src/lib/components/GlobalStyle.svelte | 11 ++++ .../ShipEdit/Identification.story.svelte | 17 ++++++ .../components/ShipEdit/Identification.svelte | 54 +++++++++++++++++++ .../Identification.stories.svelte.todo | 22 -------- .../{ => Identification}/ShipCost.svelte | 8 +-- .../ShipEdit/Identification/index.svelte | 40 -------------- 6 files changed, 86 insertions(+), 66 deletions(-) create mode 100644 src/lib/components/ShipEdit/Identification.story.svelte create mode 100644 src/lib/components/ShipEdit/Identification.svelte delete mode 100644 src/lib/components/ShipEdit/Identification/Identification.stories.svelte.todo rename src/lib/components/ShipEdit/{ => Identification}/ShipCost.svelte (89%) delete mode 100644 src/lib/components/ShipEdit/Identification/index.svelte diff --git a/src/lib/components/GlobalStyle.svelte b/src/lib/components/GlobalStyle.svelte index 4959dac..58095da 100644 --- a/src/lib/components/GlobalStyle.svelte +++ b/src/lib/components/GlobalStyle.svelte @@ -115,4 +115,15 @@ select:focus { border: 1px solid var(--indigo-dye); } + + input:not([type="checkbox"]) { + border: 0px; + border-bottom: 1px solid var(--indigo-dye); + border-radius: 0px; + height: calc( + 1rem * var(--line-height) + var(--form-element-spacing-vertical) * 1 + ); + padding: 0 0.5rem; + text-align: center; + } diff --git a/src/lib/components/ShipEdit/Identification.story.svelte b/src/lib/components/ShipEdit/Identification.story.svelte new file mode 100644 index 0000000..d0bbadc --- /dev/null +++ b/src/lib/components/ShipEdit/Identification.story.svelte @@ -0,0 +1,17 @@ + + + + + diff --git a/src/lib/components/ShipEdit/Identification.svelte b/src/lib/components/ShipEdit/Identification.svelte new file mode 100644 index 0000000..9ed04ef --- /dev/null +++ b/src/lib/components/ShipEdit/Identification.svelte @@ -0,0 +1,54 @@ +
+
+ + + + +
+ +
+ + + + diff --git a/src/lib/components/ShipEdit/Identification/Identification.stories.svelte.todo b/src/lib/components/ShipEdit/Identification/Identification.stories.svelte.todo deleted file mode 100644 index a3d01ab..0000000 --- a/src/lib/components/ShipEdit/Identification/Identification.stories.svelte.todo +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/src/lib/components/ShipEdit/ShipCost.svelte b/src/lib/components/ShipEdit/Identification/ShipCost.svelte similarity index 89% rename from src/lib/components/ShipEdit/ShipCost.svelte rename to src/lib/components/ShipEdit/Identification/ShipCost.svelte index c06dcd1..0fd0a15 100644 --- a/src/lib/components/ShipEdit/ShipCost.svelte +++ b/src/lib/components/ShipEdit/Identification/ShipCost.svelte @@ -22,18 +22,18 @@ - - From cdb7e8ee35c107d5d7dd1548b612836c59538803 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Tue, 21 Mar 2023 15:42:45 -0400 Subject: [PATCH 2/6] enter the new updux --- src/lib/components/ShipEdit.story.svelte | 18 ++++++++++++ src/lib/components/ShipEdit.svelte | 19 ++++++++++++ .../components/ShipEdit/Identification.svelte | 3 +- .../ShipEdit/Identification/ShipCost.svelte | 4 ++- src/lib/store/api.ts | 9 ++++++ src/lib/store/{ship.js => ship.js.old} | 0 src/lib/store/ship.ts | 11 +++++++ src/lib/store/ship/identification.ts | 29 +++++++++++++++++++ 8 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 src/lib/components/ShipEdit.story.svelte create mode 100644 src/lib/components/ShipEdit.svelte create mode 100644 src/lib/store/api.ts rename src/lib/store/{ship.js => ship.js.old} (100%) create mode 100644 src/lib/store/ship.ts create mode 100644 src/lib/store/ship/identification.ts diff --git a/src/lib/components/ShipEdit.story.svelte b/src/lib/components/ShipEdit.story.svelte new file mode 100644 index 0000000..2e8c452 --- /dev/null +++ b/src/lib/components/ShipEdit.story.svelte @@ -0,0 +1,18 @@ + + + + + diff --git a/src/lib/components/ShipEdit.svelte b/src/lib/components/ShipEdit.svelte new file mode 100644 index 0000000..4aded09 --- /dev/null +++ b/src/lib/components/ShipEdit.svelte @@ -0,0 +1,19 @@ +
+ +
+ + + + diff --git a/src/lib/components/ShipEdit/Identification.svelte b/src/lib/components/ShipEdit/Identification.svelte index 9ed04ef..e15da04 100644 --- a/src/lib/components/ShipEdit/Identification.svelte +++ b/src/lib/components/ShipEdit/Identification.svelte @@ -33,8 +33,7 @@ $: if (shipTypes.length > 0 && !shipTypes.includes(shipType)) shipType = shipTypes[0]; - $: api?.dispatch?.setShipType?.(shipType); - $: api?.dispatch?.setShipClass?.(shipClass); + $: api?.dispatch?.updateIdentification?.({ shipType, shipClass }); diff --git a/src/lib/components/ShipEdit.story.svelte b/src/lib/components/ShipEdit.story.svelte index 2e8c452..71f3cc3 100644 --- a/src/lib/components/ShipEdit.story.svelte +++ b/src/lib/components/ShipEdit.story.svelte @@ -14,5 +14,8 @@ let ship = api.getState(); - api.subscribe(() => (ship = api.getState())); + api.subscribe(() => { + console.log("update!"); + ship = api.getState(); + }); diff --git a/src/lib/components/ShipEdit/Carrier/Squadron.svelte b/src/lib/components/ShipEdit/Carrier/Squadron.svelte index eae0a30..9db78ea 100644 --- a/src/lib/components/ShipEdit/Carrier/Squadron.svelte +++ b/src/lib/components/ShipEdit/Carrier/Squadron.svelte @@ -1,5 +1,4 @@ - diff --git a/src/lib/components/ShipEdit/Propulsion/Engine.story.svelte b/src/lib/components/ShipEdit/Propulsion/Engine.story.svelte index 65b3f32..95954c2 100644 --- a/src/lib/components/ShipEdit/Propulsion/Engine.story.svelte +++ b/src/lib/components/ShipEdit/Propulsion/Engine.story.svelte @@ -13,5 +13,4 @@ }; import Engine from "./Engine.svelte"; - import "$lib/components/GlobalStyle.svelte"; diff --git a/src/lib/components/ShipEdit/Propulsion/Engine.svelte b/src/lib/components/ShipEdit/Propulsion/Engine.svelte index 4bfb402..2925a6f 100644 --- a/src/lib/components/ShipEdit/Propulsion/Engine.svelte +++ b/src/lib/components/ShipEdit/Propulsion/Engine.svelte @@ -25,7 +25,8 @@ export let rating = 0; export let api = getContext("api"); - $: api?.dispatch?.setEngine?.({ rating, advanced }); + console.log(api?.dispatch?.setDrive); + $: api?.dispatch?.setDrive?.({ rating, advanced });