Skip to content

fix(frontend): replace window.confirm with styled ConfirmModal for template deletion - #1386

Open
pixels26 wants to merge 1 commit into
LabsCrypt:mainfrom
pixels26:fix/1229-replace-window-confirm-with-styled-modal
Open

fix(frontend): replace window.confirm with styled ConfirmModal for template deletion#1386
pixels26 wants to merge 1 commit into
LabsCrypt:mainfrom
pixels26:fix/1229-replace-window-confirm-with-styled-modal

Conversation

@pixels26

Copy link
Copy Markdown

Summary

Replaces the native window.confirm() dialog in the template deletion flow with the app's styled ConfirmModal component, matching the existing destructive-action modal pattern used throughout the codebase (e.g., CancelConfirmModal for stream cancellation).

Changes

  • New: frontend/src/components/stream-creation/ConfirmModal.tsx — A reusable, general-purpose confirmation modal with configurable title, message, confirmLabel, cancelLabel, and variant (danger / warning / info) props.
  • Modified: frontend/src/components/dashboard/dashboard-view.tsx:
    • handleDeleteTemplate opens a ConfirmModal via modal state instead of calling window.confirm().
    • New handleDeleteTemplateConfirm callback performs the actual deletion after user confirmation.
    • ModalState union type extended with a deleteTemplate variant.
    • ConfirmModal rendered in the modal stack alongside existing modals.

Problem

handleDeleteTemplate used window.confirm(...) while the codebase has an established CancelConfirmModal pattern for destructive confirmations. Native confirm() dialogs are unstyleable, block the JS thread, and break visual consistency.

Solution

Generalized the CancelConfirmModal design into a lightweight ConfirmModal that can serve any destructive confirmation. Template deletion now shows the app's styled confirmation dialog.

Testing

  • TypeScript compilation passes (tsc --noEmit)
  • ESLint passes
  • No remaining window.confirm calls in dashboard-view.tsx

Closes #1229

…mplate deletion

Replace the native browser window.confirm dialog in handleDeleteTemplate
with the app's styled confirmation pattern. Adds a reusable ConfirmModal
component generalizing the CancelConfirmModal design so any destructive
action uses a consistent, styled confirmation instead of an unstyleable
native prompt.

Closes LabsCrypt#1229

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
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.

[Audit] Destructive template deletion uses a native window.confirm instead of the app's styled confirmation pattern

1 participant