-
Notifications
You must be signed in to change notification settings - Fork 12
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
Conversation
@@ -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); |
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apt logic well done
There was a problem hiding this 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.
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):