Show player turns in admin reading view
Build and publish frontend / publish (push) Successful in 57s

This commit is contained in:
Ein Anderssono
2026-10-24 03:16:38 +02:00
parent d6469b6a3a
commit 50ec861bba
2 changed files with 19 additions and 5 deletions
+16 -4
View File
@@ -31,8 +31,10 @@
#admin-content article > .admin-story-reply { display: none; }
#admin-content .admin-simple-conversation > h2,
#admin-content .admin-simple-conversation > p:not(.admin-story-empty),
#admin-content .admin-simple-conversation article > :not(.admin-story-reply) { display: none; }
#admin-content .admin-simple-conversation article > :not(.admin-story-player):not(.admin-story-reply) { display: none; }
#admin-content .admin-simple-conversation article > .admin-story-player,
#admin-content .admin-simple-conversation article > .admin-story-reply { display: block; margin-block: .85rem; white-space: pre-wrap; }
#admin-content .admin-simple-conversation article > .admin-story-player { font-weight: 650; }
#admin-content pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 32rem; overflow: auto; }
#admin-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-block: 1rem; }
#player-search { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem; }
@@ -717,7 +719,11 @@
let showedPlayerInput = false;
for (const event of group.events) {
const payload = event.payload || {};
if (payload.player_message) { adminElement('p', `Spelaren: ${payload.player_message}`, card); showedPlayerInput = true; }
if (payload.player_message) {
const playerLine = adminElement('p', `Spelaren: ${payload.player_message}`, card);
playerLine.className = 'admin-story-player';
showedPlayerInput = true;
}
const reply = payload.reply || payload.npc_reply;
if (reply) {
const story = adminElement('p', `Berättelsen: ${reply}`, card);
@@ -738,9 +744,15 @@
}
if (!showedPlayerInput) {
const failedTurnInput = [...group.interactions].reverse().map(latestPlayerText).find(Boolean);
if (failedTurnInput) adminElement('p', `Spelaren: ${failedTurnInput}`, card);
if (failedTurnInput) {
const playerLine = adminElement('p', `Spelaren: ${failedTurnInput}`, card);
playerLine.className = 'admin-story-player';
}
}
for (const message of group.messages) {
const playerLine = adminElement('p', `Spelare: ${message.message}`, card);
playerLine.className = 'admin-story-player';
}
for (const message of group.messages) adminElement('p', `Spelarmeddelande: ${message.message}`, card);
for (const interaction of group.interactions) {
if (!interaction.response) continue;
const button = adminElement('button', `AI-svar · ${interaction.prompt_id} · ${interaction.outcome}: ${interaction.response}`, card);
+3 -1
View File
@@ -37,6 +37,8 @@ test('admin can switch to a storyteller-only reading view and return to diagnost
assert.match(page, /Lättläst konversation/);
assert.match(page, /Visa felsökningsspår/);
assert.match(page, /root\.classList\.toggle\('admin-simple-conversation', adminSimpleConversation\)/);
assert.match(page, /playerLine\.className = 'admin-story-player'/);
assert.match(page, /story\.className = 'admin-story-reply'/);
assert.match(page, /article > :not\(\.admin-story-reply\)/);
assert.match(page, /article > :not\(\.admin-story-player\):not\(\.admin-story-reply\)/);
assert.match(page, /article > \.admin-story-player,\s*#admin-content \.admin-simple-conversation article > \.admin-story-reply/);
});