86 lines
5.1 KiB
Plaintext
86 lines
5.1 KiB
Plaintext
@using PlotLine.Models.WritingSolver
|
||
@model SolverJourney
|
||
@inject PlotLine.Services.WritingSolverResults Results
|
||
@{ Layout = "_PublicLayout"; var next = Model.Outcome.Next; var beginning = Model.Outcome.Answers.Count == 0; var presentation=Results.Present(Model.Outcome); }
|
||
<section class="solver-space @(beginning ? "solver-space--entry" : "")">
|
||
<div class="solver-content">
|
||
<p class="marketing-eyebrow">The Writing Problem Solver</p>
|
||
@if (Model.Error is not null) { <p role="status">@Model.Error</p> }
|
||
@if (beginning)
|
||
{
|
||
<h1>What’s getting in the way<br class="solver-wide" /> of <em>your</em> writing?</h1>
|
||
<p class="solver-intro">Tell us what’s making your novel more complicated than it should be,<br class="solver-wide" /> and we’ll help you find a way to get it under control.</p>
|
||
}
|
||
@if (next is not null)
|
||
{
|
||
<form method="post" action="/writing-problems/answer" class="solver-form">
|
||
@Html.AntiForgeryToken()
|
||
<input type="hidden" name="state" value="@Model.History" />
|
||
<input type="hidden" name="node" value="@next.Id" />
|
||
<fieldset data-max-choices="@next.MaxChoices">
|
||
<legend class="@(beginning ? "solver-entry-legend" : "solver-question")">@next.Title</legend>
|
||
<p class="solver-help" id="solver-help">@next.Help</p>
|
||
<div class="solver-choices @(next.Type == "area" ? "solver-choices--areas" : "")">
|
||
@foreach(var choice in next.Choices.Where(c => c.Active).OrderBy(c => c.Order))
|
||
{
|
||
<label class="solver-choice @(choice.Fallback ? "solver-choice--fallback" : "")">
|
||
<input type="@(next.Multiple ? "checkbox" : "radio")" name="choices" value="@choice.Id" aria-describedby="solver-help" />
|
||
@if (next.Type == "area" && !choice.Fallback) { <partial name="Icon" model="choice.Icon" /> }
|
||
<span><strong>@choice.Text</strong>@if(!string.IsNullOrEmpty(choice.Help)) { <span class="solver-choice-help">@choice.Help</span> }</span>
|
||
</label>
|
||
}
|
||
</div>
|
||
</fieldset>
|
||
<p class="solver-selection-error" role="alert" hidden>Please choose an answer to continue.</p>
|
||
<div class="solver-controls">
|
||
@if (ViewData["BackState"] is string back) { <a class="editorial-link" href="/writing-problems?state=@back">← Back</a> }
|
||
<button class="marketing-btn marketing-btn--primary" type="submit">@(beginning ? "Let’s find your solution" : "Continue") <span aria-hidden="true">→</span></button>
|
||
</div>
|
||
</form>
|
||
}
|
||
else
|
||
{
|
||
@if(Model.Outcome.Reassurance is not null)
|
||
{
|
||
<partial name="Neutral" model="Model" />
|
||
}
|
||
else
|
||
{
|
||
|
||
@if(Model.Outcome.Solutions.Count == 0)
|
||
{
|
||
<h1>Let’s give this a little breathing room.</h1>
|
||
<p>There isn’t enough evidence for a specific recommendation yet. Try naming one scene or thread that feels difficult, then ask what you need to know about it next.</p>
|
||
<p>Try one concrete scene or thread, then start again with the symptom you can recognise most clearly.</p>
|
||
}
|
||
@if(presentation is not null) { <partial name="Result" model="presentation" /> }
|
||
else
|
||
{
|
||
@foreach(var solution in Model.Outcome.Solutions)
|
||
{ <partial name="Solution" model="@(new SolverPageView(Model.Graph,solution,false))" /> }
|
||
}
|
||
}
|
||
<div class="solver-controls">
|
||
@if (ViewData["BackState"] is string resultBack) { <a class="editorial-link" href="/writing-problems?state=@resultBack">← Back</a> }
|
||
<a class="marketing-btn marketing-btn--secondary" href="/writing-problems">Start again</a>
|
||
</div>
|
||
}
|
||
@if(Model.Outcome.Answers.Count > 0)
|
||
{
|
||
<nav class="solver-trail" aria-label="Areas discussed">
|
||
<span>We’ve talked about:</span>
|
||
@for(var i=0; i<Model.Outcome.Answers.Count; i++)
|
||
{
|
||
var answer=Model.Outcome.Answers[i];
|
||
var node=Model.Graph.Nodes.Single(n=>n.Id==answer.Node);
|
||
<span>@string.Join(", ",node.Choices.Where(c=>answer.Choices.Contains(c.Id)).Select(c=>c.Text))</span>
|
||
}
|
||
<a href="/writing-problems">Restart</a>
|
||
</nav>
|
||
}
|
||
else { <p class="solver-promises">A few quiet minutes <span>·</span> No sign-up required <span>·</span> Advice you can use straight away</p> }
|
||
@if(Model.Graph.IsDemo) { <p class="solver-demo">Preview journey · This small plot-line demonstration will grow into a curated collection of writing problems.</p> }
|
||
</div>
|
||
</section>
|
||
@section Scripts { <script src="~/js/writing-solver.js" asp-append-version="true"></script> }
|