PlotDirector/PlotLine/Views/Writing/_WritingContextPeople.cshtml

54 lines
3.0 KiB
Plaintext

@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 knowledge = scene.CharacterKnowledge.Where(x => x.CharacterID == character.CharacterID).ToList();
var attributes = scene.CharacterAttributeEvents.Where(x => x.CharacterID == character.CharacterID).ToList();
<article class="writing-context-card writing-context-person-card">
<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>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>
@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.")</p>
}
@foreach (var item in attributes.Take(3))
{
<p><strong>@item.AttributeName:</strong> @item.AttributeValue</p>
}
</div>
}
</article>
}
</div>
}