PlotDirector/PlotLine/Views/Writing/_ContextRelationships.cshtml

24 lines
4.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@model WritingContextDisplayViewModel
@{var position=Model.Context!.Position;var participants=Model.Context.Scene!.SceneCharacters.Select(c=>c.CharacterID).ToHashSet();if(Model.Context.Scene.POVCharacterID is int pov)participants.Add(pov);
var rows=(Model.AtPoint?.Relationships??Model.RelationshipMap?.Relationships??[]).OrderByDescending(r=>participants.Contains(r.CharacterAID)&&participants.Contains(r.CharacterBID)).ThenBy(r=>r.CharacterAName).ToList();var canEdit=Model.CharacterExplorer?.CanEdit==true;}
<div data-context-relationships>
<div class="context-explorer-controls"><label>Find a connection <input type="search" data-relationship-filter class="form-control form-control-sm"/></label><label>Show <select data-relationship-scope class="form-select form-select-sm"><option value="scene">Involving scene participants</option><option value="all">All established at this point</option></select></label></div>
<p class="small">Verified author reference at this scene. Reader and other-character flags are recorded separately by the underlying system; neither proves what the viewpoint character knows. Unverified claims are excluded from this state.</p>
@foreach(var family in new[]{true,false}){
<section class="context-relationship-group"><h3 class="h6">@(family?"Family connections":"Narrative connections")</h3>
@foreach(var r in rows.Where(r=>string.Equals(r.RelationshipCategoryName,"Family",StringComparison.OrdinalIgnoreCase)==family)){
<details class="context-character-row" data-context-relationship="@r.CharacterRelationshipID" data-relevant="@((participants.Contains(r.CharacterAID)||participants.Contains(r.CharacterBID)).ToString().ToLowerInvariant())" data-filter-name="@(r.CharacterAName+" "+r.CharacterBName+" "+r.RelationshipTypeName)" tabindex="-1">
<summary><strong>@r.CharacterAName @(r.IsReciprocal?"↔":"→") @r.CharacterBName</strong><span>@r.RelationshipTypeName · @r.CurrentStateName</span></summary>
<div class="context-character-detail"><p>@r.RelationshipCategoryName · @(r.IsReciprocal?"Reciprocal connection":"Directional connection: From → To") @if(r.CurrentIntensity.HasValue){<span>· Intensity @r.CurrentIntensity / 10</span>}</p>
@if(!string.IsNullOrWhiteSpace(r.Notes)){<p>Recorded notes: @r.Notes</p>}else{<p>No author notes recorded for this state.</p>}
<p class="small">First meeting: no structured marker is available. Explicit meeting evidence, if recorded, remains in the notes and developments below; earliest co-occurrence is never treated as a meeting.</p>
<details><summary>Latest recorded developments (@r.History.Count)</summary><ul>@foreach(var item in r.History.OrderBy(h=>h.SceneID.HasValue?(Model.Context.Narrative?.Scenes.ToList().FindIndex(s=>s.SceneID==h.SceneID)??-1):-1).Reverse().Take(3)){<li>@item.Label · @item.StateName @item.Notes @if(item.SceneID.HasValue){<a href="/Scenes/Edit/@item.SceneID" target="_blank" rel="noopener">Source scene</a>}</li>}</ul></details>
@if(canEdit){<div class="context-edit-actions"><button type="button" class="btn btn-outline-secondary btn-sm" data-context-relationship-edit="scene" data-relationship-id="@r.CharacterRelationshipID">Record / correct this scene’s development</button>@if(r.InitialStateEditable){<button type="button" class="btn btn-outline-secondary btn-sm" data-context-relationship-edit="initial" data-relationship-id="@r.CharacterRelationshipID">Correct initial state</button>}</div>}
<a href="/RelationshipMap?projectId=@position.ProjectId&bookId=@position.BookId&sceneId=@position.SceneId&focusCharacterId=@r.CharacterAID" target="_blank" rel="noopener">Open in Relationships Editor</a>
</div></details>}
</section>}
<p data-relationship-empty hidden>No matching established relationships. Missing records do not imply that characters have never met or are unrelated.</p>
@if(canEdit){<div class="context-edit-actions"><button type="button" class="btn btn-outline-primary btn-sm" data-context-relationship-edit="scene">Add one scene relationship</button><button type="button" class="btn btn-outline-secondary btn-sm" data-context-relationship-edit="initial">Add one initial relationship</button></div>}
<p data-context-interaction-status role="status"></p><a href="/RelationshipMap?projectId=@position.ProjectId&bookId=@position.BookId&sceneId=@position.SceneId" target="_blank" rel="noopener">Open in Relationships Editor</a>
</div>