fix(archive): keep the Moved to Archive toast off the next events

Centred at the bottom for eight seconds, the Undo toast sat over the
events moving up into the gap an ignored or completed row left. It now
sits in the bottom-right corner, lasts four seconds, and has an OK that
closes it without undoing. On a phone there is no side to clear and the
bottom is where an event's page ends, so it goes to the top, over the
header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas WintherandClaude Opus 5.5 committed 2026-11-10 03:50:44 +01:00
1 parent 8c9812648c
commit 56e034c34e
6 files changed
+79 -24

No files matched your search

+25 -16
View File
@@ -69,6 +69,7 @@ import { ENTRIES, NOTES, newestId, unseen } from "../shared/changelog.ts";
import {
ARCHIVE_COLLAPSE_MS,
ARCHIVE_HOLD_MS,
ARCHIVE_UNDO_MS,
ChecklistEvent,
leavingMarks,
LedgerColumns,
@@ -498,7 +499,7 @@ function ReaderContent({
() => setTransition((t) => (t ? { ...t, phase: "hidden" } : null)),
ARCHIVE_COLLAPSE_MS,
);
const undo = setTimeout(() => setTransition(null), 8000);
const undo = setTimeout(() => setTransition(null), ARCHIVE_UNDO_MS);
return () => {
clearTimeout(t);
clearTimeout(collapse);
@@ -1137,21 +1138,29 @@ function ReaderContent({
transition.phase === "hold" && (
<Fireworks key={transition.key} />
)}
{transition.label} “{transition.title}” · Moved to Archive{" "}
<button
type="button"
onClick={() => {
void dispatch({
type: "restore",
accountId: transition.accountId,
eventId: transition.eventId,
...actionMeta(),
});
setTransition(null);
}}
>
Undo
</button>
<span className="archive-toast-text">
{transition.label} “{transition.title}” · Moved to Archive
</span>
<span className="archive-toast-actions">
<button
type="button"
onClick={() => {
void dispatch({
type: "restore",
accountId: transition.accountId,
eventId: transition.eventId,
...actionMeta(),
});
setTransition(null);
}}
>
Undo
</button>
{/* Closes the notice only: the event stays archived. */}
<button type="button" onClick={() => setTransition(null)}>
OK
</button>
</span>
</aside>
)}
{archivedOpen && (