91 lines
5.3 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.

@using PlotLine.Models.WritingSolver
@model SolverJourney
@{ Layout = "_PublicLayout"; var next = Model.Outcome.Next; var beginning = Model.Outcome.Answers.Count == 0; }
<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>
<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
{
<p class="solver-resolution">✓ Here’s a useful way forward</p>
@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>You can explore the advice below, or restart with a different area.</p>
}
@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>
@if(Model.Outcome.Reassurance is null)
{
<section class="solver-library marketing-container">
<h2>A little help, whenever you need it.</h2>
<p>You can read this advice directly, without starting the conversation.</p>
@foreach(var solution in Model.Graph.Solutions.Where(s=>s.Active).OrderBy(s=>s.Order)) { <a class="editorial-link" href="/writing-problems/@solution.Slug">@solution.PageTitle →</a> }
</section>
}
@section Scripts { <script src="~/js/writing-solver.js" asp-append-version="true"></script> }