Skip to content

fix(library): inline two-stage delete confirm (replaces browser popup)#243

Merged
mrviduus merged 1 commit into
mainfrom
fix/userbook-delete-inline-confirm
May 23, 2026
Merged

fix(library): inline two-stage delete confirm (replaces browser popup)#243
mrviduus merged 1 commit into
mainfrom
fix/userbook-delete-inline-confirm

Conversation

@mrviduus
Copy link
Copy Markdown
Owner

Summary

Two visible bugs on the user-book detail page:

  1. The trash icon was a red-bordered round button — louder than the
    primary actions next to it.
  2. Clicking it raised the native browser confirm() popup, which looks
    like an alien dialog inside the app.

Both fixed by porting VocabularyPage's two-stage delete pattern.

Behavior

  • Idle: neutral icon button matching its neighbours (+, link, share).
    Hover tints red — destructive intent visible only on intent.
  • First click: button flips to a red-filled pill with an inline
    "Confirm?" label. 3 s timer reverts to idle if the user does nothing.
  • Second click within 3 s: actual deleteUserBook runs.
  • Unmount: timer cleared.

Library refresh

The pre-existing emitDataChanges(['user-books', 'shelves']) + LibraryPage's
on-mount fetch and 5 s polling already cover the refresh path; this PR
doesn't touch it.

Tests

pnpm -C apps/web build clean.

🤖 Generated with Claude Code

Two complaints from the UI:
- The trash button in the action row had a loud red-bordered circle
  visual, drawing more attention than the actual primary actions.
- Clicking it triggered the native browser confirm() popup — looks like
  an alien dialog, breaks the in-app feel.

Mirrors the existing VocabularyPage delete pattern: idle styling is
neutral (matches the neighbour icon buttons), first click arms the
action — button flips to a red-filled pill with an inline "Confirm?"
label — second click within 3 s actually deletes. The 3 s timer reverts
the arm if the user does nothing, and the timer is cleared on unmount.

Library refresh on delete continues to rely on the pre-existing
emitDataChanges(['user-books', 'shelves']) + LibraryPage's on-mount
fetch and 5s polling — that path was already in place.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mrviduus mrviduus merged commit 4587ffe into main May 23, 2026
5 checks passed
@mrviduus mrviduus deleted the fix/userbook-delete-inline-confirm branch May 23, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant