86 lines
6.7 KiB
Plaintext

@model PlotLine.Services.Manuscript.ManuscriptReaderModel
@{
if(!Model.IntegratedReview){ViewData["Title"] = $"Manuscript Reader · {Model.Book.BookTitle}";ViewData["DesktopLayout"] = "details";}
var routeAction=Model.IntegratedReview?"Review":"Index";var routeController=Model.IntegratedReview?"Writer":"ManuscriptReader";
var reviewToolbar = new PlotLine.Models.WriterWorkToolbar(Model.Book.BookID, Model.Chapter?.ChapterID, Model.Chapter?.ChapterTitle, DefaultKind: "Reading");
}
<link rel="stylesheet" href="~/css/writer-work.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/manuscript-reader.css" asp-append-version="true" />
<div class="manuscript-reader" data-focus="@(Model.FocusReading ? "true" : "false")"
data-book-id="@Model.Book.BookID" data-chapter-id="@Model.Chapter?.ChapterID" data-chapter-number="@Model.Chapter?.ChapterNumber"
data-revision="@Model.Revision" data-version="@Model.ContentVersion"
data-integrated-review="@Model.IntegratedReview.ToString().ToLowerInvariant()" data-check-url="@Url.Action("Changes","ManuscriptReader")" data-chapter-url="@Url.Action("Chapter","ManuscriptReader")">
@if(!Model.IntegratedReview){
<nav data-pwa-identity class="breadcrumb-trail" aria-label="Breadcrumb">
<a asp-controller="Books" asp-action="Details" asp-route-id="@Model.Book.BookID">@Model.Book.BookTitle · Chapters</a>
<span>Manuscript Reader</span>
</nav>
<header data-pwa-header class="page-heading">
<div><p class="eyebrow">@Model.Book.BookTitle</p><h1>Manuscript Reader</h1><span class="status-pill">Read only</span></div>
</header>
}
<nav class="reader-controls" aria-label="Chapter navigation">
@if (Model.PreviousId is int previous)
{ <a class="btn btn-outline-secondary" asp-controller="@routeController" asp-action="@routeAction" asp-route-bookId="@Model.Book.BookID" asp-route-chapterId="@previous" asp-route-focus="@Model.FocusReading" rel="prev">← Previous chapter</a> }
else { <span class="btn btn-outline-secondary disabled" aria-disabled="true">← Previous chapter</span> }
<form method="get" asp-controller="@routeController" asp-action="@routeAction">
<input type="hidden" name="focus" value="@Model.FocusReading.ToString().ToLowerInvariant()" />
<input type="hidden" name="bookId" value="@Model.Book.BookID" />
<label for="reader-chapter">Chapter</label>
<select id="reader-chapter" name="chapterId" class="form-select">
@foreach (var chapter in Model.Chapters)
{ <option value="@chapter.ChapterID" selected="@(chapter.ChapterID == Model.Chapter?.ChapterID)">@chapter.ChapterNumber: @chapter.ChapterTitle</option> }
</select>
<button class="btn btn-outline-secondary" type="submit">Read</button>
</form>
@if (Model.NextId is int next)
{ <a class="btn btn-outline-secondary" asp-controller="@routeController" asp-action="@routeAction" asp-route-bookId="@Model.Book.BookID" asp-route-chapterId="@next" asp-route-focus="@Model.FocusReading" rel="next">Next chapter →</a> }
else { <span class="btn btn-outline-secondary disabled" aria-disabled="true">Next chapter →</span> }
<button type="button" class="btn btn-outline-secondary" id="reader-focus" aria-pressed="@Model.FocusReading.ToString().ToLowerInvariant()" hidden>Focus reading</button>
</nav>
@if(Model.IntegratedReview){<button type="button" class="btn btn-outline-primary" data-review-record>Record an observation</button>}
<p class="reader-status" role="status" id="reader-loading" hidden>Loading chapter…</p>
<div class="reader-status reader-live-controls" hidden>
<label><input type="checkbox" id="reader-pause" /> Pause automatic updates while listening</label>
<span role="status" aria-live="polite" id="reader-update-status"></span>
<button type="button" id="reader-apply-update" class="btn btn-outline-secondary btn-sm" hidden>Show updated chapter</button>
</div>
<details class="reader-metadata" open="@(!Model.IntegratedReview)"><summary>Accepted manuscript details</summary><div class="reader-status muted" id="reader-timestamps">
@if (Model.LastSuccessfulSyncUtc is DateTime sync)
{ <p>Last successful chapter synchronisation: <time datetime="@sync.ToString("yyyy-MM-ddTHH:mm:ssZ")">@sync.ToString("dd MMM yyyy HH:mm:ss") UTC</time></p> }
else { <p>No successful chapter synchronisation timestamp is recorded.</p> }
@if (Model.SnapshotCapturedUtc is DateTime captured)
{ <p>Accepted manuscript snapshot captured: <time datetime="@captured.ToString("yyyy-MM-ddTHH:mm:ssZ")">@captured.ToString("dd MMM yyyy HH:mm:ss") UTC</time></p> }
<p>Showing accepted server text. Changes are checked automatically while this page is visible.</p>
</div>
</details>
<details><summary>Reading &amp; Audio Review</summary><partial name="_WriterWorkToolbar" model="reviewToolbar" /></details>
@if(!Model.IntegratedReview){<a asp-controller="Writer" asp-action="Write" asp-route-bookId="@Model.Book.BookID">Return to Writing</a>}
<div id="reader-content">
@if (Model.Paragraphs.Count == 0)
{
<section class="reader-empty" role="status"><h2>@(Model.Chapter?.ChapterTitle ?? "No chapters yet")</h2>
<p>No accepted manuscript text is available for this chapter. Save and successfully synchronise it using Word Companion, then refresh this page.</p>
<a class="btn btn-outline-secondary" asp-controller="@routeController" asp-action="@routeAction" asp-route-bookId="@Model.Book.BookID" asp-route-chapterId="@Model.Chapter?.ChapterID" asp-route-focus="@Model.FocusReading">Refresh manuscript</a>
</section>
}
else
{
<article class="reader-page" aria-label="Chapter manuscript">
<header><p class="eyebrow">Chapter @Model.Chapter?.ChapterNumber</p>
@if (!Model.Paragraphs[0].IsHeading)
{ <h2>@Model.Chapter?.ChapterTitle</h2> }
</header>
<partial name="~/Views/ManuscriptReader/_Paragraphs.cshtml" model="Model.Paragraphs" />
</article>
}
</div>
<footer class="reader-status muted"><p>Captured paragraph text and headings are preserved. Word formatting such as bold, italics, images and page layout is not available in this capture.</p>
<a asp-controller="Books" asp-action="Details" asp-route-id="@Model.Book.BookID">Return to Chapters</a>
<a asp-controller="@routeController" asp-action="@routeAction" asp-route-bookId="@Model.Book.BookID" asp-route-chapterId="@Model.Chapter?.ChapterID" asp-route-focus="@Model.FocusReading">Refresh manuscript</a>
</footer>
</div>