feat(frontend): add document delete confirmation modal and toast noti…#484
Open
BiTech5 wants to merge 1 commit into
Open
feat(frontend): add document delete confirmation modal and toast noti…#484BiTech5 wants to merge 1 commit into
BiTech5 wants to merge 1 commit into
Conversation
|
@BiTech5 is attempting to deploy a commit to the Darshan's projects Team on Vercel. A member of the Team first needs to authorize it. |
adikulkarni006
approved these changes
Jul 2, 2026
adikulkarni006
left a comment
Collaborator
There was a problem hiding this comment.
### Approved. I checked the core logic thoroughly and ran it locally – works as expected. Great approach on the [specific feature].
Contributor
There was a problem hiding this comment.
Pull request overview
Adds safer document deletion UX to the upload panel by introducing an explicit delete action, a confirmation modal, and a success toast notification after deletion (addresses Issue #481).
Changes:
- Add a per-document delete icon that opens a confirmation modal instead of deleting immediately.
- Implement delete-confirm flow that calls
deleteDocument(...), refreshes documents, and shows a “Document deleted successfully.” toast. - Add Vitest/RTL coverage for opening/canceling the modal and confirming deletion + toast display.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| frontend/src/components/UploadPanel.jsx | Adds delete button, confirmation modal, and success toast after document deletion. |
| frontend/src/components/UploadPanel.test.jsx | Adds tests for modal open/cancel and confirm-delete behavior including toast assertion. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
66
to
+82
|
|
||
| async function handleDeleteConfirm() { | ||
| if (!documentToDelete) return; | ||
| const docId = documentToDelete.id; | ||
| try { | ||
| await deleteDocument(docId); | ||
| setShowToast(true); | ||
| setTimeout(() => { | ||
| setShowToast(false); | ||
| }, 3000); | ||
| onUploaded(); | ||
| } catch (e) { | ||
| console.error("Error deleting document:", e); | ||
| } finally { | ||
| setDocumentToDelete(null); | ||
| } | ||
| } |
Comment on lines
+152
to
+156
| <button | ||
| onClick={(e) => { e.stopPropagation(); setDocumentToDelete(d); }} | ||
| className="p-1 text-gray-400 hover:text-red-400 rounded transition" | ||
| title="Delete Document" | ||
| > |
Comment on lines
+237
to
+241
| <button | ||
| onClick={() => setShowToast(false)} | ||
| className="text-gray-500 hover:text-gray-300 text-xs font-semibold leading-none ml-2" | ||
| > | ||
| × |
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.
Added confirmation modal before deleting a document from upload panel
Related Issue
Closes #481
Type of Changes:
Screenshots: