blob: f59477840e3ddde9dcb15de0f8a5cef5dc6c2754 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
<!--
The main list (the reference `MainList`/`GameList`): one row per entry of
the server's `currentList`. The reference lays wide screens out as two
reorderable columns; the web Phase 3 uses a single centred, scrollable
column (reordering arrives later, if at all).
-->
<script lang="ts">
import type { GameSession } from '$lib/state/session';
import { isCharacter, isMonster, isNoteRow } from '$lib/protocol/types';
import type { MonsterItem } from '$lib/protocol/types';
import type { CampaignData } from '$lib/data/gameData';
import type { FigureRef } from './StatusMenu.svelte';
import CharacterRow from './CharacterRow.svelte';
import MonsterRow from './MonsterRow.svelte';
import NoteRow from './NoteRow.svelte';
let {
session,
onOpenMenu,
campaignData,
onOpenAbility,
onZoomAbility
}: {
session: GameSession;
onOpenMenu: (figure: FigureRef) => void;
campaignData: CampaignData | null;
onOpenAbility: (item: MonsterItem) => void;
onZoomAbility: (item: MonsterItem) => void;
} = $props();
const gameState = session.state;
</script>
<div class="list">
{#if $gameState}
{#each $gameState.currentList as item (item.id)}
{#if isCharacter(item)}
<CharacterRow {session} {item} {onOpenMenu} />
{:else if isMonster(item)}
<MonsterRow
{session}
{item}
{onOpenMenu}
{campaignData}
{onOpenAbility}
{onZoomAbility}
/>
{:else if isNoteRow(item)}
<NoteRow {session} {item} />
{/if}
{/each}
{#if $gameState.currentList.length === 0}
<p style="padding: 40px 12px; text-align: center; opacity: 0.7">
No characters or monsters yet — use the menu to set a scenario
and add characters.
</p>
{/if}
{/if}
</div>
|