fix(frontend): replace window.confirm with styled ConfirmModal for template deletion - #1386
Open
pixels26 wants to merge 1 commit into
Open
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the native
window.confirm()dialog in the template deletion flow with the app's styledConfirmModalcomponent, matching the existing destructive-action modal pattern used throughout the codebase (e.g.,CancelConfirmModalfor stream cancellation).Changes
frontend/src/components/stream-creation/ConfirmModal.tsx— A reusable, general-purpose confirmation modal with configurabletitle,message,confirmLabel,cancelLabel, andvariant(danger/warning/info) props.frontend/src/components/dashboard/dashboard-view.tsx:handleDeleteTemplateopens aConfirmModalvia modal state instead of callingwindow.confirm().handleDeleteTemplateConfirmcallback performs the actual deletion after user confirmation.ModalStateunion type extended with adeleteTemplatevariant.ConfirmModalrendered in the modal stack alongside existing modals.Problem
handleDeleteTemplateusedwindow.confirm(...)while the codebase has an establishedCancelConfirmModalpattern for destructive confirmations. Nativeconfirm()dialogs are unstyleable, block the JS thread, and break visual consistency.Solution
Generalized the
CancelConfirmModaldesign into a lightweightConfirmModalthat can serve any destructive confirmation. Template deletion now shows the app's styled confirmation dialog.Testing
tsc --noEmit)window.confirmcalls indashboard-view.tsxCloses #1229