@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()) {

No characters recorded for this scene

When scene participants are added, their current state will appear here.

} else {
@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();

@character.CharacterName

@(character.CharacterID == povCharacterId ? "POV" : character.RoleInSceneTypeName ?? character.PresenceTypeName ?? "In scene")

Location
@TextOr(character.LocationPath ?? character.LocationName, "Unknown")
Emotional state
@TextOr(character.EmotionalState, "Not recorded")
Physical condition
@TextOr(character.PhysicalCondition, "Not recorded")
Outfit
@TextOr(character.OutfitDescription ?? character.AppearanceNotes, "Not recorded")
Movement
@TextOr(string.Join(" -> ", new[] { character.EntryLocationName, character.ExitLocationName }.Where(x => !string.IsNullOrWhiteSpace(x))), "No entry or exit recorded")
@if (knowledge.Any() || attributes.Any()) {
@foreach (var item in knowledge.Take(3)) {

@item.KnowledgeStateName: @TextOr(item.Description, item.AssetName ?? item.ThreadTitle ?? "Knowledge change recorded.")

} @foreach (var item in attributes.Take(3)) {

@item.AttributeName: @item.AttributeValue

}
}
}
}