PlotDirector/PlotLine/Views/Writing/_WritingContextPeople.cshtml

57 lines
3.6 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 scene = Model.Context!.Scene!;
var povCharacterId = scene.POVCharacterID;
static string TextOr(string? value, string fallback) => string.IsNullOrWhiteSpace(value) ? fallback : value.Trim();
}
@if (!scene.SceneCharacters.Any())
{
<section class="writing-context-empty">
<h3>No characters recorded for this scene</h3>
<p>When scene participants are added, their current state will appear here.</p>
</section>
}
else
{
<div class="writing-context-people-grid">
@foreach (var character in scene.SceneCharacters.OrderByDescending(x => x.CharacterID == povCharacterId).ThenBy(x => x.CharacterName))
{
var known = Model.AtPoint?.Characters.FirstOrDefault(x=>x.Appearance.CharacterID==character.CharacterID);
var knowledge = Model.AtPoint?.Characters.FirstOrDefault(x=>x.Appearance.CharacterID==character.CharacterID)?.Knowledge.ToList() ?? [];
var attributes = scene.CharacterAttributeEvents.Where(x => x.CharacterID == character.CharacterID).ToList();
<article class="writing-context-card writing-context-person-card" data-context-character="@character.CharacterID" tabindex="-1">
<div class="writing-context-person-heading">
<partial name="~/Views/Shared/_Avatar.cshtml" model="@(new AvatarViewModel { DisplayName = character.CharacterName, ImagePath = character.CharacterImagePath, ThumbnailPath = character.CharacterThumbnailPath, Size = "md" })" />
<div>
<h3>@character.CharacterName</h3>
<p>@(character.CharacterID == povCharacterId ? "POV" : character.RoleInSceneTypeName ?? character.PresenceTypeName ?? "In scene")</p>
</div>
</div>
<dl class="writing-context-facts">
<dt>Location</dt><dd>@TextOr(character.LocationPath ?? character.LocationName, "Unknown")</dd>
<dt>Last recorded location</dt><dd>@(known?.State?.CurrentLocation ?? "Not recorded")</dd>
<dt>Emotional state</dt><dd>@TextOr(character.EmotionalState, "Not recorded")</dd>
<dt>Physical condition</dt><dd>@TextOr(character.PhysicalCondition, "Not recorded")</dd>
<dt>Outfit</dt><dd>@TextOr(character.OutfitDescription ?? character.AppearanceNotes, "Not recorded")</dd>
<dt>Movement</dt><dd>@TextOr(string.Join(" -> ", new[] { character.EntryLocationName, character.ExitLocationName }.Where(x => !string.IsNullOrWhiteSpace(x))), "No entry or exit recorded")</dd>
</dl>
<p class="small text-muted">@(character.CharacterID==povCharacterId?"Verified viewpoint knowledge at this narrative point":"Author reference: this character’s knowledge, not necessarily the viewpoint character’s")</p>
@if (knowledge.Any() || attributes.Any())
{
<div class="writing-context-mini-section">
@foreach (var item in knowledge.Take(3))
{
<p><strong>@item.KnowledgeStateName:</strong> @TextOr(item.Description, item.AssetName ?? item.ThreadTitle ?? "Knowledge change recorded.") <a asp-controller="Scenes" asp-action="Edit" asp-route-id="@item.SceneID">Source scene</a></p>
}
@foreach (var item in attributes.Take(3))
{
<p><strong>@item.AttributeName:</strong> @item.AttributeValue</p>
}
</div>
}
</article>
}
</div>
}