summaryrefslogtreecommitdiff
path: root/web/src/lib/ui/menus/AddNoteRowMenu.svelte
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2026-11-17 23:12:38 +0100
committerJoel Klinghed <the_jk@spawned.biz>2026-11-17 23:12:38 +0100
commitd64cf3514e5ff1ddb1c7f3ddac9a769db3e7dde0 (patch)
tree781ec9f63220f3c15b309658e9b32ad7d9c70b3a /web/src/lib/ui/menus/AddNoteRowMenu.svelte
parent94e2850fb73005f3fb30af8489905e5cdfb6fac5 (diff)
Phase 5: campaign meta, notes, special rules (M5)
Web: - Note rows: create/edit menu (text, 12-swatch palette, player/monster link with per-standee selection, delete) with the reference's create-vs-edit commit semantics; row rendering with target-derived gradient colour, link indent + connector, standee N:/All: prefixes, tap-to-edit; whole-list drag-to-reorder (reorderList); quick per-figure note (setFigureNote) from the status menu - Special monsters: Ice Wraith "Switch Form" (deck == "Ice Wraith" gate), summon mark toggle (round-green/summon standee artwork, standee-nr badges, per-owner grayscale), character summon boxes + AddSummonMenu (class summons gated by level and standee cap, item summons from summons.json) - Ally deck show/hide in the main menu (shouldShowAlliesDeck gate); settings "clear unlocked" + Special Unlocks menu - AddSectionMenu parity: search filter, findNrFromScenarioName numeric ordering, added sections greyed + no-op, #Random Dungeon label - gameData.ts: SummonModel, ClassData.summons, summons() fetch Server: - unlock_special_command_test (last command without a test; ally-deck hide and remove-sanctuary were already covered) PLAN.md: Phase 5 boxes checked, M5 progress-log entry
Diffstat (limited to 'web/src/lib/ui/menus/AddNoteRowMenu.svelte')
-rw-r--r--web/src/lib/ui/menus/AddNoteRowMenu.svelte113
1 files changed, 0 insertions, 113 deletions
diff --git a/web/src/lib/ui/menus/AddNoteRowMenu.svelte b/web/src/lib/ui/menus/AddNoteRowMenu.svelte
deleted file mode 100644
index 5bb14a0..0000000
--- a/web/src/lib/ui/menus/AddNoteRowMenu.svelte
+++ /dev/null
@@ -1,113 +0,0 @@
-<!--
- Add Note Row (the reference `NoteRowAddMenu`, Phase 3 form): a colour
- picker, free text, and an optional link to a figure. Sending
- `addNoteRow` appends the row (beneath its linked figure, if any).
--->
-<script lang="ts">
- import type { GameSession } from '$lib/state/session';
- import { isCharacter, isMonster } from '$lib/protocol/types';
- import { t } from '$lib/i18n';
- import Menu from '../Menu.svelte';
-
- let {
- session,
- open = $bindable(true)
- }: {
- session: GameSession;
- open?: boolean;
- } = $props();
-
- const gameState = session.state;
- const player = session.player;
-
- const COLORS = [
- 0xffb58900,
- 0xff1565c0,
- 0xff2e7d32,
- 0xffc2185b,
- 0xffffb300,
- 0xff5e35b1
- ];
-
- let color = $state(COLORS[0]);
- let text = $state('');
- let linkedId = $state('');
-
- $effect(() => {
- if (!open) return;
- color = COLORS[0];
- text = '';
- linkedId = '';
- });
-
- const figures = $derived.by(() =>
- ($gameState?.currentList ?? [])
- .filter((i) => isCharacter(i) || isMonster(i))
- .map((i) => ({
- id: i.id,
- name: isCharacter(i) ? i.characterState.display : i.id
- }))
- );
-
- function colorCss(c: number): string {
- return `#${c.toString(16).padStart(8, '0').slice(2)}`;
- }
-
- function add() {
- if (!$player) return;
- const id =
- typeof crypto !== 'undefined' && 'randomUUID' in crypto
- ? crypto.randomUUID()
- : `note-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
- session.command('addNoteRow', {
- noteRow: {
- id,
- text: text.trim(),
- color,
- linkedId,
- standeeNr: 0
- }
- });
- open = false;
- }
-</script>
-
-<Menu open={open} title={t('menuAddNoteRow')}>
- <div style="display: flex; gap: 6px; padding: 8px 4px">
- {#each COLORS as c (c)}
- <button
- aria-label="note colour"
- style="width: 32px; height: 32px; border-radius: 6px; background: {colorCss(c)}; outline: {c === color ? '3px solid #fff' : 'none'}"
- onclick={() => (color = c)}
- ></button>
- {/each}
- </div>
-
- <input class="search" placeholder={t('noteRowHint')} bind:value={text} />
-
- <div class="statrow" style="align-items: center">
- <span class="statrow__label" style="font-size: 13px">{t('noteRowWholeGroup')}</span>
- <select
- class="search"
- style="margin: 0; width: auto"
- value={linkedId}
- onchange={(e) => (linkedId = e.currentTarget.value)}
- >
- <option value="">{t('noteRowAll')}</option>
- {#each figures as f (f.id)}
- <option value={f.id}>{f.name}</option>
- {/each}
- </select>
- </div>
-
- <div style="display: flex; justify-content: flex-end; padding: 8px 4px">
- <button
- class="stepbtn"
- style="border-radius: 6px"
- disabled={!$player || text.trim() === ''}
- onclick={add}
- >
- {t('noteRowAddFromMenu')}
- </button>
- </div>
-</Menu>