variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
// web/view-story.mjs -- the story: the whole deliverable, read-only.
|
||||
//
|
||||
// Every non-dropped literature turn from turn-0 to the last
|
||||
// recorded, across all sessions in order -- the reading surface the
|
||||
// adjudication review reads ("machinery seams show as prose seams").
|
||||
// OOC, tools, verbs, thinking, rings: all out, by ruling; carried
|
||||
// copies never re-render, each turn appears once from its home
|
||||
// session. Readable by anyone signed in -- spectators read
|
||||
// everything.
|
||||
|
||||
import { $, el } from './dom.mjs';
|
||||
import { api } from './client.mjs';
|
||||
import { state } from './state.mjs';
|
||||
import { banner } from './chrome.mjs';
|
||||
import { navigate, runGone } from './router.mjs';
|
||||
import { renderContent } from './transcript.mjs';
|
||||
|
||||
let storyRun = null;
|
||||
|
||||
export async function enter(id, seq) {
|
||||
storyRun = id;
|
||||
let detail;
|
||||
try {
|
||||
detail = await api(`/runs/${id}`);
|
||||
} catch (e) {
|
||||
if (e.status === 404) return runGone(id, 'the story view');
|
||||
return banner(`could not reach the server: ${e.message}`);
|
||||
}
|
||||
if (seq !== state.seq) return;
|
||||
$('story-title').textContent = `${detail.display} -- the story`;
|
||||
const story = await api(`/runs/${id}/story`).catch(() => null);
|
||||
if (seq !== state.seq) return;
|
||||
if (!story) return banner('the story could not be read');
|
||||
const box = $('story');
|
||||
box.textContent = '';
|
||||
if (!story.sessions.length) {
|
||||
box.appendChild(el('div', 'hint', 'nothing has happened yet -- the story begins at the table'));
|
||||
return;
|
||||
}
|
||||
for (const [si, s] of story.sessions.entries()) {
|
||||
if (si > 0) box.appendChild(el('div', 'session-break'));
|
||||
for (const turn of s.turns) {
|
||||
const d = el('div', `turn ${turn.who}`);
|
||||
d.appendChild(el('div', 'who', turn.who === 'gm' ? 'GM' : 'player'));
|
||||
const body = el('div');
|
||||
d.appendChild(body);
|
||||
renderContent(body, turn.text, { extract: turn.who === 'gm' });
|
||||
box.appendChild(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// wired once at module load: the back button returns to the table
|
||||
$('story-back').addEventListener('click', () => {
|
||||
if (storyRun) navigate(`/runs/${storyRun}`);
|
||||
});
|
||||
Reference in New Issue
Block a user