Skip to content

Commit

Permalink
fix(RV-428): Fix change upload flow to reflect UI
Browse files Browse the repository at this point in the history
fix(RV-428): Fix change upload flow to reflect UI
  • Loading branch information
knguyenrise8 committed Dec 27, 2024
1 parent 6e251da commit 154a7d8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
19 changes: 10 additions & 9 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions frontend/src/components/ExtractUploadFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ export const ExtractUploadFile: React.FC<ExtractUploadFileProps> = ({
const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
if (event.target.files && event.target.files.length > 0) {
const files = Array.from(event.target.files);
if (files.length > 0) {
setUploadedFile([]);
clearFiles();
setHasError(false);
}
setUploadedFile(files);
const filesObj: IFilesObj = { files };
localStorage.setItem("files", JSON.stringify(filesObj));
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/FileInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export const FileInputForwardRef: React.ForwardRefRenderFunction<
}
}
setFiles(fileArr);

console.log('change')
if (onChange) onChange(e);
};

Expand Down
4 changes: 4 additions & 0 deletions frontend/src/components/UploadFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ export const Uploadfile = () => {
const file = fileList[i];
filesObj["files"].push(file);
}
if(files.length > 0) {
clearFiles();
localStorage.setItem("files", JSON.stringify('{}'));
}
localStorage.setItem("files", JSON.stringify(filesObj));
addFile(event.target?.files[0]);
}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/AnnotateTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ const AnnotateTemplate: React.FC = () => {
<UploadHeader
title="Annotate new template"
onBack={() => navigate("/new-template/upload")}
onSubmit={handleSubmit}
/>
<Divider margin="0px" />
<div className="display-flex flex-justify-center padding-top-4">
Expand Down

0 comments on commit 154a7d8

Please sign in to comment.