Skip to content

armgit / ente

Public Imported from GitHub
0

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

refactor(auth):remove-single-use-page-shell-helper

Aswin Asok74253ccd9d33
diff --git a/web/apps/photos/src/auth-page-config.ts b/web/apps/photos/src/auth-page-config.ts
index 1b2914943b..bc04d25e78 100644
--- a/web/apps/photos/src/auth-page-config.ts
+++ b/web/apps/photos/src/auth-page-config.ts
@@ -1,7 +1,6 @@
-import { PasskeyVerificationForm } from "@/components/auth/PasskeyVerificationForm";
+import { PasskeyVerificationPresentation } from "@/components/auth/PasskeyVerificationForm";
import { PhotosAuthShell } from "@/components/PhotosAuthShell";
import type { AuthPageConfig } from "ente-accounts/components/auth/AuthPageProvider";
-import { withAuthPageShell } from "ente-accounts/components/auth/withAuthPageShell";
export const authPageConfig: AuthPageConfig = {
encryptWithRecoveryKey: async (data) => {
@@ -11,8 +10,5 @@ export const authPageConfig: AuthPageConfig = {
},
Shell: PhotosAuthShell,
recoveryKeyCloseDestination: "/plan",
- passkeyPresentation: withAuthPageShell(
- PasskeyVerificationForm,
- PhotosAuthShell,
- ),
+ passkeyPresentation: PasskeyVerificationPresentation,
};
diff --git a/web/apps/photos/src/components/auth/PasskeyVerificationForm.tsx b/web/apps/photos/src/components/auth/PasskeyVerificationForm.tsx
index b68f19117c..191e8d4e37 100644
--- a/web/apps/photos/src/components/auth/PasskeyVerificationForm.tsx
+++ b/web/apps/photos/src/components/auth/PasskeyVerificationForm.tsx
@@ -1,3 +1,4 @@
+import { PhotosAuthShell } from "@/components/PhotosAuthShell";
import { InformationCircleIcon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import { CircularProgress, styled } from "@mui/material";
@@ -15,6 +16,16 @@ import { t } from "i18next";
import type React from "react";
import { Trans } from "react-i18next";
+export function PasskeyVerificationPresentation(
+ props: VerifyingPasskeyPresentationProps,
+): React.JSX.Element {
+ return (
+ <PhotosAuthShell>
+ <PasskeyVerificationForm {...props} />
+ </PhotosAuthShell>
+ );
+}
+
export function PasskeyVerificationForm({
email,
host,
diff --git a/web/packages/accounts/components/auth/withAuthPageShell.tsx b/web/packages/accounts/components/auth/withAuthPageShell.tsx
deleted file mode 100644
index 54ec4cc098..0000000000
--- a/web/packages/accounts/components/auth/withAuthPageShell.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import type { ComponentType, JSX, PropsWithChildren } from "react";
-
-interface AuthShellProps extends PropsWithChildren {
- contentWidth?: 400 | 420;
-}
-
-// Compose at module scope so rerenders preserve form state and focus.
-export function withAuthPageShell<Props extends object>(
- Form: ComponentType<Props>,
- Shell: ComponentType<AuthShellProps>,
- contentWidth?: AuthShellProps["contentWidth"],
-): ComponentType<Props> {
- return function AuthPresentation(props: Props): JSX.Element {
- return (
- <Shell contentWidth={contentWidth}>
- <Form {...props} />
- </Shell>
- );
- };
-}