Add intersection focus and health navigation to the existing plot weave

This commit is contained in:
Nick Beckley 2026-11-05 23:32:19 +00:00
parent 15ea2ba750
commit caeb90b350
5 changed files with 20 additions and 8 deletions

View File

@ -34,6 +34,7 @@ const assert = require('node:assert/strict');
await page.goto('http://127.0.0.1:5238/plot-map-fixture');
assert.equal(await page.locator('.plot-horizontal-route').count(), 3);
assert.equal(await page.locator('.plot-map-callout').count(), 2);
await page.check('#plot-shared-only');assert.equal(await page.locator('.plot-map-callout:visible').count(),1);await page.click('#plot-next-intersection');assert.equal(await page.locator('.plot-weave-focus').count(),1);await page.fill('#plot-scene-search','unmatched phrase');assert.equal(await page.locator('.plot-map-callout:visible').count(),0);await page.uncheck('#plot-shared-only');await page.fill('#plot-scene-search','');
assert.equal(await page.locator('.plot-scene-stem.is-shared').count(), 2);
assert.equal(await page.locator('.plot-membership-overlay path.is-shared').count(), 2);
assert.equal(await page.locator('.plot-map-scroll').evaluate(el => el.scrollHeight > el.clientHeight), false);

View File

@ -206,7 +206,7 @@ internal static class ToolbarBrowserHost
await view.View.RenderAsync(new ViewContext(action, view.View, viewData, new TempDataDictionary(context, context.RequestServices.GetRequiredService<ITempDataProvider>()), writer, new HtmlHelperOptions()));
context.Response.ContentType = "text/html; charset=utf-8";
if (context.Request.Query["healthDetail"] == "true" && context.Request.Query["marketing"] != "true") { await context.Response.WriteAsync(writer.ToString()); return; }
await context.Response.WriteAsync("<html data-app-theme='modern-dark' data-theme='dark'><head><link rel='stylesheet' href='/lib/bootstrap/dist/css/bootstrap.min.css'><link rel='stylesheet' href='/css/site.css'><link rel='stylesheet' href='/css/plotline-theme.css'><link rel='stylesheet' href='/css/application-shell.css'><link rel='stylesheet' href='/css/record-workspace.css'><link rel='stylesheet' href='/css/application-context-menu.css'><link rel='stylesheet' href='/css/plot-line-workspace.css'></head><body class='app-layout'><form id='plot-workspace-form'><input type='hidden' name='projectId' value='7'></form>" + writer + "<div id='plot-inspector-backdrop' hidden></div><aside class='plot-inspector' id='plot-inspector' aria-hidden='true'><div id='plot-inspector-content'></div></aside><script src='/js/plot-line-workspace.js'></script></body></html>");
await context.Response.WriteAsync("<html data-app-theme='modern-dark' data-theme='dark'><head><link rel='stylesheet' href='/lib/bootstrap/dist/css/bootstrap.min.css'><link rel='stylesheet' href='/css/site.css'><link rel='stylesheet' href='/css/plotline-theme.css'><link rel='stylesheet' href='/css/application-shell.css'><link rel='stylesheet' href='/css/record-workspace.css'><link rel='stylesheet' href='/css/application-context-menu.css'><link rel='stylesheet' href='/css/plot-line-workspace.css'></head><body class='app-layout'><form id='plot-workspace-form'><input type='hidden' name='projectId' value='7'><input id='plot-scene-search' type='search'></form>" + writer + "<div id='plot-inspector-backdrop' hidden></div><aside class='plot-inspector' id='plot-inspector' aria-hidden='true'><div id='plot-inspector-content'></div></aside><script src='/js/plot-line-workspace.js'></script></body></html>");
});
// Public QA renders the real views/layout with isolated models; no account, payment or DB calls.
app.MapGet("/public-fixture/{page}", async context =>

View File

@ -14,12 +14,14 @@
<input type="hidden" data-line-thread="@lane.Line.PlotLineID" value="@thread.PlotThreadID" />
}
}
<details class="plot-weave-guide plain-card mb-2"><summary>Weave at a glance · @Model.Scenes.Count(s=>s.IsShared) intersections · @Model.Health.Lines.Sum(l=>l.Findings.Count) observations</summary><p class="muted">Intersections are scenes shared by selected lines. Health observations use the existing evidence engine; author status is unchanged.</p><div class="d-flex gap-2 flex-wrap">@foreach(var line in Model.Health.Lines.Where(l=>l.Findings.Count>0).Take(8)){<button type="button" class="btn btn-sm btn-outline-secondary" data-health-line="@line.PlotLineID">@Model.PlotLines.FirstOrDefault(l=>l.Line.PlotLineID==line.PlotLineID)?.Line.PlotLineName · @line.Summary</button>}</div></details>
<div class="plot-map-toolbar">
<div role="group" aria-label="Workspace mode">
<button type="button" class="btn btn-primary" data-map-mode="view" aria-pressed="true">View</button>
<button type="button" class="btn btn-outline-secondary" data-map-mode="associate" aria-pressed="false">Associate Scenes</button>
</div>
<span>@lanes.Count selected line@(lanes.Count == 1 ? "" : "s") · @Model.Mode · manuscript →</span>
<label><input id="plot-shared-only" type="checkbox" /> Intersections only</label><button id="plot-next-intersection" class="btn btn-sm btn-outline-secondary" type="button">Next intersection</button><span data-weave-status role="status"></span>
<label>Spacing <select id="plot-map-zoom" class="form-select form-select-sm"><option value="224">Comfortable</option><option value="180">Compact</option><option value="280">Expanded</option></select></label>
</div>
<section id="plot-association-strip" hidden aria-label="Manuscript scenes">
@ -104,7 +106,7 @@
var routeY = laneIndex[membership.PlotLineID] * 240 + 150;
<span class="plot-scene-stem @(scene.IsShared ? "is-shared" : "")" data-membership-line="@membership.PlotLineID" style="--column:@i;--line-colour:@membership.Colour;top:@(routeY)px"></span>
}
<article data-pd-context="scene" data-pd-context-id="@scene.SceneID" data-pd-context-label="@scene.SceneTitle" class="plot-map-callout" style="--column:@i;top:@(cardY)px" data-scene-column="@i" data-primary-lane="@indices.First()" data-above="@above.ToString().ToLowerInvariant()" data-plot-scene data-search-text="@($"{scene.SceneTitle} {scene.ChapterTitle} {scene.PovCharacterName}")">
<article data-pd-context="scene" data-pd-context-id="@scene.SceneID" data-pd-context-label="@scene.SceneTitle" class="plot-map-callout" style="--column:@i;top:@(cardY)px" data-scene-column="@i" data-primary-lane="@indices.First()" data-above="@above.ToString().ToLowerInvariant()" data-plot-scene data-shared="@scene.IsShared.ToString().ToLowerInvariant()" data-search-text="@($"{scene.SceneTitle} {scene.ChapterTitle} {scene.PovCharacterName}")">
<button type="button" data-pd-context-command data-pd-context-label="Inspect scene" data-pwa-icon="point" data-scene-inspector="@scene.SceneID" aria-label="Inspect @scene.SceneTitle">
<small>Ch @scene.ChapterNumber.ToString("0.##") · Scene @scene.SceneNumber.ToString("0.##") @(scene.IsShared ? "· Shared" : "")</small>
<strong>@scene.SceneTitle</strong>

View File

@ -7682,3 +7682,5 @@ html[data-standalone="true"] .plotline-shell.location-workspace-shell {
/* Independent writing screens: reuse existing renderers without nested application chrome. */
.writing-embedded{margin:0;padding:.75rem;min-width:0}.writing-embedded .writing-context-page{width:100%;max-width:none;margin:0}.writing-embedded .writing-context-shell-header{padding:.35rem 0;gap:.5rem}.native-writing-workspace #native-story-workspace{height:calc(100vh - 17rem)!important;min-height:26rem}.native-writing-workspace>h1{font-size:1.25rem}.writing-context-tools{display:flex;flex-wrap:wrap;gap:.65rem;align-items:center}.writing-context-tools strong{flex-basis:100%}@media(max-width:720px){.native-writing-workspace #native-story-workspace{height:70vh!important}.writing-context-scene-header{flex-wrap:wrap}.writing-context-tools a{max-width:100%;overflow-wrap:anywhere}}
.plot-weave-guide{padding:.6rem .8rem}.plot-weave-guide summary{cursor:pointer;font-weight:600}.plot-weave-focus{outline:3px solid var(--bs-primary,#735369);outline-offset:4px}.plot-map-toolbar{flex-wrap:wrap;gap:.6rem}

View File

@ -16,13 +16,20 @@
form.submit();
}));
document.getElementById("plot-scene-search")?.addEventListener("input", event => {
const query = event.target.value.trim().toLocaleLowerCase();
document.querySelectorAll("[data-plot-scene]").forEach(card => {
card.hidden = query.length > 0 && !card.dataset.searchText.toLocaleLowerCase().includes(query);
});
let sharedOnly=false,intersectionIndex=-1;
const applySceneFilter=()=>{
const query=(document.getElementById("plot-scene-search")?.value||"").trim().toLocaleLowerCase();
const toggle=document.getElementById("plot-shared-only");if(toggle)toggle.checked=sharedOnly;
document.querySelectorAll("[data-plot-scene]").forEach(card=>{card.hidden=(query.length>0&&!card.dataset.searchText.toLocaleLowerCase().includes(query))||(sharedOnly&&card.dataset.shared!=="true");});
intersectionIndex=-1;const count=[...document.querySelectorAll('[data-plot-scene][data-shared="true"]')].filter(card=>!card.hidden).length;const status=document.querySelector('[data-weave-status]');if(status)status.textContent=count+' visible intersections';
};
document.getElementById("plot-scene-search")?.addEventListener("input",applySceneFilter);
document.addEventListener('change',event=>{if(event.target.id==='plot-shared-only'){sharedOnly=event.target.checked;applySceneFilter();}});
document.addEventListener('click',event=>{
if(!event.target.closest('#plot-next-intersection'))return;
const cards=[...document.querySelectorAll('[data-plot-scene][data-shared="true"]')].filter(card=>!card.hidden);if(!cards.length){applySceneFilter();return;}
intersectionIndex=(intersectionIndex+1)%cards.length;document.querySelectorAll('.plot-weave-focus').forEach(card=>card.classList.remove('plot-weave-focus'));const card=cards[intersectionIndex];card.classList.add('plot-weave-focus');card.scrollIntoView({block:'nearest',inline:'center'});card.querySelector('button')?.focus({preventScroll:true});const status=document.querySelector('[data-weave-status]');if(status)status.textContent='Intersection '+(intersectionIndex+1)+' of '+cards.length;
});
const strip = document.getElementById("plot-association-strip");
const dialog = document.getElementById("plot-association-dialog");
let selectedScene = null;