65 lines
4.4 KiB
Plaintext

@model PlotLine.Services.Manuscript.ManuscriptReaderModel
@{
ViewData["Title"] = $"Manuscript Reader · {Model.Book.BookTitle}";
ViewData["DesktopLayout"] = "details";
}
<link rel="stylesheet" href="~/css/manuscript-reader.css" asp-append-version="true" />
<div class="manuscript-reader">
<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-action="Index" asp-route-bookId="@Model.Book.BookID" asp-route-chapterId="@previous" rel="prev">← Previous chapter</a> }
else { <span class="btn btn-outline-secondary disabled" aria-disabled="true">← Previous chapter</span> }
<form method="get" asp-action="Index">
<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-action="Index" asp-route-bookId="@Model.Book.BookID" asp-route-chapterId="@next" 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="false" hidden>Focus reading</button>
</nav>
<p class="reader-status" role="status" id="reader-loading" hidden>Loading chapter…</p>
<div class="reader-status muted">
@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 the latest accepted server text. Refresh to read newly synchronised changes.</p>
</div>
@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-action="Index" asp-route-bookId="@Model.Book.BookID" asp-route-chapterId="@Model.Chapter?.ChapterID">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="_Paragraphs" model="Model.Paragraphs" />
</article>
}
<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-action="Index" asp-route-bookId="@Model.Book.BookID" asp-route-chapterId="@Model.Chapter?.ChapterID">Refresh manuscript</a>
</footer>
</div>
<script src="~/js/manuscript-reader.js" asp-append-version="true" defer></script>