286 lines
13 KiB
Plaintext
286 lines
13 KiB
Plaintext
@model StoryIntelligenceProgressViewModel
|
|
@{
|
|
ViewData["Title"] = "Story Intelligence Review Centre";
|
|
}
|
|
|
|
<section class="story-review-centre-shell" aria-labelledby="story-review-centre-title">
|
|
<div class="story-review-centre-workspace">
|
|
<div class="story-review-centre-heading">
|
|
<p class="eyebrow">Story Intelligence</p>
|
|
<h1 id="story-review-centre-title">Review Centre</h1>
|
|
<p>@(Model.CharacterGateSatisfied
|
|
? "Your manuscript analysis is complete. Choose any category to inspect or review."
|
|
: "Resolve Characters first. Once character identities are confirmed, the remaining Story Intelligence categories can be reviewed in any order.")</p>
|
|
</div>
|
|
|
|
@if (TempData["OnboardingStoryIntelligenceError"] is string error)
|
|
{
|
|
<div class="alert alert-danger">@error</div>
|
|
}
|
|
@if (TempData["OnboardingStoryIntelligenceMessage"] is string message)
|
|
{
|
|
<div class="alert alert-success">@message</div>
|
|
}
|
|
|
|
<section class="story-review-centre-grid" aria-label="Story Intelligence review categories">
|
|
@ReviewModule(
|
|
"Characters",
|
|
Model.CharacterNeedsAttentionCount,
|
|
Model.PipelineDashboard.CharacterStageComplete,
|
|
false,
|
|
"Resolve character identities before reviewing dependent Story Intelligence.",
|
|
"Review Characters",
|
|
"StoryIntelligenceCharacters",
|
|
"View Characters",
|
|
"Characters",
|
|
new { projectId = Model.ProjectID },
|
|
true)
|
|
|
|
@ReviewModule(
|
|
"Assets",
|
|
Model.AssetNeedsAttentionCount,
|
|
Model.PipelineDashboard.AssetStageComplete,
|
|
!Model.CharacterGateSatisfied,
|
|
"Important objects and possessions found in the manuscript.",
|
|
"Review Assets",
|
|
"StoryIntelligenceAssets",
|
|
"View Assets",
|
|
"StoryAssets",
|
|
new { projectId = Model.ProjectID })
|
|
|
|
@ReviewModule(
|
|
"Knowledge",
|
|
Model.KnowledgeNeedsAttentionCount,
|
|
Model.PipelineDashboard.KnowledgeStageComplete,
|
|
!Model.CharacterGateSatisfied,
|
|
"Facts, discoveries, beliefs, and suspicions found in the manuscript.",
|
|
"Review Knowledge",
|
|
"StoryIntelligenceKnowledge",
|
|
"View Knowledge",
|
|
"StoryBible",
|
|
new { projectId = Model.ProjectID })
|
|
|
|
@ReviewModule(
|
|
"Locations",
|
|
Model.LocationNeedsAttentionCount,
|
|
Model.PipelineDashboard.LocationStageComplete,
|
|
!Model.CharacterGateSatisfied,
|
|
"Places found in the manuscript.",
|
|
"Review Locations",
|
|
"StoryIntelligenceLocations",
|
|
"View Locations",
|
|
"Locations",
|
|
new { projectId = Model.ProjectID })
|
|
|
|
@ReviewPlotSynthesis()
|
|
|
|
@ReviewModule(
|
|
"Relationships",
|
|
Model.RelationshipNeedsAttentionCount,
|
|
Model.PipelineDashboard.RelationshipStageComplete,
|
|
!Model.CharacterGateSatisfied,
|
|
"Character relationships found in scene evidence.",
|
|
"Review Relationships",
|
|
"StoryIntelligenceRelationships",
|
|
"View Relationships",
|
|
"RelationshipMap",
|
|
new { projectId = Model.ProjectID, bookId = Model.BookID })
|
|
|
|
@ReviewMetrics(!Model.CharacterGateSatisfied)
|
|
|
|
@if (Model.AnalysisIssueCount > 0)
|
|
{
|
|
@ReviewModule(
|
|
"Analysis Issues",
|
|
Model.AnalysisIssueCount,
|
|
false,
|
|
false,
|
|
"Some chapters or scenes reported analysis issues.",
|
|
"Return to Book",
|
|
"StoryIntelligenceReviewCentre",
|
|
"Return to Book",
|
|
"Books",
|
|
new { id = Model.BookID })
|
|
}
|
|
</section>
|
|
|
|
<div class="onboarding-actions story-review-centre-actions">
|
|
<a class="btn btn-outline-secondary" asp-controller="Books" asp-action="Details" asp-route-id="@Model.BookID">Return to Book</a>
|
|
<a class="btn btn-outline-primary" asp-controller="Writer" asp-action="Index" asp-route-projectId="@Model.ProjectID">Open Writer Workspace</a>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
@functions {
|
|
private Microsoft.AspNetCore.Html.IHtmlContent ReviewPlotSynthesis()
|
|
{
|
|
var blocked = !Model.CharacterGateSatisfied;
|
|
var status = "Preparing analysis";
|
|
var statusClass = "story-review-centre-tile__status story-review-centre-tile__status--locked";
|
|
var description = "Whole-book plot synthesis starts after Characters are resolved.";
|
|
var actionHtml = "<span class=\"btn btn-outline-secondary btn-sm disabled\" aria-disabled=\"true\">Locked</span>";
|
|
|
|
if (!blocked)
|
|
{
|
|
statusClass = "story-review-centre-tile__status story-review-centre-tile__status--ready";
|
|
if (Model.PlotSynthesis.IsQueued)
|
|
{
|
|
status = "Preparing";
|
|
description = "PlotDirector is preparing the whole-book plot synthesis.";
|
|
actionHtml = "<span class=\"btn btn-outline-primary btn-sm disabled\" aria-disabled=\"true\">Preparing</span>";
|
|
}
|
|
else if (Model.PlotSynthesis.IsRunning)
|
|
{
|
|
status = "Analysing";
|
|
description = "PlotDirector is reading the full book to find sustained Plot Lines, Threads, and scene events.";
|
|
actionHtml = "<span class=\"btn btn-outline-primary btn-sm disabled\" aria-disabled=\"true\">Analysing</span>";
|
|
}
|
|
else if (Model.PlotSynthesis.IsFailed)
|
|
{
|
|
status = "Failed";
|
|
statusClass = "story-review-centre-tile__status story-review-centre-tile__status--warning";
|
|
description = string.IsNullOrWhiteSpace(Model.PlotSynthesis.ErrorMessage)
|
|
? "Whole-book plot synthesis failed and can be retried."
|
|
: Model.PlotSynthesis.ErrorMessage;
|
|
actionHtml = $$"""
|
|
<form method="post" action="{{Url.Action("RetryStoryIntelligencePlotSynthesis", "Onboarding")}}">
|
|
<input type="hidden" name="batchId" value="{{Model.BatchID}}" />
|
|
<button class="btn btn-outline-primary btn-sm" type="submit">Retry</button>
|
|
</form>
|
|
""";
|
|
}
|
|
else if (Model.PlotSynthesis.IsCompleted && Model.NarrativeNeedsAttentionCount.GetValueOrDefault() > 0)
|
|
{
|
|
status = $"{Model.NarrativeNeedsAttentionCount:N0} need attention";
|
|
statusClass = "story-review-centre-tile__status story-review-centre-tile__status--warning";
|
|
description = $"{Model.PlotSynthesis.ThreadCount:N0} thread candidates and {Model.PlotSynthesis.EventCount:N0} proposed scene events are ready.";
|
|
var href = Url.Action("StoryIntelligenceNarrative", "Onboarding", new { batchId = Model.BatchID }) ?? "#";
|
|
actionHtml = $"<a class=\"btn btn-outline-primary btn-sm\" href=\"{System.Net.WebUtility.HtmlEncode(href)}\">Review Plot Lines & Threads</a>";
|
|
}
|
|
else if (Model.PipelineDashboard.NarrativeStageComplete)
|
|
{
|
|
status = "Complete";
|
|
description = "Plot Lines and Threads review has been saved.";
|
|
var href = Url.Action("Index", "Timeline", new { projectId = Model.ProjectID, bookId = Model.BookID }) ?? "#";
|
|
actionHtml = $"<a class=\"btn btn-outline-primary btn-sm\" href=\"{System.Net.WebUtility.HtmlEncode(href)}\">View on Timeline</a>";
|
|
}
|
|
else
|
|
{
|
|
description = "Plot synthesis will start automatically once character resolution is saved.";
|
|
actionHtml = "<span class=\"btn btn-outline-primary btn-sm disabled\" aria-disabled=\"true\">Preparing</span>";
|
|
}
|
|
}
|
|
|
|
return new Microsoft.AspNetCore.Html.HtmlString($$"""
|
|
<article class="story-review-centre-tile{{(blocked ? " story-review-centre-tile--locked" : string.Empty)}}" data-plot-synthesis-tile>
|
|
<div>
|
|
<h2>Plot Lines & Threads</h2>
|
|
<p>{{System.Net.WebUtility.HtmlEncode(description)}}</p>
|
|
</div>
|
|
<strong class="{{statusClass}}">{{System.Net.WebUtility.HtmlEncode(status)}}</strong>
|
|
{{actionHtml}}
|
|
</article>
|
|
""");
|
|
}
|
|
|
|
private string StatusText(string title, int? count, bool complete, bool blocked)
|
|
{
|
|
if (blocked)
|
|
{
|
|
return "Locked until Characters are resolved";
|
|
}
|
|
|
|
if (string.Equals(title, "Scene Metrics", StringComparison.Ordinal))
|
|
{
|
|
return Model.MetricValueCount > 0 ? "Available" : "No metrics available";
|
|
}
|
|
|
|
if (complete)
|
|
{
|
|
return "Complete";
|
|
}
|
|
|
|
if (!count.HasValue)
|
|
{
|
|
return "Ready";
|
|
}
|
|
|
|
return count switch
|
|
{
|
|
0 => "No review needed",
|
|
1 => "1 needs attention",
|
|
_ => $"{count:N0} need attention"
|
|
};
|
|
}
|
|
|
|
private Microsoft.AspNetCore.Html.IHtmlContent ReviewMetrics(bool blocked)
|
|
{
|
|
var hasMetrics = Model.MetricValueCount > 0;
|
|
var status = StatusText("Scene Metrics", Model.MetricValueCount, false, blocked);
|
|
var statusClass = blocked
|
|
? "story-review-centre-tile__status story-review-centre-tile__status--locked"
|
|
: hasMetrics
|
|
? "story-review-centre-tile__status story-review-centre-tile__status--ready"
|
|
: "story-review-centre-tile__status story-review-centre-tile__status--locked";
|
|
var href = Url.Action("Index", "Timeline", new { projectId = Model.ProjectID, bookId = Model.BookID }) ?? "#";
|
|
var actionHtml = blocked
|
|
? "<span class=\"btn btn-outline-secondary btn-sm disabled\" aria-disabled=\"true\">Locked</span>"
|
|
: hasMetrics
|
|
? $"<a class=\"btn btn-outline-primary btn-sm\" href=\"{System.Net.WebUtility.HtmlEncode(href)}\">View on Timeline</a>"
|
|
: "<span class=\"btn btn-outline-secondary btn-sm disabled\" aria-disabled=\"true\">No action</span>";
|
|
|
|
return new Microsoft.AspNetCore.Html.HtmlString($$"""
|
|
<article class="story-review-centre-tile{{(blocked ? " story-review-centre-tile--locked" : string.Empty)}}">
|
|
<div>
|
|
<h2>Scene Metrics</h2>
|
|
<p>Auto-applied metrics from analysed scenes.</p>
|
|
</div>
|
|
<strong class="{{statusClass}}">{{System.Net.WebUtility.HtmlEncode(status)}}</strong>
|
|
{{actionHtml}}
|
|
</article>
|
|
""");
|
|
}
|
|
|
|
private Microsoft.AspNetCore.Html.IHtmlContent ReviewModule(
|
|
string title,
|
|
int? count,
|
|
bool complete,
|
|
bool blocked,
|
|
string description,
|
|
string reviewActionLabel,
|
|
string reviewAction,
|
|
string completeActionLabel,
|
|
string completeController,
|
|
object completeRouteValues,
|
|
bool primary = false)
|
|
{
|
|
var status = StatusText(title, count, complete, blocked);
|
|
var statusClass = blocked
|
|
? "story-review-centre-tile__status story-review-centre-tile__status--locked"
|
|
: (count.GetValueOrDefault() > 0 || (!complete && !count.HasValue))
|
|
? "story-review-centre-tile__status story-review-centre-tile__status--warning"
|
|
: "story-review-centre-tile__status story-review-centre-tile__status--ready";
|
|
var tileClass = "story-review-centre-tile"
|
|
+ (primary ? " story-review-centre-tile--primary" : string.Empty)
|
|
+ (blocked ? " story-review-centre-tile--locked" : string.Empty);
|
|
var href = complete
|
|
? Url.Action("Index", completeController, completeRouteValues) ?? "#"
|
|
: Url.Action(reviewAction, "Onboarding", new { batchId = Model.BatchID }) ?? "#";
|
|
var actionLabel = complete ? completeActionLabel : reviewActionLabel;
|
|
var actionHtml = blocked
|
|
? "<span class=\"btn btn-outline-secondary btn-sm disabled\" aria-disabled=\"true\">Locked</span>"
|
|
: $"<a class=\"btn btn-outline-primary btn-sm\" href=\"{System.Net.WebUtility.HtmlEncode(href)}\">{System.Net.WebUtility.HtmlEncode(actionLabel)}</a>";
|
|
|
|
return new Microsoft.AspNetCore.Html.HtmlString($$"""
|
|
<article class="{{tileClass}}">
|
|
<div>
|
|
<h2>{{System.Net.WebUtility.HtmlEncode(title)}}</h2>
|
|
<p>{{System.Net.WebUtility.HtmlEncode(description)}}</p>
|
|
</div>
|
|
<strong class="{{statusClass}}">{{System.Net.WebUtility.HtmlEncode(status)}}</strong>
|
|
{{actionHtml}}
|
|
</article>
|
|
""");
|
|
}
|
|
}
|