diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..d3c7a7a
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,14 @@
+#exclude: static/fontawesome|^build
+
+default_stages:
+ - merge-commit
+ - push
+
+repos:
+ - repo: local
+ hooks:
+ - id: lint
+ name: lint
+ entry: task lint:fix --
+ language: system
+ files: ''
diff --git a/Taskfile.yaml b/Taskfile.yaml
index 4bcceb1..8afda30 100644
--- a/Taskfile.yaml
+++ b/Taskfile.yaml
@@ -4,6 +4,8 @@ version: '3'
vars:
GREETING: Hello, World!
+ FILES:
+ sh: git diff-ls --diff-filter=d main | perl -pe's/\n/ /'
tasks:
build: vite build
@@ -13,3 +15,14 @@ tasks:
cmds:
- echo "{{.GREETING}}"
silent: true
+ lint:fix:
+ cmds:
+ - npx prettier --write {{.CLI_ARGS | default .FILES }}
+ # - npx eslint --fix --quiet {{.CLI_ARGS | default .FILES }}
+ integrate:
+ cmds:
+ - git is-clean
+ - task: lint:fix
+ - task: test
+ - git co main
+ - git weld -
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 @@
-
-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 @@