feat(reader): confirm bookmark creation with a success toast

The 🏷️ bookmark button (and the 'b' shortcut) saved silently — an
accidental click gave no reaction at all. addBookmark() now shows a
short success toast ('Bookmark added — <progress>') using the
existing toast system, which the reader bundle hadn't been importing.
Importing it also activates the shared fetch interceptor, so failed
reader API calls (incl. bookmark saves) surface error toasts instead
of being swallowed.
This commit is contained in:
2026-08-17 14:28:09 -04:00
parent 206db93587
commit 1a07635605
+10 -2
View File
@@ -4,6 +4,7 @@ import { Overlayer } from "@bookhoard/foliate-js/overlayer.js";
import { Alpine } from "../alpine";
import { loadSettings, saveSettings } from "./settings-manager";
import { getToken } from "../storage";
import { showToast } from "../toast";
import {
extractPdfPages,
searchPdfPages,
@@ -1959,9 +1960,16 @@ document.addEventListener("alpine:init", () => {
}),
},
);
if (resp.ok) await this.refreshBookmarks();
if (resp.ok) {
await this.refreshBookmarks();
showToast(
`Bookmark added — ${this.progressText || "current position"}`,
"success",
2500,
);
}
} catch (_e) {
/* ignore bookmark errors for now */
/* network failures surface via the toast fetch interceptor */
}
},
async deleteBookmark(id: string) {