summaryrefslogtreecommitdiff
path: root/web/src/lib/ui/cards
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2026-11-23 13:43:23 +0100
committerJoel Klinghed <the_jk@spawned.biz>2026-11-23 13:43:23 +0100
commitb3ca050156f10aae285d2f7bfb873d9fa43bf3f4 (patch)
tree02e8ce305f2a7b2038f778c52a6b9fe967d00237 /web/src/lib/ui/cards
parent93970f361b831f17d48ff2a345fc78488ac71fba (diff)
web: fix state_referenced_locally warnings
Read the session's stores through $derived instead of top-level consts, so the session prop is read reactively and the existing store-rune references keep their reactivity; make the card width/height constants derived from the scale prop; seed the transient edit buffers (note/figure note, rename fields) from props once on mount with an explicit svelte-ignore, since the menu is remounted when opened and a later prop change must not clobber an in-progress edit. Also fixes a latent bug in LootEnhancementCounter where the buttons tested !player (the store object, always truthy) instead of !$player, so the enhancement buttons were never disabled for spectators.
Diffstat (limited to 'web/src/lib/ui/cards')
-rw-r--r--web/src/lib/ui/cards/AbilityCardBack.svelte4
-rw-r--r--web/src/lib/ui/cards/LootCard.svelte4
-rw-r--r--web/src/lib/ui/cards/ModifierCard.svelte4
-rw-r--r--web/src/lib/ui/cards/MonsterAbilityCard.svelte4
4 files changed, 8 insertions, 8 deletions
diff --git a/web/src/lib/ui/cards/AbilityCardBack.svelte b/web/src/lib/ui/cards/AbilityCardBack.svelte
index 362ced1..1bd755f 100644
--- a/web/src/lib/ui/cards/AbilityCardBack.svelte
+++ b/web/src/lib/ui/cards/AbilityCardBack.svelte
@@ -15,8 +15,8 @@
scale?: number;
} = $props();
- const width = 142.4 * scale;
- const height = 94.4 * scale;
+ const width = $derived(142.4 * scale);
+ const height = $derived(94.4 * scale);
</script>
<div
diff --git a/web/src/lib/ui/cards/LootCard.svelte b/web/src/lib/ui/cards/LootCard.svelte
index 49ddb2b..3d5dc86 100644
--- a/web/src/lib/ui/cards/LootCard.svelte
+++ b/web/src/lib/ui/cards/LootCard.svelte
@@ -24,8 +24,8 @@
scale?: number;
} = $props();
- const width = 39 * scale;
- const height = 58.6666 * scale;
+ const width = $derived(39 * scale);
+ const height = $derived(58.6666 * scale);
const value = $derived(revealed ? lootValue(card, characterCount) : null);
const special = $derived(
diff --git a/web/src/lib/ui/cards/ModifierCard.svelte b/web/src/lib/ui/cards/ModifierCard.svelte
index e5e7bf7..15519da 100644
--- a/web/src/lib/ui/cards/ModifierCard.svelte
+++ b/web/src/lib/ui/cards/ModifierCard.svelte
@@ -28,8 +28,8 @@
scale?: number;
} = $props();
- const width = 58.6666 * scale;
- const height = 39 * scale;
+ const width = $derived(58.6666 * scale);
+ const height = $derived(39 * scale);
const frontGfx = $derived(gfxUrl(card, name, perks));
const frontExtra = $derived(extraGfxUrl(card, name));
diff --git a/web/src/lib/ui/cards/MonsterAbilityCard.svelte b/web/src/lib/ui/cards/MonsterAbilityCard.svelte
index 5310874..ab9459f 100644
--- a/web/src/lib/ui/cards/MonsterAbilityCard.svelte
+++ b/web/src/lib/ui/cards/MonsterAbilityCard.svelte
@@ -43,8 +43,8 @@
}) as ColumnNode;
});
- const width = 142.4 * scale;
- const height = 94.4 * scale;
+ const width = $derived(142.4 * scale);
+ const height = $derived(94.4 * scale);
const initText = $derived(
card.initiative.toString().length === 1