64 lines
4.3 KiB
Plaintext
64 lines
4.3 KiB
Plaintext
@using PlotLine.Models.WritingSolver
|
||
@model SolverPageView
|
||
@inject PlotLine.Services.WritingSolverResults Results
|
||
@inject PlotLine.Services.WritingProblemEditorial Editorial
|
||
@{ 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" : "/problem-solver")">@(Model.IsFeature ? "Features" : "Problem Solver")</a>@if(!Model.IsFeature){<span>›</span><span aria-current="page">@Model.Page.Title</span>}</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="/problem-solver/@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="/problem-solver?state=@back">← Back</a> }
|
||
<a class="marketing-btn marketing-btn--secondary" href="/problem-solver">Start again</a>
|
||
</div>
|
||
<nav class="solver-recap" 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="/problem-solver">Restart</a>
|
||
</nav>
|
||
}
|
||
@if(Model.Journey is {} reviewJourney) { <partial name="Review" model="reviewJourney" /> }
|
||
var solution=(SolverSolution)Model.Page;
|
||
var permanent=Editorial.Find(solution.Id);
|
||
@if(permanent is not null)
|
||
{
|
||
<section class="solver-related" aria-labelledby="related-problems"><h2 id="related-problems">Related writing problems</h2><ul>
|
||
@foreach(var id in permanent.Related)
|
||
{
|
||
var related=Model.Graph.Solutions.FirstOrDefault(s=>s.Id==id&&s.Active);
|
||
var relatedArticle=Editorial.Find(id);
|
||
@if(related is not null && relatedArticle is not null) { <li><a href="/problem-solver/@related.Slug">@related.Title</a><p>@relatedArticle.Distinction</p></li> }
|
||
}
|
||
</ul></section>
|
||
@foreach(var link in solution.Features.Where(f=>f.Primary))
|
||
{ var feature=Model.Graph.Features.Single(f=>f.Id==link.Feature); <p><a class="editorial-link" href="/features/@feature.Slug">Explore @feature.Title →</a></p> }
|
||
<p><a class="editorial-link" href="/problem-solver/browse/@permanent.Area">Browse this problem area →</a></p>
|
||
}
|
||
|
||
}
|
||
@if(Model.Page.Questions.Count>0 && (Model.IsFeature || Editorial.Find(Model.Page.Id) is null)) { <h2>Questions this helps answer</h2><ul>@foreach(var question in Model.Page.Questions) { <li>@question</li> }</ul> }
|
||
<a class="editorial-link" href="/problem-solver">Find a way through your writing problem →</a>
|
||
@if(!Model.IsFeature){<partial name="ImageDialog" />}
|
||
</div>
|
||
</div>
|
||
|
||
@section Scripts { @if(!Model.IsFeature){<script src="~/js/writing-solver-image-dialog.js" asp-append-version="true"></script>} }
|