Skip to content

[FEATURE] Add "Clear All History" button with confirmation to history/page.tsx #1952

Description

@dipexplorer

Problem

apps/web/app/[locale]/history/page.tsx allows deleting entries one by one but has no bulk "Clear All" action. Users with long scan histories have to click delete dozens of times to reset, which is a frustrating UX gap.

Files to Touch

  • apps/web/app/[locale]/history/page.tsx
  • apps/web/lib/db/scanHistory.ts (may need a clearAllHistory() function)

How to Solve

  1. Check if clearAllHistory() exists in apps/web/lib/db/scanHistory.ts. If not, add it — it should delete all entries for the current user from IndexedDB/localStorage.
  2. In history/page.tsx, add a "Clear All" button in the header controls area (next to the existing Download and Sync buttons), styled with a danger/red tone.
  3. On click, show an inline confirmation (a simple boolean state toggle showing "Are you sure?" + Confirm/Cancel buttons) before clearing — avoid window.confirm() as it blocks the main thread and is inaccessible.
  4. After confirmation, call clearAllHistory() then loadHistory() to refresh the UI.
  5. The button should only be visible when history.length > 0.

Acceptance Criteria

  • "Clear All" button is visible when history is non-empty.
  • Clicking it shows an inline confirmation UI (not window.confirm()).
  • After confirmation, all history is deleted and the empty state is shown.
  • Cancel dismisses without deleting anything.
  • The button is accessible (aria-label, keyboard focusable).

⚠️ Contributor Instructions (Please Read Carefully)

  • Do NOT spam "/assign" or "Please assign me".
  • To claim this task, you MUST reply with a brief proposed implementation plan/approach. What files will you touch? How will you solve it?
  • Once your approach is reviewed and approved by a maintainer, you will be officially assigned.
  • Any PR opened without prior assignment and approach approval will be closed.

Metadata

Metadata

Assignees

Type

No type

Projects

Status
🎉 Merged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions