From e96a022c8f52e9f8cbe95d76a03250e62ae1c9c7 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Thu, 12 Jan 2023 18:02:29 -0500 Subject: [PATCH] genNextBattle --- package.json | 3 +- src/lib/components/Campaigns.svelte | 13 +++++- src/lib/store/api.js | 29 ++++++++------ src/lib/store/chapters.js | 40 +++++++++++++++++++ src/lib/store/genNextBattle.js | 28 +++++++++++++ src/lib/store/genNextBattle.test.js | 9 +++++ src/routes/+layout.js | 1 + src/routes/campaign/[campaignId]/+page.svelte | 11 +++-- 8 files changed, 115 insertions(+), 19 deletions(-) create mode 100644 src/lib/store/chapters.js create mode 100644 src/lib/store/genNextBattle.js create mode 100644 src/lib/store/genNextBattle.test.js create mode 100644 src/routes/+layout.js diff --git a/package.json b/package.json index 28093f7..79f1af8 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "beercss": "^3.0.4", "dexie": "^3.2.2", "fake-indexeddb": "^4.0.1", - "material-dynamic-colors": "^0.1.5" + "material-dynamic-colors": "^0.1.5", + "remeda": "^1.3.0" } } diff --git a/src/lib/components/Campaigns.svelte b/src/lib/components/Campaigns.svelte index 83550de..cc0565c 100644 --- a/src/lib/components/Campaigns.svelte +++ b/src/lib/components/Campaigns.svelte @@ -13,7 +13,13 @@ {campaign.name} -

chapter 2, second battle.

+

+ {#if campaign.battles} + chapter {currentChapter(campaign)}, battle of {currentCity( + campaign, + )}. + {/if} +