PlotDirector/PlotLine/Views/Writing/_ContextNameResults.cshtml

15 lines
2.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 PlotLine.Services.Context.ContextNamePanel
@{var lib=Model.Library!;var f=lib.Filter;var scope=f.UsedScope=="Book"?lib.Books.FirstOrDefault(b=>b.BookID==f.BookID)?.BookDisplayTitle??"selected book":f.UsedScope=="Library"?"accessible projects":"this project";}
<section data-name-results-fragment data-page="@f.Page" data-pages="@lib.TotalPages">
<script type="application/json" data-name-applied-filter>@Html.Raw(System.Text.Json.JsonSerializer.Serialize(f))</script>
<p><strong>@lib.TotalRows.ToString("N0") candidates</strong> · Usage in @scope · Page @f.Page of @lib.TotalPages</p>
@if(!lib.Results.Any()){<p>No matching library names. Try broader criteria or the established-name lookup.</p>}
<div class="context-name-results-list">@foreach(var row in lib.Results){<article class="context-name-result" data-context-name-id="@row.GivenNameID" data-used-count="@row.UsedCount">
<header><strong>@row.DisplayName</strong><span class="badge @(row.UsedCount>0?"bg-warning text-dark":"bg-success")">@(row.UsedCount>0?$"Already used ({row.UsedCount})":"Unused in scope")</span><button type="button" class="btn btn-outline-secondary btn-sm" data-name-copy="@row.DisplayName">Copy name</button></header>
<p class="small">@row.NameType @if(row.IsWordAmbiguous){<span>· Ambiguous word</span>} · @row.LocaleDisplayName</p>
<details><summary>Profile, related forms and usage</summary><dl class="writing-context-facts"><dt>Gender prior</dt><dd>Female @row.FemaleWeight?.ToString("0.###") · Male @row.MaleWeight?.ToString("0.###")</dd><dt>Era profile</dt><dd>@(row.BirthYearFrom.HasValue?$"{row.BirthYearFrom}–{row.BirthYearTo}":"No era profile")</dd><dt>Commonness / confidence</dt><dd>@row.UsageWeight?.ToString("0.###") / @row.Confidence?.ToString("0.###")</dd><dt>Reference source</dt><dd>@(row.SourceType??"Not recorded")</dd><dt>Related forms</dt><dd>@(string.IsNullOrWhiteSpace(row.RelatedForms)?"None recorded":row.RelatedForms)</dd><dt>Recorded use</dt><dd>@(string.IsNullOrWhiteSpace(row.UsedSummary)?"No use recorded in this scope":row.UsedSummary)</dd></dl>
<button type="button" class="btn btn-link btn-sm" data-name-usage="@row.DisplayName">Inspect project usage / corresponding characters</button><div data-name-usage-result></div></details>
</article>}</div>
<div class="context-edit-actions"><button type="button" class="btn btn-outline-secondary btn-sm" data-name-page="@(Math.Max(1,f.Page-1))" disabled="@(f.Page<=1)">Previous results</button><button type="button" class="btn btn-outline-secondary btn-sm" data-name-page="@(f.Page+1)" disabled="@(f.Page>=lib.TotalPages)">Next results</button></div>
</section>