af07314bb6
Uncommitted work from three design runs on this branch, against one design system: docs/design-system.md is updated to match the CSS, not the reverse. Library (Reader-facing): - .chrome sticks at top: 0. Search and the tab row were unreachable three screens into a 300-item library, which is exactly where they earn their keep; everything above them still scrolls away on purpose. - One :focus-visible ring (2px --paper) on the nine controls that defined none and fell back to the UA blue. .searchbar keeps its border recolour as a resting cue but no longer stands in for a ring. - Mono labels lift 10px -> 11px everywhere. The brief names night reading and glare as the usage scene; 10px small-caps was where taste overrode it. - A card in flight past 2s says "Saving..." and carries aria-busy. htmx sets neither, so the wait up to its 15s timeout was silent in both channels. - Titles clamp at 3 lines; .is-new .title takes width: fit-content, or -webkit-box stretches the ember underline past the text it sizes to. /admin: - Overview routes into Lanes when a lane is unhealthy, prefixes each figure with its column word on the phone layout that drops the thead, labels state cells for a screen reader, and has an empty state where the sites table assumed rows. - The admin shell picks up the library's chrome: htmx 15s timeout, the shared #notice slot, #sr-announce, filter.js. admin.css follows the same pass. - admin_render_test.go and card_render_test.go render the templates directly, so markup regressions in either surface fail without a browser. Login: - DISCORD_GUILD_NAME (optional) names the community on the login screen and in the refusal message, so a stranger knows which Discord to ask for an invite. Unset degrades to a generic label; neither form names the guild id. Handlers: - maxChapterNum (9999) bounds both typed-chapter paths. uiChapter and adminSeriesCorrectLatest each parsed a float64 with no ceiling, so a hand-rolled POST stored 1e308 and every later reader of that row inherited it. Matches the max on the card's chapter input. go test ./... green.
138 lines
7.2 KiB
HTML
138 lines
7.2 KiB
HTML
{{define "card"}}
|
|
{{/* One sheet per series. is-new turns the title crimson over an ember rule;
|
|
is-dim sinks archived rows into italic grey. */}}
|
|
<article class="card{{if eq .Status "reading"}}{{if .HasNewChapter}} is-new{{end}}{{else}} is-dim{{end}}"
|
|
id="card-{{.Key}}" data-title="{{.Title}}">
|
|
<div class="row">
|
|
<a class="cover" href="{{.ContinueURL}}" target="_blank" rel="noopener noreferrer"
|
|
tabindex="-1" aria-hidden="true">
|
|
{{/* aria-hidden on the cover link is not enough — Chromium still exposes
|
|
the letter because the link is programmatically focusable — so the
|
|
monogram carries its own, same as the recent strip's.
|
|
|
|
The monogram is always in the DOM under the image, not only when no
|
|
cover was acquired: a stored cover that 404s or a phone that drops
|
|
the request otherwise leaves the browser's broken-image glyph in a
|
|
93px slot. onerror removes the image and the letter is already
|
|
there. */}}
|
|
{{if .Cover}}<img src="{{.Cover}}" alt="" loading="lazy" onerror="this.remove()">{{end}}
|
|
<span class="monogram" aria-hidden="true">{{.Initial}}</span>
|
|
{{if and (eq .Status "reading") .HasNewChapter}}<span class="foot-rule"></span>
|
|
{{else if .Favorite}}<span class="foot-rule brass"></span>{{end}}
|
|
</a>
|
|
<div class="body">
|
|
<div class="title-line">
|
|
<h3 class="title">{{.Title}}</h3>
|
|
{{if .Favorite}}
|
|
<svg class="fav-mark" viewBox="0 0 24 24" aria-label="Favourite" role="img"><use href="#i-star-on"/></svg>
|
|
{{end}}
|
|
</div>
|
|
<p class="meta">
|
|
<span class="site-{{.Site}}">{{.Site}}</span>
|
|
<span class="sep">/</span>
|
|
<span class="chapter">{{.DisplayChapter}}</span>
|
|
{{if and (eq .Status "reading") .HasNewChapter}}
|
|
<span class="sep">/</span>
|
|
<span class="new-chapter">{{.DisplayLatest}} out</span>
|
|
{{end}}
|
|
{{if eq .Status "archived"}}
|
|
<span class="sep">/</span>
|
|
<span class="state">archived</span>
|
|
{{end}}
|
|
{{if .Finished}}
|
|
<span class="sep">/</span>
|
|
<span class="state finished">finished</span>
|
|
{{end}}
|
|
</p>
|
|
</div>
|
|
<div class="actions">
|
|
<a class="play" href="{{.ContinueURL}}" target="_blank" rel="noopener noreferrer"
|
|
title="Continue reading" aria-label="Continue reading">
|
|
<svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-play"/></svg>
|
|
</a>
|
|
<button class="fav{{if .Favorite}} on{{end}}"
|
|
title="{{if .Favorite}}Remove from favourites{{else}}Add to favourites{{end}}"
|
|
aria-label="{{if .Favorite}}Remove from favourites{{else}}Add to favourites{{end}}"
|
|
aria-pressed="{{if .Favorite}}true{{else}}false{{end}}"
|
|
hx-post="/ui/bookmarks/{{.Key}}/favorite"
|
|
hx-target="[id='card-{{.Key}}']" hx-swap="outerHTML"
|
|
hx-indicator="[id='card-{{.Key}}']" hx-disabled-elt="this">
|
|
<svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-star{{if .Favorite}}-on{{end}}"/></svg>
|
|
</button>
|
|
<button class="pencil" title="Set chapter" aria-label="Set chapter" aria-expanded="false" aria-controls="chapter-form-{{.Key}}"
|
|
onclick="toggleChapterForm('{{.Key}}')">
|
|
<svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-pencil"/></svg>
|
|
</button>
|
|
{{/* Restore is a reversal, so it fires straight away; every move *out* of
|
|
the list (archive, remove) goes through a confirm row. */}}
|
|
{{if eq .Status "reading"}}
|
|
<button class="lifecycle box" title="Archive" aria-label="Archive"
|
|
aria-expanded="false" aria-controls="confirm-archive-{{.Key}}"
|
|
onclick="toggleConfirmRow('{{.Key}}', 'archive')">
|
|
<svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-box"/></svg>
|
|
</button>
|
|
{{else}}
|
|
<button class="lifecycle restore" title="Restore to reading" aria-label="Restore to reading"
|
|
hx-post="/ui/bookmarks/{{.Key}}/status" hx-vals='{"status":"reading"}'
|
|
hx-target="[id='card-{{.Key}}']" hx-swap="outerHTML"
|
|
hx-indicator="[id='card-{{.Key}}']" hx-disabled-elt="this">
|
|
<svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-undo"/></svg>
|
|
</button>
|
|
{{end}}
|
|
<button class="lifecycle remove" title="Remove" aria-label="Remove"
|
|
aria-expanded="false" aria-controls="confirm-remove-{{.Key}}"
|
|
onclick="toggleConfirmRow('{{.Key}}', 'remove')">
|
|
<svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-trash"/></svg>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<form class="chapter-form" id="chapter-form-{{.Key}}" hidden
|
|
hx-post="/ui/bookmarks/{{.Key}}/chapter"
|
|
hx-target="[id='card-{{.Key}}']" hx-swap="outerHTML"
|
|
hx-indicator="[id='card-{{.Key}}']" hx-disabled-elt="input, button">
|
|
{{/* The field holds your progress; "Latest known" is the published chapter.
|
|
Those are different numbers whenever this form is worth opening, so the
|
|
label names the field and the latest sits after it as context. */}}
|
|
<label class="hint" for="chapter-{{.Key}}">Chapter you're on</label>
|
|
<div class="field">
|
|
{{/* max is a fat-finger guard, not a real ceiling — no series is near it.
|
|
step is "any" because the server accepts any float and the field is
|
|
pre-filled from it: under step=0.1 a series read to 1200.25 opened a
|
|
form that refused its own value. */}}
|
|
<input id="chapter-{{.Key}}" name="chapter" type="number" step="any" min="0" max="9999"
|
|
value="{{.LastChapterNum}}" required>
|
|
<button type="submit">Save</button>
|
|
</div>
|
|
{{if .LatestChapter}}<p class="hint">Latest known: {{.DisplayLatest}}</p>{{end}}
|
|
</form>
|
|
{{/* One confirm row per way a series leaves the list. aria-live announces the
|
|
step to a screen reader, which otherwise gets no word that the tap
|
|
opened a second question. */}}
|
|
{{if eq .Status "reading"}}
|
|
<div class="confirm-row calm" id="confirm-archive-{{.Key}}" role="group" aria-live="polite" hidden>
|
|
<span>Archive this?</span>
|
|
<div>
|
|
<button class="go"
|
|
hx-post="/ui/bookmarks/{{.Key}}/status" hx-vals='{"status":"archived"}'
|
|
hx-target="[id='card-{{.Key}}']" hx-swap="outerHTML"
|
|
hx-indicator="[id='card-{{.Key}}']" hx-disabled-elt="this">Archive</button>
|
|
<button type="button" onclick="toggleConfirmRow('{{.Key}}', 'archive')">Cancel</button>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
<div class="confirm-row" id="confirm-remove-{{.Key}}" role="group" aria-live="polite" hidden>
|
|
<span>Remove “{{.Title}}”? Chapter progress is lost.</span>
|
|
<div>
|
|
<button class="danger-solid"
|
|
hx-delete="/ui/bookmarks/{{.Key}}"
|
|
hx-target="[id='card-{{.Key}}']" hx-swap="outerHTML"
|
|
hx-indicator="[id='card-{{.Key}}']" hx-disabled-elt="this">Remove</button>
|
|
<button type="button" onclick="toggleConfirmRow('{{.Key}}', 'remove')">Cancel</button>
|
|
</div>
|
|
</div>
|
|
{{/* role=status announces a failed write; without it the tap just looks
|
|
ignored to a screen reader. */}}
|
|
<p class="error-inline" role="status" hidden></p>
|
|
</article>
|
|
{{end}}
|