Skip to content

armgit / ente

Public Imported from GitHub
0

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

refactor(accounts):remove-redundant-presentation-props

Aswin Asok5615938e06d6
diff --git a/web/apps/photos/src/pages/index.tsx b/web/apps/photos/src/pages/index.tsx
index 6e3a72eeac..d74f9da75a 100644
--- a/web/apps/photos/src/pages/index.tsx
+++ b/web/apps/photos/src/pages/index.tsx
@@ -1,6 +1,5 @@
import { DevSettingsDialog } from "@/components/auth/DevSettingsDialog";
import { PhotosAuthShell } from "@/components/PhotosAuthShell";
-import { SignUpForm } from "ente-accounts/components/auth/SignUpForm";
import { LoginContents } from "ente-accounts/components/LoginContents";
import { SignUpContents } from "ente-accounts/components/SignUpContents";
import { savedPartialLocalUser } from "ente-accounts/services/accounts-db";
@@ -124,7 +123,6 @@ const Page: React.FC = () => {
<SignUpContents
{...{ router, host }}
onLogin={handleShowLogin}
- presentation={SignUpForm}
/>
)}
</PhotosAuthShell>
diff --git a/web/packages/accounts/components/SecondFactorChoice.tsx b/web/packages/accounts/components/SecondFactorChoice.tsx
index 9dcad17b22..ec9f20f305 100644
--- a/web/packages/accounts/components/SecondFactorChoice.tsx
+++ b/web/packages/accounts/components/SecondFactorChoice.tsx
@@ -1,6 +1,7 @@
import type { ModalProps } from "@mui/material";
+import { SecondFactorChoiceDialog } from "ente-accounts/components/auth/SecondFactorChoiceDialog";
import type { ModalVisibilityProps } from "ente-base/components/utils/modal";
-import React, { type ComponentType } from "react";
+import type React from "react";
export type SecondFactorType = "totp" | "passkey";
@@ -12,14 +13,12 @@ export interface SecondFactorChoicePresentationProps {
type SecondFactorChoiceProps = ModalVisibilityProps & {
onSelect: (factor: SecondFactorType) => void;
- presentation: ComponentType<SecondFactorChoicePresentationProps>;
};
export const SecondFactorChoice: React.FC<SecondFactorChoiceProps> = ({
open,
onClose,
onSelect,
- presentation: Presentation,
}) => {
const handleDialogClose: ModalProps["onClose"] = (_, reason) => {
if (reason != "backdropClick") onClose();
@@ -31,7 +30,7 @@ export const SecondFactorChoice: React.FC<SecondFactorChoiceProps> = ({
};
return (
- <Presentation
+ <SecondFactorChoiceDialog
open={open}
onDialogClose={handleDialogClose}
onSelect={handleSelect}
diff --git a/web/packages/accounts/components/SignUpContents.tsx b/web/packages/accounts/components/SignUpContents.tsx
index fe3e26c870..47fcb5f7f5 100644
--- a/web/packages/accounts/components/SignUpContents.tsx
+++ b/web/packages/accounts/components/SignUpContents.tsx
@@ -1,3 +1,4 @@
+import { SignUpForm } from "ente-accounts/components/auth/SignUpForm";
import {
replaceSavedLocalUser,
saveJustSignedUp,
@@ -31,7 +32,6 @@ interface SignUpContentsProps {
router: NextRouter;
onLogin: () => void;
host: string | undefined;
- presentation: React.ComponentType<SignUpPresentationProps>;
}
export interface SignUpPresentationProps {
@@ -69,7 +69,6 @@ export const SignUpContents: React.FC<SignUpContentsProps> = ({
router,
onLogin,
host,
- presentation: Presentation,
}) => {
const [isJoinAlbumContext, setIsJoinAlbumContext] = useState(false);
@@ -183,7 +182,7 @@ export const SignUpContents: React.FC<SignUpContentsProps> = ({
}
return (
- <Presentation
+ <SignUpForm
email={formik.values.email}
password={formik.values.password}
confirmPassword={formik.values.confirmPassword}
diff --git a/web/packages/accounts/pages/credentials.tsx b/web/packages/accounts/pages/credentials.tsx
index 2e8b247649..1f1581cd50 100644
--- a/web/packages/accounts/pages/credentials.tsx
+++ b/web/packages/accounts/pages/credentials.tsx
@@ -3,7 +3,6 @@ import {
CredentialsForm,
PasswordForm,
} from "ente-accounts/components/auth/CredentialsForm";
-import { SecondFactorChoiceDialog } from "ente-accounts/components/auth/SecondFactorChoiceDialog";
import { VerifyingPasskey } from "ente-accounts/components/LoginComponents";
import { SecondFactorChoice } from "ente-accounts/components/SecondFactorChoice";
import { sessionExpiredDialogAttributes } from "ente-accounts/components/utils/dialog";
@@ -370,10 +369,7 @@ const Page: React.FC = () => {
onChangeEmail={logout}
/>
</Shell>
- <SecondFactorChoice
- {...secondFactorChoiceProps}
- presentation={SecondFactorChoiceDialog}
- />
+ <SecondFactorChoice {...secondFactorChoiceProps} />
</>
);
};
diff --git a/web/packages/accounts/pages/signup.tsx b/web/packages/accounts/pages/signup.tsx
index 91be3f87e0..25f7f4c3ff 100644
--- a/web/packages/accounts/pages/signup.tsx
+++ b/web/packages/accounts/pages/signup.tsx
@@ -1,9 +1,5 @@
import { useAuthPageConfig } from "ente-accounts/components/auth/AuthPageProvider";
-import { SignUpForm } from "ente-accounts/components/auth/SignUpForm";
-import {
- SignUpContents,
- type SignUpPresentationProps,
-} from "ente-accounts/components/SignUpContents";
+import { SignUpContents } from "ente-accounts/components/SignUpContents";
import { savedPartialLocalUser } from "ente-accounts/services/accounts-db";
import { LoadingIndicator } from "ente-base/components/loaders";
import { customAPIHost } from "ente-base/origins";
@@ -11,6 +7,7 @@ import { useRouter } from "next/router";
import React, { useCallback, useEffect, useState } from "react";
const Page: React.FC = () => {
+ const { Shell } = useAuthPageConfig();
const [loading, setLoading] = useState(true);
const [host, setHost] = useState<string | undefined>(undefined);
@@ -27,22 +24,10 @@ const Page: React.FC = () => {
return loading ? (
<LoadingIndicator />
) : (
- <SignUpContents
- {...{ router, host, onLogin }}
- presentation={ConfiguredSignUpPresentation}
- />
+ <Shell>
+ <SignUpContents {...{ router, host, onLogin }} />
+ </Shell>
);
};
export default Page;
-
-function ConfiguredSignUpPresentation(
- props: SignUpPresentationProps,
-): React.JSX.Element {
- const { Shell } = useAuthPageConfig();
- return (
- <Shell>
- <SignUpForm {...props} />
- </Shell>
- );
-}
diff --git a/web/packages/accounts/pages/verify.tsx b/web/packages/accounts/pages/verify.tsx
index e311082b91..ec967d9770 100644
--- a/web/packages/accounts/pages/verify.tsx
+++ b/web/packages/accounts/pages/verify.tsx
@@ -1,5 +1,4 @@
import { useAuthPageConfig } from "ente-accounts/components/auth/AuthPageProvider";
-import { SecondFactorChoiceDialog } from "ente-accounts/components/auth/SecondFactorChoiceDialog";
import { VerifyEmailForm } from "ente-accounts/components/auth/VerifyEmailForm";
import { VerifyingPasskey } from "ente-accounts/components/LoginComponents";
import { SecondFactorChoice } from "ente-accounts/components/SecondFactorChoice";
@@ -202,10 +201,7 @@ const Page: React.FC = () => {
onChangeEmail={logout}
/>
</Shell>
- <SecondFactorChoice
- {...secondFactorChoiceProps}
- presentation={SecondFactorChoiceDialog}
- />
+ <SecondFactorChoice {...secondFactorChoiceProps} />
</>
);
};