diff --git a/template/src/lib/components/Hall.svelte b/template/src/lib/components/Hall.svelte index 98d1a89..0f59752 100644 --- a/template/src/lib/components/Hall.svelte +++ b/template/src/lib/components/Hall.svelte @@ -121,22 +121,20 @@ } let finding = $state(false); - /** What a search for lost seats turned up, in words. */ - let found = $state(''); + /** What a search for lost seats turned up: in words, and how many tables the hall cannot give back. */ + let found = $state<{ text: string; elsewhere: number } | null>(null); /** Seats under this name at tables still in play: those last used from here are taken back; the rest are named, to ask the host. */ async function findSeats() { finding = true; error = ''; - found = ''; + found = null; try { rememberName(name); const r = await api.findSeats(name.trim()); for (const s of r.seated) rememberSeat(s.roomId, { seat: s.seat, token: s.token }); if (r.seated.length) seats = allSeats(); const back = r.seated.length ? `Seated again at ${r.seated.map((s) => s.roomId).join(', ')}.` : ''; - const n = r.elsewhere; - const ask = n ? ` ${n === 1 ? 'One more table' : `${n} more tables`} in play ${n === 1 ? 'has' : 'have'} a seat under your name, last used from another address, or given to a bot by the host: ask the host there for a transfer phrase, or write to the keeper.` : ''; - found = back + ask || 'No table still in play has a seat under that name.'; + found = { text: back || (r.elsewhere ? '' : 'No table still in play has a seat under that name.'), elsewhere: r.elsewhere }; } catch (e) { error = e instanceof Error ? e.message : 'The search did not go through.'; } finally { @@ -277,7 +275,15 @@

Lost your games? If this browser forgot them, .

- {#if found}

{found}

{/if} + {#if found} +

+ {found.text} + {#if found.elsewhere} + {found.elsewhere === 1 ? 'One more table' : `${found.elsewhere} more tables`} in play {found.elsewhere === 1 ? 'has' : 'have'} a seat under your name, last used from another address, or given to a bot by the host. + The host is whoever opened the table: ask them for a transfer phrase, or write to the keeper, who can seat you again. + {/if} +

+ {/if} {#if error}

{error}

{/if}