Skip to content

perf: add confirmation dialogs to DeletePaymentButton and TimeEntryModal delete #67

@macwilling

Description

@macwilling

Problem

Two destructive actions have no confirmation step and insufficient loading feedback:

1. DeletePaymentButton (app/(admin)/invoices/[invoiceId]/DeletePaymentButton.tsx)

  • A single click on a small icon button permanently deletes a payment record
  • No confirmation step — easy to misclick in a dense UI
  • Pending state is opacity-50 only — no label change to communicate "Deleting…"
  • No window.confirm() either (it was never added) — just fires immediately

2. TimeEntryModal delete (components/time/TimeEntryModal.tsx:176)

  • "Delete" button in the edit modal footer fires immediately on click
  • No confirmation step before permanently deleting a time entry
  • A misclick in the modal footer (Cancel / Delete are adjacent) is easy

Fix

DeletePaymentButton

Replace the bare <button> with a pattern that:

  1. Shows a confirmation Dialog on first click
  2. Shows "Deleting…" text while isPending
  3. Disables both Cancel and Delete buttons while pending

TimeEntryModal delete

Add a confirmation step before handleDelete executes — either:

  • An inline useState(false) confirmation prompt within the modal footer ("Are you sure?" + Confirm/Cancel buttons replacing the Delete button), or
  • A separate small Dialog

Acceptance criteria

  • DeletePaymentButton requires a confirmation step before deleting
  • DeletePaymentButton shows a text label change while deleting (not just opacity)
  • TimeEntryModal delete requires a confirmation step
  • Both confirmations are non-blocking (Dialog, not window.confirm())
  • npm run build passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsize:SSmall effort

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions