Replace native window.alert/confirm with app-styled dialogs#263
Open
luojiyin1987 wants to merge 12 commits into
Open
Replace native window.alert/confirm with app-styled dialogs#263luojiyin1987 wants to merge 12 commits into
luojiyin1987 wants to merge 12 commits into
Conversation
Introduces useAppDialog() hook backed by a Zustand queue. Supports Promise-based alert() and confirm() with variant styling (default/destructive) so callers can await user interaction instead of blocking on window.alert/confirm.
Global dialog renderer that consumes the app-dialog store queue. Mounts once in App.tsx and serially displays alert/confirm dialogs using the existing shadcn/ui Dialog primitive.
Mounts AppDialogHost in all three render paths (loading, welcome, project) and replaces the two window.alert calls with await alert() for consistent dialog styling.
Converts handleCancelAll to async and replaces window.confirm with await confirm() using destructive variant for cancel operations.
Replaces delete-failure window.alert with alert() and adds useAppDialog import.
Replaces web-search-not-configured window.alert with await alert() in handleStartResearch.
Replaces orphan-page delete confirmation with await confirm() and uses destructive variant for the delete action.
Replaces web-search-not-configured window.alert with await alert() in the deep-research action handler.
Replaces the two bare alert() calls (browser-open fallback) with await alert() for consistent dialog styling.
Replaces delete-failure and delete-folder-failure window.alert calls with await alert().
# Conflicts: # src/components/layout/research-panel.tsx # src/components/lint/lint-view.tsx # src/components/review/review-view.tsx
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.
Fixes #262
Summary
Replaces all native
window.alert()andwindow.confirm()calls with an app-styled dialog system built on the existingshadcn/ui Dialogprimitive.What's new
src/stores/app-dialog-store.ts— Zustand store that manages a FIFO queue of dialog requests. Exposesalert(options)andconfirm(options)as Promise-based APIs.src/components/ui/app-dialog-host.tsx— Global dialog renderer mounted inApp.tsx. Consumes the queue and renders one dialog at a time.Migrated call sites
App.tsxwindow.alert×2await alert()activity-panel.tsxwindow.confirmawait confirm({ confirmVariant: "destructive" })knowledge-tree.tsxwindow.alertawait alert()research-panel.tsxwindow.alertawait alert()lint-view.tsxwindow.confirmawait confirm({ confirmVariant: "destructive" })review-view.tsxwindow.alertawait alert()about-section.tsxalert()×2await alert()sources-view.tsxwindow.alert×2await alert()Design decisions
window.alert(msg)→await alert({ message: msg })showCloseButton={false}on confirm dialogs so users must explicitly choose an actionTest plan
npm run typecheckpassesnpm run test:mockspassesCommits
Each file is committed separately for clean history:
feat: add app-dialog storefeat: add AppDialogHost componentrefactor(App)refactor(activity-panel)refactor(knowledge-tree)refactor(research-panel)refactor(lint-view)refactor(review-view)refactor(about-section)refactor(sources-view)