Skip to content

feat(frontend): add document delete confirmation modal and toast noti…#484

Open
BiTech5 wants to merge 1 commit into
imDarshanGK:mainfrom
BiTech5:feat/delete-confirmation
Open

feat(frontend): add document delete confirmation modal and toast noti…#484
BiTech5 wants to merge 1 commit into
imDarshanGK:mainfrom
BiTech5:feat/delete-confirmation

Conversation

@BiTech5

@BiTech5 BiTech5 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Added confirmation modal before deleting a document from upload panel

Related Issue

Closes #481

Type of Changes:

  • Adding delete button in indexed document
  • Confirmation Modal for delete operation
  • Notification Toast added

Screenshots:

image image image

@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown

@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 adikulkarni006 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

### Approved. I checked the core logic thoroughly and ran it locally – works as expected. Great approach on the [specific feature].

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
>
×
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.

[FEATURE] Add confirmation modal before deleting a document from upload panel

3 participants