Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix(photos):auth-codex-reviews

Aswin Asok04294b4efeec
diff --git a/web/apps/photos/src/components/PhotosAuthShell.tsx b/web/apps/photos/src/components/PhotosAuthShell.tsx
index d7f75d6a1e..8600661f8b 100644
--- a/web/apps/photos/src/components/PhotosAuthShell.tsx
+++ b/web/apps/photos/src/components/PhotosAuthShell.tsx
@@ -185,8 +185,6 @@ const ContentSheet = styled("section")(({ theme }) => ({
position: "relative",
zIndex: 1,
overflowY: "auto",
- scrollbarWidth: "none",
- "&::-webkit-scrollbar": { display: "none" },
boxSizing: "border-box",
borderRadius: "24px 24px 0 0",
backgroundColor: "#fff",
diff --git a/web/apps/photos/src/components/auth/Button.tsx b/web/apps/photos/src/components/auth/Button.tsx
index fb9cfbb889..c93c1fd791 100644
--- a/web/apps/photos/src/components/auth/Button.tsx
+++ b/web/apps/photos/src/components/auth/Button.tsx
@@ -15,6 +15,7 @@ export interface ButtonProps extends Omit<
variant?: ButtonVariant;
fullWidth?: boolean;
loading?: boolean;
+ loadingMessage?: React.ReactNode;
children: React.ReactNode;
}
@@ -22,6 +23,7 @@ export function Button({
variant = "primary",
fullWidth = false,
loading = false,
+ loadingMessage,
disabled,
type = "button",
children,
@@ -37,8 +39,17 @@ export function Button({
$loading={loading}
{...buttonProps}
>
- <ButtonLabel $loading={loading}>{children}</ButtonLabel>
- {loading && <CircularProgress size={20} color="inherit" />}
+ {loading && loadingMessage ? (
+ <LoadingContent>
+ <CircularProgress size={20} color="inherit" />
+ <span>{loadingMessage}</span>
+ </LoadingContent>
+ ) : (
+ <>
+ <ButtonLabel $loading={loading}>{children}</ButtonLabel>
+ {loading && <CircularProgress size={20} color="inherit" />}
+ </>
+ )}
</ButtonRoot>
);
}
@@ -99,3 +110,13 @@ const ButtonLabel = styled(
"span",
authTransientProps,
)<{ $loading: boolean }>(({ $loading }) => ({ opacity: $loading ? 0 : 1 }));
+
+const LoadingContent = styled("span")({
+ minWidth: 0,
+ display: "inline-flex",
+ alignItems: "center",
+ justifyContent: "center",
+ gap: "8px",
+ whiteSpace: "nowrap",
+ "& > .MuiCircularProgress-root": { flexShrink: 0 },
+});
diff --git a/web/apps/photos/src/components/auth/OTPField.tsx b/web/apps/photos/src/components/auth/OTPField.tsx
index 3056a19bc9..0fcb0e6a1b 100644
--- a/web/apps/photos/src/components/auth/OTPField.tsx
+++ b/web/apps/photos/src/components/auth/OTPField.tsx
@@ -111,15 +111,12 @@ export function OTPField({
} else if (event.code === "ArrowRight") {
event.preventDefault();
focusInput(index + 1);
+ } else if (event.code === "Spacebar" || event.code === "Space") {
+ event.preventDefault();
} else if (event.key === otp[index]) {
event.preventDefault();
focusInput(index + 1);
- } else if (
- event.code === "Spacebar" ||
- event.code === "Space" ||
- event.code === "ArrowUp" ||
- event.code === "ArrowDown"
- ) {
+ } else if (event.code === "ArrowUp" || event.code === "ArrowDown") {
event.preventDefault();
}
}
diff --git a/web/apps/photos/src/components/auth/SignUpForm.tsx b/web/apps/photos/src/components/auth/SignUpForm.tsx
index af259f4591..09c3114c54 100644
--- a/web/apps/photos/src/components/auth/SignUpForm.tsx
+++ b/web/apps/photos/src/components/auth/SignUpForm.tsx
@@ -155,15 +155,11 @@ export function SignUpForm({
fullWidth
type="submit"
loading={isSubmitting}
+ loadingMessage={t("key_generation_in_progress")}
disabled={isSubmitDisabled}
>
{t("create_account")}
</Button>
- {isSubmitting ? (
- <CenteredMessage>
- <Message>{t("key_generation_in_progress")}</Message>
- </CenteredMessage>
- ) : null}
<AccountPrompt>
<span>{pt("Already have an account?")}</span>
<TextLink regular onClick={onLogin}>
@@ -208,11 +204,6 @@ const TermsLink = styled("a")({
},
});
-const CenteredMessage = styled("div")({
- display: "flex",
- justifyContent: "center",
-});
-
const AccountPrompt = styled("div")({
display: "flex",
alignItems: "center",
diff --git a/web/apps/photos/src/components/auth/VerifyEmailForm.tsx b/web/apps/photos/src/components/auth/VerifyEmailForm.tsx
index 1f9a36fa9c..7cf5078993 100644
--- a/web/apps/photos/src/components/auth/VerifyEmailForm.tsx
+++ b/web/apps/photos/src/components/auth/VerifyEmailForm.tsx
@@ -45,8 +45,12 @@ export function VerifyEmailForm({
});
function handleCodeChange(code: string) {
+ const shouldAutoSubmit =
+ !completeCodePattern.test(formik.values.code) &&
+ completeCodePattern.test(code);
+
void formik.setFieldValue("code", code).then(() => {
- if (completeCodePattern.test(code) && !formik.isSubmitting) {
+ if (shouldAutoSubmit && !formik.isSubmitting) {
void formik.submitForm();
}
});