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);
|
let finding = $state(false);
|
||||||
/** What a search for lost seats turned up, in words. */
|
/** What a search for lost seats turned up: in words, and how many tables the hall cannot give back. */
|
||||||
let found = $state('');
|
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. */
|
/** 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() {
|
async function findSeats() {
|
||||||
finding = true;
|
finding = true;
|
||||||
error = '';
|
error = '';
|
||||||
found = '';
|
found = null;
|
||||||
try {
|
try {
|
||||||
rememberName(name);
|
rememberName(name);
|
||||||
const r = await api.findSeats(name.trim());
|
const r = await api.findSeats(name.trim());
|
||||||
for (const s of r.seated) rememberSeat(s.roomId, { seat: s.seat, token: s.token });
|
for (const s of r.seated) rememberSeat(s.roomId, { seat: s.seat, token: s.token });
|
||||||
if (r.seated.length) seats = allSeats();
|
if (r.seated.length) seats = allSeats();
|
||||||
const back = r.seated.length ? `Seated again at ${r.seated.map((s) => s.roomId).join(', ')}.` : '';
|
const back = r.seated.length ? `Seated again at ${r.seated.map((s) => s.roomId).join(', ')}.` : '';
|
||||||
const n = r.elsewhere;
|
found = { text: back || (r.elsewhere ? '' : 'No table still in play has a seat under that name.'), elsewhere: 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.';
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e instanceof Error ? e.message : 'The search did not go through.';
|
error = e instanceof Error ? e.message : 'The search did not go through.';
|
||||||
} finally {
|
} finally {
|
||||||
@@ -277,7 +275,15 @@
|
|||||||
<button type="submit" class="quiet" disabled={claiming || phrase.trim().split(/[\s-]+/).length < 4}>Claim</button>
|
<button type="submit" class="quiet" disabled={claiming || phrase.trim().split(/[\s-]+/).length < 4}>Claim</button>
|
||||||
</form>
|
</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>
|
<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}
|
{#if error}<p class="warning">{error}</p>{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user