152 lines
13 KiB
Plaintext
152 lines
13 KiB
Plaintext
@model PlotLineWorkspaceViewModel
|
|
@{
|
|
var lanes = Model.PlotLines.Where(x => x.IsSelected).ToList();
|
|
var laneIndex = lanes.Select((x, i) => (x.Line.PlotLineID, i)).ToDictionary(x => x.PlotLineID, x => x.i);
|
|
var sceneIndex = Model.Scenes.Select((x, i) => (x.SceneID, i)).ToDictionary(x => x.SceneID, x => x.i);
|
|
var width = Math.Max(900, Model.Scenes.Count * 224 + 260);
|
|
var height = Math.Max(340, lanes.Count * 240 + 80);
|
|
}
|
|
@foreach (var lane in lanes)
|
|
{
|
|
<input type="hidden" data-map-line-count="@lane.Line.PlotLineID" value="@lane.Line.ContributionSceneCount" />
|
|
foreach (var thread in lane.Threads)
|
|
{
|
|
<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">
|
|
<p class="muted">Select a scene, then Add to a line below, or drag it directly onto a Plot Line. Refine its thread and contribution in the editor.</p>
|
|
<p class="muted">✓ Selected line · ↗ Other line · ◇ Pending suggestion · ○ Unattributed</p>
|
|
<div class="plot-scene-strip">
|
|
@foreach (var scene in Model.AssociationScenes)
|
|
{
|
|
var selected = Model.AssociatedSelectedSceneIDs.Contains(scene.SceneID);
|
|
var state = selected ? "✓ Selected line" : scene.CanonicalPlotLineCount > 0 ? "↗ Other line" : scene.ProposedCandidateCount > 0 ? "◇ Pending suggestion" : "○ Unattributed";
|
|
<button type="button" draggable="true" data-pd-context="scene" data-pd-context-id="@scene.SceneID" data-pd-context-label="Select scene for association" data-associate-scene="@scene.SceneID" aria-pressed="false" title="@scene.SceneTitle"><small>Ch @scene.ChapterNumber.ToString("0.##") · @scene.SceneNumber.ToString("0.##")</small><strong>@scene.SceneTitle</strong><small data-association-state>@state</small></button>
|
|
}
|
|
</div>
|
|
<p id="plot-association-status" role="status">Choose a manuscript scene.</p>
|
|
</section>
|
|
<div class="plot-map-scroll" tabindex="0" aria-label="Horizontal narrative map; scroll to follow the manuscript">
|
|
<div class="plot-narrative-map" style="width:@(width)px;height:@(height)px" data-map-columns="@Model.Scenes.Count">
|
|
@for (var l = 0; l < lanes.Count; l++)
|
|
{
|
|
var lane = lanes[l];
|
|
var y = l * 240 + 150;
|
|
var laneScenes = Model.Scenes.Where(x => x.Memberships.Any(m => m.PlotLineID == lane.Line.PlotLineID)).ToList();
|
|
<div class="plot-horizontal-route" style="top:@(y)px;--line-colour:@lane.Line.Colour" data-drop-line="@lane.Line.PlotLineID" aria-label="@lane.Line.PlotLineName drop target"></div>
|
|
<div class="plot-lane-label-row" style="top:@(y - 32)px"><div data-pd-context="plot line" data-pd-context-id="@lane.Line.PlotLineID" data-pd-context-label="@lane.Line.PlotLineName" class="plot-lane-label" style="--line-colour:@lane.Line.Colour" data-drop-line="@lane.Line.PlotLineID">
|
|
<strong data-lane-name class="responsive-rail-text" tabindex="0"><span>@(l + 1)</span> @lane.Line.PlotLineName</strong>
|
|
@if (Model.Health.Lines.FirstOrDefault(h => h.PlotLineID == lane.Line.PlotLineID) is { Findings.Count: > 0 } health)
|
|
{
|
|
<button type="button" data-pd-context-command data-pwa-icon="health" class="plot-health-summary" data-health-line="@lane.Line.PlotLineID" aria-label="Health for @lane.Line.PlotLineName: @health.Summary">@health.Summary</button>
|
|
}
|
|
<a class="plot-colour-edit" asp-controller="PlotLines" asp-action="Edit" asp-route-id="@lane.Line.PlotLineID" title="Edit line and colour" aria-label="Edit line and colour"><span>Edit colour</span></a>
|
|
<button type="button" class="btn btn-sm btn-outline-secondary plot-associate-action" data-add-line="@lane.Line.PlotLineID" hidden aria-label="Add selected scene"><span>Add selected scene</span></button>
|
|
</div></div>
|
|
@for (var n = 0; n < laneScenes.Count; n++)
|
|
{
|
|
var scene = laneScenes[n];
|
|
var index = sceneIndex[scene.SceneID];
|
|
var membership = scene.Memberships.First(m => m.PlotLineID == lane.Line.PlotLineID);
|
|
var roles = string.Join(" · ", membership.Contributions.Select(c => c.CanonicalRole).Distinct());
|
|
var accent = membership.Contributions.Any(c => c.CanonicalRole is "Revealed" or "Payoff" or "Resolved");
|
|
<span class="plot-map-marker @(accent ? "is-accent" : "")" style="--column:@index;top:@(y)px;--line-colour:@lane.Line.Colour" title="@lane.Line.PlotLineName: @roles"></span>
|
|
@if (n > 0)
|
|
{
|
|
var previous = laneScenes[n - 1];
|
|
var gap = Math.Max(0, scene.NarrativeOrder - previous.NarrativeOrder - 1);
|
|
var chapters = Math.Max(0, (int)scene.ChapterNumber - (int)previous.ChapterNumber - 1);
|
|
if (gap > 0)
|
|
{
|
|
<span class="plot-map-gap" style="--column:@index;top:@(y - 10)px" title="Gap on @lane.Line.PlotLineName">┄ @gap scenes @if (chapters > 0) { <small>· @chapters chapters</small> }</span>
|
|
}
|
|
}
|
|
}
|
|
@foreach (var thread in lane.Threads)
|
|
{
|
|
if (thread.IntroducedSceneID is int first && sceneIndex.TryGetValue(first, out var column))
|
|
{
|
|
<span class="plot-thread-section" style="--column:@column;top:@(y + 25)px;--line-colour:@lane.Line.Colour" title="Known introduction: @thread.ThreadTitle">┯ @thread.ThreadTitle</span>
|
|
}
|
|
}
|
|
}
|
|
@foreach (var health in Model.Health.Lines)
|
|
{
|
|
var positioned = health.Findings.Where(f => f.Level != PlotHealthLevel.Information && f.MarkerSceneID.HasValue && sceneIndex.ContainsKey(f.MarkerSceneID.Value)).GroupBy(f => f.MarkerSceneID!.Value);
|
|
foreach (var group in positioned)
|
|
{
|
|
<button type="button" data-pd-context-command data-pwa-icon="health" class="plot-health-position" data-health-line="@health.PlotLineID" data-health-marker-scene="@group.Key" style="--column:@sceneIndex[group.Key];top:@(laneIndex[health.PlotLineID]*240+126)px" title="@string.Join(" · ", group.Select(f => f.Title).Distinct())" aria-label="Review health evidence at this scene">◇</button>
|
|
}
|
|
@if (health.Findings.Any(f => f.RuleID == "H002" && f.Level != PlotHealthLevel.Information && (!f.MarkerSceneID.HasValue || !sceneIndex.ContainsKey(f.MarkerSceneID.Value))))
|
|
{
|
|
<button type="button" data-pd-context-command data-pwa-icon="health" class="plot-health-position" data-health-line="@health.PlotLineID" style="--column:@Math.Max(0,Model.Scenes.Count-1);left:calc(var(--plot-map-origin, 260px) + var(--column) * var(--step) + 165px);top:@(laneIndex[health.PlotLineID]*240+126)px" title="Quiet stretch at evaluated cutoff" aria-label="Quiet stretch at evaluated cutoff; inspect health evidence">◇</button>
|
|
}
|
|
}
|
|
@for (var i = 0; i < Model.Scenes.Count; i++)
|
|
{
|
|
var scene = Model.Scenes[i];
|
|
var indices = scene.Memberships.Select(m => laneIndex[m.PlotLineID]).Order().ToList();
|
|
var firstY = indices.First() * 240 + 150;
|
|
var above = i % 2 == 0;
|
|
var cardY = above ? firstY - 130 : firstY + 42;
|
|
<div class="plot-chapter-guide" style="--column:@i" aria-hidden="true"><small>@if (Model.Books.Count > 0 && (i == 0 || Model.Scenes[i-1].Memberships[0].Contributions[0].BookID != scene.Memberships[0].Contributions[0].BookID)) { <text>@(Model.Books.FirstOrDefault(b => b.BookID == scene.Memberships[0].Contributions[0].BookID)?.BookDisplayTitle) · </text> }Ch @scene.ChapterNumber.ToString("0.##")</small></div>
|
|
@foreach (var membership in scene.Memberships)
|
|
{
|
|
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-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>
|
|
<span class="plot-callout-memberships">
|
|
@foreach (var membership in scene.Memberships)
|
|
{
|
|
<small class="plot-callout-role" style="--line-colour:@membership.Colour">@(scene.IsShared ? membership.PlotLineName + ": " : "")@string.Join(" · ", membership.Contributions.Select(c => c.CanonicalRole).Distinct())</small>
|
|
}
|
|
</span>
|
|
@if (scene.WarningCount > 0) { <span class="plot-warning-marker" title="@scene.WarningCount warnings; inspect for details" aria-label="@scene.WarningCount warnings">⚠</span> }
|
|
<span class="plot-callout-preview">@scene.Summary @scene.PovCharacterName · @string.Join(" · ", scene.Memberships.SelectMany(m => m.Contributions).Select(c => c.ThreadTitle).Distinct())</span>
|
|
</button>
|
|
</article>
|
|
@foreach (var target in Model.MapTargets.Where(t => scene.Memberships.SelectMany(m => m.Contributions).Any(c => c.ThreadEventID == t.ThreadEventID)))
|
|
{
|
|
if (laneIndex.TryGetValue(target.TargetPlotLineID, out var targetLane) && laneIndex.TryGetValue(target.SourcePlotLineID, out var sourceLane) && targetLane != sourceLane)
|
|
{
|
|
<span class="plot-explicit-target" style="--column:@i;top:@(Math.Min(sourceLane,targetLane)*240+150)px;height:@(Math.Abs(sourceLane-targetLane)*240)px" title="@target.StructuralType"><small>@target.StructuralType →</small></span>
|
|
}
|
|
}
|
|
}
|
|
<svg class="plot-dependency-overlay" width="100%" height="100%" aria-label="Explicit scene dependencies">
|
|
@foreach (var connection in Model.Scenes.SelectMany(s => s.Connections).DistinctBy(c => c.SceneDependencyID))
|
|
{
|
|
if (sceneIndex.TryGetValue(connection.SourceSceneID, out var sourceColumn) && sceneIndex.TryGetValue(connection.TargetSceneID, out var targetColumn))
|
|
{
|
|
var source = Model.Scenes[sourceColumn];
|
|
var target = Model.Scenes[targetColumn];
|
|
var sy = laneIndex[source.Memberships[0].PlotLineID] * 240 + 150;
|
|
var ty = laneIndex[target.Memberships[0].PlotLineID] * 240 + 150;
|
|
<path data-source-column="@sourceColumn" data-target-column="@targetColumn" data-source-y="@sy" data-target-y="@ty" d="M @(260 + sourceColumn * 224) @sy Q @((520 + (sourceColumn + targetColumn) * 224) / 2) @(Math.Min(sy,ty)-45) @(260 + targetColumn * 224) @ty"><title>@connection.DependencyType: @source.SceneTitle → @target.SceneTitle</title></path>
|
|
}
|
|
}
|
|
</svg>
|
|
@if (Model.Scenes.Count == 0) { <p class="plot-map-empty">No contributions in this view. Choose another filter or associate a manuscript scene.</p> }
|
|
</div>
|
|
</div>
|
|
<dialog id="plot-association-dialog" class="plot-association-dialog">
|
|
<div class="plot-inspector-header"><h2>Associate scene</h2><button type="button" class="btn btn-outline-secondary" data-association-close>Close</button></div>
|
|
<p role="status" data-association-result></p>
|
|
<div data-association-editor></div>
|
|
</dialog>
|