Skip to content

Commit

Permalink
Fix photo update UI/UX bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ewhanson committed Mar 15, 2023
1 parent daf45ca commit 653b811
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ui/src/components/auth/UploaderAuth.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function UploaderAuth() {

const onSubmit = async (event) => {
event.preventDefault();
setIsSubmitting(false);
setIsSubmitting(true);
setErrorMessage("");

try {
Expand Down
16 changes: 16 additions & 0 deletions ui/src/components/routes/UploaderLogin.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
import { MainComponentWrapper } from "../MainComponentWrapper.jsx";
import { UploaderAuth } from "../auth/UploaderAuth.jsx";
import { useUploaderAuthProtected } from "../../lib/customHooks.js";
import { route } from "preact-router";
import { constants } from "../../lib/constants.js";
import { useEffect } from "preact/hooks";

export function UploaderLogin() {
const isUploader = useUploaderAuthProtected();

useEffect(() => {
if (isUploader) {
route(constants.ROUTES.UPLOADER.DASHBOARD, true);
}
}, [isUploader]);

if (isUploader) {
return null;
}

return (
<MainComponentWrapper useFooter={true}>
<UploaderAuth />
Expand Down
6 changes: 4 additions & 2 deletions ui/src/components/uploader/PhotoUploader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,12 @@ export function PhotoUploader() {
value={file}
onInput={async (e) => {
setFile(e.target?.files[0]);
const dateTime = await tryGetDateTimeFromImage(
const currentDateTime = await tryGetDateTimeFromImage(
e.target?.files[0]
);
setDateTime(dateTime);
if (currentDateTime !== null) {
setDateTime(currentDateTime);
}
}}
className="file-input file-input-bordered w-full"
/>
Expand Down

0 comments on commit 653b811

Please sign in to comment.