From 172f5c3999a625dea6226e4d9cda075d305d7b64 Mon Sep 17 00:00:00 2001 From: Wesley Ray Date: Mon, 24 Aug 2026 07:44:44 -0400 Subject: [PATCH] reading: finished-books widget in the rail + full list at /reading/finished MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sidebar widget (FinishedBooks.astro, next to ReadingNow) shows the 5 most recent finished books, title-only-linked to their Quotes page when one exists, with a "see all" link once there are more than 5 — that link is the sole path to the full page, which carries the fuller kobo-dashboard-style detail (duration, pages, pages/hr, gap-since-last-finish). Both fetch client-side against the new api.c0smere.net/reading/finished, same fail-closed pattern as ReadingNow. --- src/components/FinishedBooks.astro | 115 ++++++++++++++++++ src/layouts/Base.astro | 2 + src/pages/reading/finished.astro | 186 +++++++++++++++++++++++++++++ 3 files changed, 303 insertions(+) create mode 100644 src/components/FinishedBooks.astro create mode 100644 src/pages/reading/finished.astro diff --git a/src/components/FinishedBooks.astro b/src/components/FinishedBooks.astro new file mode 100644 index 0000000..7b4117c --- /dev/null +++ b/src/components/FinishedBooks.astro @@ -0,0 +1,115 @@ +--- +/** + * "Finished" — the 5 most recently finished books, with a link to the full list. + * + * import FinishedBooks from '../components/FinishedBooks.astro'; + * + * + * Data: api.c0smere.net/reading/finished — the same array /reading/finished.astro renders in + * full; this widget just takes the first 5 client-side rather than adding a ?limit param to an + * endpoint whose only other consumer wants everything. + * + * Deliberately terse, matching ReadingNow at this rail width (13rem): title + date only, no + * duration/pages/author — those live on the full page. Title links to the book's Quotes page + * only when quote_slug is present; see api.reading_finished()'s comment (grants_phlegethon.sql) + * for why a non-null slug is always a real page. + */ +--- + + + + + + diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro index b24e9b0..fc7dba8 100644 --- a/src/layouts/Base.astro +++ b/src/layouts/Base.astro @@ -6,6 +6,7 @@ import { COMMIT, BUILT_AT } from '../lib/build-info.mjs'; import NavTree from '../components/NavTree.astro'; import Toc from '../components/Toc.astro'; import ReadingNow from '../components/ReadingNow.astro'; +import FinishedBooks from '../components/FinishedBooks.astro'; import { loadNotebooks, notebookUrl } from '../lib/notebooks.mjs'; interface Props { @@ -205,6 +206,7 @@ const pageUrl = new URL(Astro.url.pathname, Astro.site); diff --git a/src/pages/reading/finished.astro b/src/pages/reading/finished.astro new file mode 100644 index 0000000..ea5fb05 --- /dev/null +++ b/src/pages/reading/finished.astro @@ -0,0 +1,186 @@ +--- +import Base from '../../layouts/Base.astro'; +--- + + +

Finished books

+ +

+ The rail on every page carries the five most recent. This is the whole list: when I + finished each one, how long it took by the device's own cumulative counter, and — where + I took any highlights — a link through to the quotes I kept. +

+ + + + + + + +