Skip to content

armgit / ente

Public Imported from GitHub
0

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

update(photos):gate-flow-behind-feature-flag

Aswin Asok10f7d2c9608b
diff --git a/web/apps/photos/src/featureFlags.ts b/web/apps/photos/src/featureFlags.ts
new file mode 100644
index 0000000000..d9204a6865
--- /dev/null
+++ b/web/apps/photos/src/featureFlags.ts
@@ -0,0 +1,3 @@
+export const featureFlags: Record<"enableNewPhotosSignupFlow", boolean> = {
+ enableNewPhotosSignupFlow: true,
+};
diff --git a/web/apps/photos/src/pages/generate.tsx b/web/apps/photos/src/pages/generate.tsx
index 14e694d02a..1aa91ea02e 100644
--- a/web/apps/photos/src/pages/generate.tsx
+++ b/web/apps/photos/src/pages/generate.tsx
@@ -1,5 +1,6 @@
import { RecoveryKeyForm } from "@/components/auth/RecoveryKeyForm";
import { PhotosAuthShell } from "@/components/PhotosAuthShell";
+import { featureFlags } from "@/featureFlags";
import type { RecoveryKeyPresentationProps } from "ente-accounts/components/RecoveryKey";
import AccountsGeneratePage from "ente-accounts/pages/generate";
import type React from "react";
@@ -15,6 +16,10 @@ function RecoveryKeyPresentation(
}
function GeneratePage(): React.JSX.Element {
+ if (!featureFlags.enableNewPhotosSignupFlow) {
+ return <AccountsGeneratePage />;
+ }
+
return (
<AccountsGeneratePage
recoveryKeyPresentation={RecoveryKeyPresentation}
diff --git a/web/apps/photos/src/pages/index.tsx b/web/apps/photos/src/pages/index.tsx
index 18ce2647c8..9e7dc91985 100644
--- a/web/apps/photos/src/pages/index.tsx
+++ b/web/apps/photos/src/pages/index.tsx
@@ -1,5 +1,6 @@
import { SignUpForm } from "@/components/auth/SignUpForm";
import { PhotosAuthShell } from "@/components/PhotosAuthShell";
+import { featureFlags } from "@/featureFlags";
import { Box, Stack, Typography, styled } from "@mui/material";
import { LoginContents } from "ente-accounts/components/LoginContents";
import { SignUpContents } from "ente-accounts/components/SignUpContents";
@@ -115,7 +116,7 @@ const Page: React.FC = () => {
<TappableContainer onMaybeChangeHost={refreshHost}>
{loading ? (
<ActivityIndicator />
- ) : !showLogin ? (
+ ) : featureFlags.enableNewPhotosSignupFlow && !showLogin ? (
<PhotosAuthShell>
<SignUpContents
{...{ router, host }}
@@ -155,10 +156,17 @@ const Page: React.FC = () => {
]}
>
<Stack sx={{ width: "320px", py: 4, gap: 4 }}>
- <LoginContents
- {...{ host }}
- onSignUp={() => setShowLogin(false)}
- />
+ {showLogin ? (
+ <LoginContents
+ {...{ host }}
+ onSignUp={() => setShowLogin(false)}
+ />
+ ) : (
+ <SignUpContents
+ {...{ router, host }}
+ onLogin={() => setShowLogin(true)}
+ />
+ )}
</Stack>
</DesktopBox>
</>
diff --git a/web/apps/photos/src/pages/signup.tsx b/web/apps/photos/src/pages/signup.tsx
index 0ba3b35e6a..ab4ffda503 100644
--- a/web/apps/photos/src/pages/signup.tsx
+++ b/web/apps/photos/src/pages/signup.tsx
@@ -1,5 +1,6 @@
import { SignUpForm } from "@/components/auth/SignUpForm";
import { PhotosAuthShell } from "@/components/PhotosAuthShell";
+import { featureFlags } from "@/featureFlags";
import type { SignUpPresentationProps } from "ente-accounts/components/SignUpContents";
import AccountsSignUpPage from "ente-accounts/pages/signup";
import type React from "react";
@@ -13,6 +14,10 @@ function SignUpPresentation(props: SignUpPresentationProps): React.JSX.Element {
}
function SignUpPage(): React.JSX.Element {
+ if (!featureFlags.enableNewPhotosSignupFlow) {
+ return <AccountsSignUpPage />;
+ }
+
return <AccountsSignUpPage presentation={SignUpPresentation} />;
}
diff --git a/web/apps/photos/src/pages/verify.tsx b/web/apps/photos/src/pages/verify.tsx
index 31ee4a6e81..c417c5fe0c 100644
--- a/web/apps/photos/src/pages/verify.tsx
+++ b/web/apps/photos/src/pages/verify.tsx
@@ -1,5 +1,6 @@
import { VerifyEmailForm } from "@/components/auth/VerifyEmailForm";
import { PhotosAuthShell } from "@/components/PhotosAuthShell";
+import { featureFlags } from "@/featureFlags";
import AccountsVerifyPage, {
type VerifyEmailPresentationProps,
} from "ente-accounts/pages/verify";
@@ -16,6 +17,10 @@ function VerifyEmailPresentation(
}
function VerifyPage(): React.JSX.Element {
+ if (!featureFlags.enableNewPhotosSignupFlow) {
+ return <AccountsVerifyPage />;
+ }
+
return <AccountsVerifyPage presentation={VerifyEmailPresentation} />;
}