58 lines
3.7 KiB
Plaintext
58 lines
3.7 KiB
Plaintext
@using PlotLine.Models.WritingSolver
|
||
@model SolverPageView
|
||
@inject PlotLine.Services.WritingSolverResults Results
|
||
@{ Layout="_PublicLayout"; }
|
||
<div class="solver-space solver-space--article">
|
||
<div class="solver-content">
|
||
<nav class="solver-trail" aria-label="Breadcrumb"><a href="/">Home</a><span>›</span><a href="@(Model.IsFeature ? "/features" : "/writing-problems")">@(Model.IsFeature ? "Features" : "Writing Problem Solver")</a></nav>
|
||
@if(Model.Graph.IsDemo) { <p class="solver-demo">Demonstration content · The curated collection is on its way.</p> }
|
||
@if(Model.IsFeature)
|
||
{
|
||
var feature=(SolverFeature)Model.Page;
|
||
<h1>@feature.Title</h1>
|
||
<p class="solver-intro">@feature.Summary</p>
|
||
@foreach(var paragraph in feature.Content.Split("\n\n")) { <p class="solver-editorial">@paragraph</p> }
|
||
@if(feature.Screenshot is not null) { <img class="solver-screenshot" src="@feature.Screenshot" alt="@feature.Title workspace in PlotDirector" width="1200" height="750" /> }
|
||
<h2>Writing problems this can help with</h2>
|
||
@foreach(var solution in Model.Graph.Solutions.Where(s=>s.Active && s.Features.Any(f=>f.Feature==feature.Id))) { <p><a href="/writing-problems/@solution.Slug">@solution.PageTitle</a></p> }
|
||
<p><a class="marketing-btn marketing-btn--primary" href="/features">See PlotDirector in action →</a></p>
|
||
}
|
||
else
|
||
{
|
||
var presentation = Model.Journey is {} journey ? Results.Present(journey.Outcome) : Results.Present(new SolverOutcome(null, new[] { (SolverSolution)Model.Page }, new Dictionary<string,int>(), Array.Empty<SolverAnswer>()));
|
||
@if(presentation is not null) { <partial name="Result" model="presentation" /> }
|
||
else { <partial name="Solution" model="Model" /> }
|
||
@if(Model.Journey is {} completed)
|
||
{
|
||
<div class="solver-controls">
|
||
@if(ViewData["BackState"] is string back) { <a class="editorial-link" href="/writing-problems?state=@back">← Back</a> }
|
||
<a class="marketing-btn marketing-btn--secondary" href="/writing-problems">Start again</a>
|
||
</div>
|
||
<nav class="solver-trail" aria-label="Areas discussed"><span>We’ve talked about:</span>
|
||
@foreach(var answer in completed.Outcome.Answers)
|
||
{ <span>@string.Join(", ",Model.Graph.Nodes.Single(n=>n.Id==answer.Node).Choices.Where(c=>answer.Choices.Contains(c.Id)).Select(c=>c.Text))</span> }
|
||
<a href="/writing-problems">Restart</a>
|
||
</nav>
|
||
}
|
||
var solution=(SolverSolution)Model.Page;
|
||
@if(presentation is not null)
|
||
{
|
||
<details class="solver-editorial"><summary>More about this writing problem</summary>
|
||
<p>@solution.Summary</p>
|
||
@foreach(var paragraph in solution.Content.Split("\n\n")) { <p>@paragraph</p> }
|
||
@foreach(var link in solution.Features.Where(f=>f.Primary))
|
||
{ var feature=Model.Graph.Features.Single(f=>f.Id==link.Feature); <p><a href="/features/@feature.Slug">Explore @feature.Title →</a></p> }
|
||
</details>
|
||
}
|
||
@if(solution.Related.Count>0) { <h2>You might also find this useful</h2> }
|
||
@foreach(var id in solution.Related)
|
||
{
|
||
var related=Model.Graph.Solutions.Single(s=>s.Id==id && s.Active);
|
||
<p><a href="/writing-problems/@related.Slug">@related.PageTitle</a></p>
|
||
}
|
||
}
|
||
@if(Model.Page.Questions.Count>0) { <h2>Questions this helps answer</h2><ul>@foreach(var question in Model.Page.Questions) { <li>@question</li> }</ul> }
|
||
<a class="editorial-link" href="/writing-problems">Find a way through your writing problem →</a>
|
||
</div>
|
||
</div>
|