From 6bbba634c83fc4fc9d38224ab133166b555c0081 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Sat, 14 Jan 2023 13:25:46 -0500 Subject: [PATCH 1/2] the apps --- src/lib/components/Battle.svelte | 115 +++++++++++++------ src/lib/components/Campaign.svelte | 116 +++++++++++++++++--- src/lib/components/Campaign/Battle.svelte | 3 +- src/lib/components/Campaigns.svelte | 23 ++-- src/lib/store/api.js | 3 +- src/lib/store/chapters.js | 76 ++++++------- src/lib/store/genNextBattle.js | 38 +++---- src/main.js | 2 +- src/routes/campaign/[campaignId]/+layout.js | 4 +- 9 files changed, 259 insertions(+), 121 deletions(-) diff --git a/src/lib/components/Battle.svelte b/src/lib/components/Battle.svelte index 3eda628..fb7df61 100644 --- a/src/lib/components/Battle.svelte +++ b/src/lib/components/Battle.svelte @@ -1,30 +1,46 @@ -
{$activeCampaign?.name}
-
Chapter {chapter}, battle {chapterBattle} -- {status}
-
- {#if status === 'ongoing'} -
wave
-
{wave === 2 ? 'second' : 'first'}
- {/if} -
city
-
{city}
-
scenario
-
{scenario}
-
character
-
{character}
+
+
+ +
+
Chapter {chapter}, battle {chapterBattle} -- {status}
+
+ {#if status === 'ongoing'} +
wave
+
{wave === 2 ? 'second' : 'first'}
+ {/if} +
city
+
{city}
+
scenario
+
{scenario}
+
character
+
{character}
-
difficulty
-
-
- - event.setBattleDifficulty(params.battleId, value)} - /> -
+
difficulty
+
+
+ + event.setBattleDifficulty(params.battleId, value)} + /> +
- -
-
+ +
-{#if status === 'upcoming'} - -{:else if status === 'ongoing'} - - -{/if} + {#if status === 'upcoming'} + + {:else if status === 'ongoing'} + + + {/if} + + + diff --git a/src/lib/components/Campaign/Battle.svelte b/src/lib/components/Campaign/Battle.svelte index 46794c8..ce6d9e9 100644 --- a/src/lib/components/Campaign/Battle.svelte +++ b/src/lib/components/Campaign/Battle.svelte @@ -1,6 +1,6 @@

- {#if notYet} + {#if id == 'notYet'} ??? {:else} @@ -14,7 +14,6 @@ export let city = ''; export let status = ''; export let id = 0; - export let notYet = false; export let campaignId; export let chapter; export let chapterBattle; diff --git a/src/lib/components/Campaigns.svelte b/src/lib/components/Campaigns.svelte index 9ca81a9..4a08e2f 100644 --- a/src/lib/components/Campaigns.svelte +++ b/src/lib/components/Campaigns.svelte @@ -1,10 +1,14 @@ -

-
-
Campaigns
- -
+
+ +
- {#each $campaigns as campaign (campaign.id)} +
+ {#each $campaigns as campaign (campaign._id)}
south_america
@@ -63,9 +67,9 @@ R.clamp(1 + parseInt(battles?.length / 2), { max: 4 }); const currentCity = ({ battles }) => R.last(battles).city; - async function deleteCampaign({ name, id }) { + async function deleteCampaign({ name, _id }) { if (!window.confirm(`delete campaign ${name}?`)) return; - api.event.deleteCampaign(id); + api.event.deleteCampaign(_id); } const newCampaign = () => { @@ -80,6 +84,9 @@