fixed and added modal#2053
Open
MisbahAnsar wants to merge 2 commits into
Open
Conversation
Contributor
Greptile SummaryThis PR replaces
Confidence Score: 5/5The change is safe to merge — it replaces browser-native dialogs with a well-scoped React modal and toast, with correct state management and test coverage. State management around pending removal, busy guards, error recovery, and z-index layering are all correct. The only findings are minor accessibility suggestions (missing aria-describedby) that do not affect runtime behaviour. No files require special attention.
|
| Filename | Overview |
|---|---|
| packages/web/src/components/RemoveProjectConfirmModal.tsx | New confirm dialog replacing window.confirm/window.alert; focus trap is implemented via useEffect; missing aria-describedby association for the description paragraph. |
| packages/web/src/components/ProjectSidebar.tsx | Replaces window.confirm/alert with modal + toast; state management for pending removal is correct; cancelRemoveProject and confirmRemoveProject are properly memoized. |
| packages/web/src/app/globals.css | Adds confirm modal and action button styles; z-index correctly set above the backdrop (toast at 400, backdrop at 60). |
| packages/web/src/components/tests/ProjectSidebar.test.tsx | Removes window.confirm stub; adds confirm, cancel, and error-toast test cases that correctly exercise the new modal flow. |
| packages/web/src/components/tests/RemoveProjectConfirmModal.test.tsx | New test file covering focus trapping, Escape dismissal, and busy-state guard; assertions are correct. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User clicks Remove project menu item] --> B[requestRemoveProject\nclose menu, set projectPendingRemoval]
B --> C[RemoveProjectConfirmModal opens\nproject prop non-null]
C --> D{User action}
D -->|Cancel / Escape / backdrop click| E[cancelRemoveProject\nclear projectPendingRemoval]
E --> F[Modal closes]
D -->|Confirm click| G[confirmRemoveProject\nsetDeletingProjectId → busy=true]
G --> H[DELETE /api/projects/:id]
H -->|ok: true| I[setRemovedProjectIds\nsetProjectPendingRemoval null\nrouter.push or refresh]
I --> J[Modal closes, sidebar updates]
H -->|ok: false| K[showToast error message]
K --> L[setDeletingProjectId null\nModal stays open for retry]
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
packages/web/src/components/RemoveProjectConfirmModal.tsx:65-73
The description paragraph is not formally associated with the dialog. Without `aria-describedby`, screen readers may not announce the consequence text when the dialog receives focus — users relying on assistive technology would hear the title but miss the explanation of what the action does.
```suggestion
<div
ref={modalRef}
role="dialog"
aria-modal="true"
aria-labelledby="remove-project-title"
aria-describedby="remove-project-description"
className="project-settings-modal project-settings-modal--confirm"
tabIndex={-1}
onClick={(event) => event.stopPropagation()}
>
```
### Issue 2 of 2
packages/web/src/components/RemoveProjectConfirmModal.tsx:92
Pair the `aria-describedby` added to the dialog with a matching `id` on the description paragraph.
```suggestion
<p id="remove-project-description" className="project-settings-modal__confirm-body">{REMOVE_PROJECT_CONFIRM_MESSAGE}</p>
```
Reviews (2): Last reviewed commit: "fixed all the issues" | Re-trigger Greptile
Author
|
Fixed all the issues in last commit. |
Author
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 #2052
Problem: Remove project used window.confirm and window.alert.
Solution: In-app confirm modal (RemoveProjectConfirmModal) and error toasts via
useToast.issue-done-1779630023318.mp4