Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added alert when duplicate file is selected #133

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

suprajamannava17
Copy link
Collaborator

Fixes #129

What was changed?

Added an alert for duplicate file selection in OrcaDashboardComponent.js

Why was it changed?

Previously, users could upload the same file multiple times without any indication, leading to duplicate uploads.

How was it changed?

Modified onFileSelected and onUpload in OrcaDashboardComponent.js to check for duplicate files and trigger an alert if the same file is selected again.

Screenshots that show the changes (if applicable):
image

@suprajamannava17 suprajamannava17 linked an issue Feb 2, 2025 that may be closed by this pull request
2 tasks
@@ -18,14 +18,19 @@ const OrcaDashboardComponent = () => {
const isSectionsEmpty = sections.length === 0;
const [sameCriteria, setSameCriteria] = useState(false);
const [previewContent, setPreviewContent] = useState("");
const [showPreviewModal, setShowPreviewModal] = useState(false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Make sure that the spacing issue is done correctly so that it will not show many red line and green line additions.


const onFileSelected = (event) => {
const selectedFile = event.target.files[0];
if (selectedFile.type !== "text/plain") {
alert("Invalid file type. Please upload a .txt file.");
return;
}

if (uploadedFiles.includes(selectedFile.name)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Apt logic well done

Copy link
Collaborator

@bhumulanandinireddy bhumulanandinireddy left a comment

Choose a reason for hiding this comment

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

Good Work Overall. Your logic was simple and clear. Just make sure that when you are removing code or adding code keep track on lines so that it will not create any confusion while we review it later.

@bhumulanandinireddy bhumulanandinireddy merged commit ec36034 into main Feb 4, 2025
3 checks passed
@bhumulanandinireddy bhumulanandinireddy deleted the 129-choose-file-button-functionality branch February 4, 2025 17:10
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.

Choose File Button Functionality:
2 participants