The template's hall's word on seats it cannot give back says who the host is and links the keeper
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CCLa2PaEeCj8njQZSWGqHx
This commit is contained in:
1 parent
ae8a0403b1
commit
65fb7c5d46
1 file changed
+13
-7
@@ -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 @@
|
||||
<button type="submit" class="quiet" disabled={claiming || phrase.trim().split(/[\s-]+/).length < 4}>Claim</button>
|
||||
</form>
|
||||
<p class="muted small lost">Lost your games? If this browser forgot them, <button type="button" class="link" disabled={!ready || finding} onclick={findSeats}>find the seats under your name</button>.</p>
|
||||
{#if found}<p class="muted small">{found}</p>{/if}
|
||||
{#if found}
|
||||
<p class="muted small">
|
||||
{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 <a href="mailto:eric@ericwagoner.com?subject={encodeURIComponent(`My seats under ${name.trim()} at ${location.host}`)}">write to the keeper</a>, who can seat you again.
|
||||
{/if}
|
||||
</p>
|
||||
{/if}
|
||||
{#if error}<p class="warning">{error}</p>{/if}
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user