diff --git a/packages/web/src/App.svelte b/packages/web/src/App.svelte index 696c52d..fbe55b4 100644 --- a/packages/web/src/App.svelte +++ b/packages/web/src/App.svelte @@ -10,6 +10,7 @@ import Card from "./Card.svelte"; import Help from "./Help.svelte"; import type { HelpTab } from "./help-state"; + import { summarizeMissed } from "./catchup"; import Replay from "./Replay.svelte"; import FxGallery from "./FxGallery.svelte"; import TokenGallery from "./TokenGallery.svelte"; @@ -1476,6 +1477,26 @@ return view ? view.treasures.filter((t) => t.owner !== p.id && t.position && t.position.x === p.home.x && t.position.y === p.home.y).length : 0; } + /** What the chronicle shows: everything, the game's own lines, or the talk. */ + let logFilter = $state<"all" | "game" | "talk">("all"); + const isTalk = (text: string) => text.startsWith("\u{1F4AC}") || text.startsWith("\u{1F3B2}"); + function showLine(line: { text: string }): boolean { + return logFilter === "all" ? true : logFilter === "talk" ? isTalk(line.text) : !isTalk(line.text); + } + /** Talk that arrived while the chronicle was covered or filtered away. */ + let seenTalk = $state(0); + $effect(() => { + const count = net.chatCount; + if ((!castPanelOn && logFilter !== "game") || net.lastTalkBy === net.you) seenTalk = count; + }); + const unreadTalk = $derived(Math.max(0, net.chatCount - seenTalk)); + const lastTalk = $derived.by(() => { + for (let i = net.log.length - 1; i >= 0; i--) { + const t = net.log[i]!.text; + if (t.startsWith("\u{1F4AC}")) return t.slice(2).trim(); + } + return null; + }); /** The table is out of reach: play waits, and nothing here can be sent. */ const offline = $derived(!local.active && net.roomId != null && net.status !== "connected"); // Talk that never arrived goes back into the composer, with a word. @@ -2354,7 +2375,7 @@ net.requestShare()} onclose={() => net.closeMoment()} /> {:else if net.catchUp && net.catchUp.length > 0} - net.requestShare(-1) : null} onclose={() => net.closeCatchUp()} /> {:else if local.replaySteps && local.replaySteps.length > 0} @@ -2983,9 +3004,24 @@