89 lines
5.4 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 PlotDirector.Website.Models.WritingSolver
@model SolverJourney
@inject PlotDirector.Website.Services.WritingSolverResults Results
@inject PlotDirector.Website.Services.WritingSolverPayoff Payoff
@{ 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 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="/problem-solver/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 Payoff.OrderedChoices(next))
{
<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="/problem-solver?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="/problem-solver?state=@resultBack">← Back</a> }
<a class="marketing-btn marketing-btn--secondary" href="/problem-solver">Start again</a>
</div>
}
@if(Model.Outcome.Answers.Count > 0)
{
<nav class="solver-recap" 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="/problem-solver">Restart</a>
</nav>
}
else { <p><a class="editorial-link" href="/problem-solver/browse">Browse writing problems →</a></p><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> }
@if(presentation is not null){<partial name="ImageDialog" />}
</div>
</section>
@section Scripts { @if(presentation is not null){<script src="~/js/writing-solver-image-dialog.js" asp-append-version="true"></script>} <script src="~/js/writing-solver.js" asp-append-version="true"></script> }