Skip to content

armgit / ente

Public Imported from GitHub
0

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

refractor(photos):use-shared-presentational-layer

Aswin Asokfc42ad3facae
diff --git a/web/apps/photos/src/components/PhotosAuthShell.tsx b/web/apps/photos/src/components/PhotosAuthShell.tsx
index 4ce6094f67..bcadcb729b 100644
--- a/web/apps/photos/src/components/PhotosAuthShell.tsx
+++ b/web/apps/photos/src/components/PhotosAuthShell.tsx
@@ -1,473 +1,49 @@
-import { Tick02Icon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
-import { GlobalStyles, keyframes, styled } from "@mui/material";
-import { EnteLogo } from "ente-base/components/EnteLogo";
+import { AuthPageShell } from "ente-accounts/components/auth/AuthPageShell";
+import type { AuthPresentationConfig } from "ente-accounts/components/auth/styles";
import { t } from "i18next";
import type React from "react";
-import {
- authAboveMobileMediaQuery,
- authColorVariables,
- authDisplayFontFamily,
- authMobileMediaQuery,
-} from "./auth/styles";
interface PhotosAuthShellProps extends React.PropsWithChildren {
contentWidth?: 400 | 420;
}
-export const PhotosAuthShell: React.FC<PhotosAuthShellProps> = ({
- children,
- contentWidth = 400,
-}) => (
- <PageRoot>
- <GlobalStyles styles={authColorVariables} />
- <FrameCurves />
- <PageCard>
- <DesktopBrandSlot>
- <BrandPanel
- headline={t("photos_auth_headline")}
- size="desktop"
- />
- </DesktopBrandSlot>
- <TabletBrandSlot>
- <BrandPanel
- headline={t("photos_auth_headline")}
- size="tablet"
- />
- </TabletBrandSlot>
- <MobileBrandSlot>
- <BrandPanel
- headline={t("photos_auth_headline")}
- size="mobile"
- />
- </MobileBrandSlot>
- <ContentSheet>
- <SheetHandle />
- <ContentColumn contentWidth={contentWidth}>
- {children}
- </ContentColumn>
- </ContentSheet>
- </PageCard>
- </PageRoot>
-);
-
-const shellReveal = keyframes({
- from: { opacity: 0, transform: "translateY(18px)" },
- to: { opacity: 1, transform: "translateY(0)" },
-});
-
-const brandCopyReveal = keyframes({
- from: { opacity: 0, transform: "translateY(12px)" },
- to: { opacity: 1, transform: "translateY(0)" },
-});
-
-const illustrationReveal = keyframes({
- from: { opacity: 0, transform: "translateY(18px) scale(0.98)" },
- to: { opacity: 1, transform: "translateY(0) scale(1)" },
-});
-
-const cameraSparkle = keyframes({
- from: {
- opacity: 0,
- transform: "translate(-50%, -50%) scale(0) rotate(-20deg)",
- },
- "35%": {
- opacity: 1,
- transform: "translate(-50%, -50%) scale(1) rotate(0)",
- },
- "70%": {
- opacity: 0.85,
- transform: "translate(-50%, -50%) scale(0.72) rotate(24deg)",
- },
- to: {
- opacity: 0,
- transform: "translate(-50%, -50%) scale(1.3) rotate(45deg)",
- },
-});
-
-const brandCurvesDrift = keyframes({
- "0%, 100%": {
- backgroundPosition: "0 0, calc(50% - 6px) calc(50% + 4px), 0 0",
- },
- "50%": { backgroundPosition: "0 0, calc(50% + 6px) calc(50% - 4px), 0 0" },
-});
-
-const brandCopyAnimation = {
- animation: `${brandCopyReveal} 520ms cubic-bezier(0.22, 1, 0.36, 1) both`,
- "@media (prefers-reduced-motion: reduce)": { animation: "none" },
+const photosAuthTheme: AuthPresentationConfig = {
+ primary: "#08c225",
+ primaryHover: "#069d1e",
+ primaryActive: "#057c18",
+ focus: "#08c225",
+ focusDark: "#08c225",
+ link: "#08c225",
+ linkDark: "#08c225",
+ termsLink: "#08c225",
+ termsLinkDark: "#08c225",
+ passwordMessage: "#000",
+ passwordMessageDark: "#fff",
+ textDisabledDark: "#4d4d4d",
+ wideGamutPrimary: "color(display-p3 0.03137 0.76078 0.1451)",
+ mobileBrandHeight: 196,
+ illustrationHeights: { desktop: 219, tablet: 172, mobile: 127, wide: 249 },
};
-interface BrandPanelProps {
- headline: string;
- size: "desktop" | "tablet" | "mobile";
+export function PhotosAuthShell({
+ children,
+ contentWidth,
+}: PhotosAuthShellProps): React.JSX.Element {
+ return (
+ <AuthPageShell
+ brand={{
+ headline: t("photos_auth_headline"),
+ subtitle: t("photos_auth_subtitle"),
+ bullets: [
+ t("photos_auth_free_storage"),
+ t("photos_auth_no_ads_no_spying"),
+ t("auth_independently_audited"),
+ ],
+ }}
+ presentationConfig={photosAuthTheme}
+ contentWidth={contentWidth}
+ >
+ {children}
+ </AuthPageShell>
+ );
}
-
-const BrandPanel: React.FC<BrandPanelProps> = ({ headline, size }) => (
- <BrandPanelRoot size={size}>
- <Wordmark size={size}>
- <EnteLogo />
- </Wordmark>
- <PanelCopy size={size}>
- <PanelHeadline size={size}>{headline}</PanelHeadline>
- {size !== "mobile" && (
- <PanelSubtitle size={size}>
- {t("photos_auth_subtitle")}
- </PanelSubtitle>
- )}
- {size === "desktop" && (
- <BulletList>
- {[
- t("photos_auth_free_storage"),
- t("photos_auth_no_ads_no_spying"),
- t("auth_independently_audited"),
- ].map((bullet) => (
- <Bullet key={bullet}>
- <CheckCircle aria-hidden="true">
- <HugeiconsIcon
- icon={Tick02Icon}
- size={12}
- strokeWidth={3}
- />
- </CheckCircle>
- <span>{bullet}</span>
- </Bullet>
- ))}
- </BulletList>
- )}
- </PanelCopy>
- <IllustrationClip size={size}>
- <img src="/images/auth-ducky.svg" alt="" />
- </IllustrationClip>
- </BrandPanelRoot>
-);
-
-const PageRoot = styled("main")(({ theme }) => ({
- width: "100%",
- height: "100svh",
- minHeight: "100svh",
- display: "flex",
- position: "relative",
- overflow: "hidden",
- boxSizing: "border-box",
- backgroundColor: "#f4f4f4",
- ...theme.applyStyles("dark", { backgroundColor: "#0a0a0a" }),
- [authAboveMobileMediaQuery]: { padding: "40px" },
- "@media (min-width: 1024px)": {
- padding: 0,
- alignItems: "center",
- justifyContent: "center",
- },
-}));
-
-const FrameCurves = styled("div")(({ theme }) => ({
- display: "none",
- opacity: 0.3,
- ...theme.applyStyles("dark", { opacity: 0.02 }),
- [authAboveMobileMediaQuery]: {
- display: "block",
- position: "absolute",
- inset: 0,
- backgroundImage: 'url("/images/auth-frame-curves.svg")',
- backgroundRepeat: "no-repeat",
- backgroundSize: "cover",
- backgroundPosition: "center",
- pointerEvents: "none",
- },
-}));
-
-const PageCard = styled("div")(({ theme }) => ({
- width: "100%",
- height: "100%",
- minHeight: 0,
- display: "flex",
- flexDirection: "column",
- position: "relative",
- overflow: "hidden",
- backgroundColor: "#fff",
- animation: `${shellReveal} 620ms cubic-bezier(0.22, 1, 0.36, 1) both`,
- ...theme.applyStyles("dark", { backgroundColor: "#252525" }),
- "@media (prefers-reduced-motion: reduce)": { animation: "none" },
- [authAboveMobileMediaQuery]: { borderRadius: "24px" },
- "@media (min-width: 1024px)": {
- width: "1032px",
- height: "min(780px, 100%)",
- flexDirection: "row",
- },
- "@media (min-width: 1600px)": {
- width: "1240px",
- height: "min(900px, 100%)",
- },
-}));
-
-const DesktopBrandSlot = styled("div")({
- display: "none",
- "@media (min-width: 1024px)": {
- display: "block",
- flex: "0 0 440px",
- height: "100%",
- },
- "@media (min-width: 1600px)": { flexBasis: "496px" },
-});
-
-const TabletBrandSlot = styled("div")({
- display: "none",
- [`${authAboveMobileMediaQuery} and (max-width: 1023px)`]: {
- display: "block",
- // Grows with the copy when it wraps at narrow widths; the band's
- // 268px design height is enforced as a minimum by BrandPanelRoot.
- flex: "0 0 auto",
- position: "relative",
- overflow: "hidden",
- },
-});
-
-const MobileBrandSlot = styled("div")({
- display: "block",
- flex: "0 0 196px",
- minHeight: 0,
- position: "relative",
- overflow: "hidden",
- [authAboveMobileMediaQuery]: { display: "none" },
-});
-
-const ContentSheet = styled("section")(({ theme }) => ({
- flex: 1,
- minHeight: 0,
- marginTop: "-28px",
- padding: "40px 24px 24px",
- display: "flex",
- flexDirection: "column",
- gap: "24px",
- position: "relative",
- zIndex: 1,
- overflowY: "auto",
- boxSizing: "border-box",
- borderRadius: "24px 24px 0 0",
- backgroundColor: "#fff",
- ...theme.applyStyles("dark", { backgroundColor: "#252525" }),
- [authAboveMobileMediaQuery]: {
- marginTop: "-32px",
- padding: "16px 48px 48px",
- },
- "@media (min-width: 1024px)": {
- width: "592px",
- marginTop: 0,
- padding: "48px 96px",
- alignItems: "center",
- justifyContent: "center",
- borderRadius: 0,
- },
- "@media (min-width: 1600px)": { width: "744px", padding: "56px 172px" },
-}));
-
-const SheetHandle = styled("div")({
- width: "36px",
- height: "4px",
- flexShrink: 0,
- alignSelf: "center",
- borderRadius: "999px",
- backgroundColor: "var(--photos-auth-fill-active)",
- [authMobileMediaQuery]: { display: "none" },
- "@media (min-width: 1024px)": { display: "none" },
-});
-
-const ContentColumn = styled("div", {
- shouldForwardProp: (prop) => prop !== "contentWidth",
-})<{ contentWidth: 400 | 420 }>(({ contentWidth }) => ({
- width: "100%",
- minHeight: "min-content",
- display: "flex",
- flexDirection: "column",
- gap: "24px",
- [authMobileMediaQuery]: { flexGrow: 1 },
- [authAboveMobileMediaQuery]: {
- width: "440px",
- maxWidth: "100%",
- marginBlock: "auto",
- alignSelf: "center",
- },
- "@media (min-width: 1024px)": { width: `${contentWidth}px` },
- "@media (min-width: 1600px)": { gap: "28px" },
-}));
-
-const BrandPanelRoot = styled("div", {
- shouldForwardProp: (prop) => prop !== "size",
-})<{ size: BrandPanelProps["size"] }>(({ size }) => ({
- width: "100%",
- height: size === "tablet" ? "auto" : "100%",
- ...(size === "tablet" && { minHeight: "268px", rowGap: "24px" }),
- padding:
- size === "desktop"
- ? "44px"
- : size === "tablet"
- ? "40px 40px 60px"
- : "18px 16px 40px",
- display: "flex",
- flexDirection: "column",
- justifyContent: size === "desktop" ? "flex-start" : "space-between",
- position: "relative",
- overflow: "hidden",
- boxSizing: "border-box",
- color: "#fff",
- backgroundColor: "var(--photos-auth-primary)",
- backgroundImage: `url("/images/auth-surface-noise.svg"), url("/images/auth-frame-curves.svg"), url("${greenTileP3}")`,
- backgroundRepeat: "repeat, no-repeat, repeat",
- backgroundPosition: "0 0, center, 0 0",
- backgroundSize: "auto, cover, auto",
- animation: `${brandCurvesDrift} 20s ease-in-out infinite`,
- "@media (prefers-reduced-motion: reduce)": { animation: "none" },
-}));
-
-/* 1x1 Display-P3 PNG tiled so the brand green renders in P3 on capable
- screens; the #08c225 background color is the sRGB fallback. */
-const greenTileP3 =
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACXBIWXMAAAsTAAALEwEAmpwYAAABaWlDQ1BEaXNwbGF5IFAzAAB4nHWQvUvDUBTFT6tS0DqIDh0cMolD1NIKdnFoKxRFMFQFq1OafgltfCQpUnETVyn4H1jBWXCwiFRwcXAQRAcR3Zw6KbhoeN6XVNoi3sfl/Ticc7lcwBtQGSv2AijplpFMxKS11Lrke4OHnlOqZrKooiwK/v276/PR9d5PiFlNu3YQ2U9cl84ul3aeAlN//V3Vn8maGv3f1EGNGRbgkYmVbYsJ3iUeMWgp4qrgvMvHgtMunzuelWSc+JZY0gpqhrhJLKc79HwHl4plrbWD2N6f1VeXxRzqUcxhEyYYilBRgQQF4X/8044/ji1yV2BQLo8CLMpESRETssTz0KFhEjJxCEHqkLhz634PrfvJbW3vFZhtcM4v2tpCAzidoZPV29p4BBgaAG7qTDVUR+qh9uZywPsJMJgChu8os2HmwiF3e38M6Hvh/GMM8B0CdpXzryPO7RqFn4Er/QcXKWq8MSlPPgAAABBJREFUeAEBBQD6/wAIwiX/A7QB7/maltEAAAAASUVORK5CYII=";
-
-const Wordmark = styled("div", {
- shouldForwardProp: (prop) => prop !== "size",
-})<{ size: BrandPanelProps["size"] }>(({ size }) => ({
- width: size === "desktop" ? "83px" : size === "tablet" ? "77px" : "64px",
- height: size === "desktop" ? "26px" : size === "tablet" ? "24px" : "20px",
- flexShrink: 0,
- margin: size === "mobile" ? "8px 0 0 8px" : 0,
- lineHeight: 0,
- position: "relative",
- zIndex: 1,
- "& > svg": { width: "100%", height: "100%" },
-}));
-
-const PanelCopy = styled("div", {
- shouldForwardProp: (prop) => prop !== "size",
-})<{ size: BrandPanelProps["size"] }>(({ size }) => ({
- marginTop: size === "desktop" ? "52px" : 0,
- marginLeft: size === "mobile" ? "8px" : 0,
- // On the tablet band the ducky is anchored to the right edge, so keep
- // the copy from running underneath it at narrow widths.
- ...(size === "tablet" && { maxWidth: "calc(100% - 245px)" }),
- position: "relative",
- zIndex: 1,
-}));
-
-const PanelHeadline = styled("h1", {
- shouldForwardProp: (prop) => prop !== "size",
-})<{ size: BrandPanelProps["size"] }>(({ size }) => ({
- maxWidth:
- size === "desktop" ? "300px" : size === "tablet" ? "380px" : "188px",
- margin: 0,
- fontFamily: authDisplayFontFamily,
- fontSize: size === "desktop" ? "42px" : size === "tablet" ? "34px" : "26px",
- fontWeight: 600,
- lineHeight:
- size === "desktop" ? "50px" : size === "tablet" ? "42px" : "34px",
- letterSpacing: "-0.02em",
- textWrap: "pretty",
- ...brandCopyAnimation,
- animationDelay: "80ms",
-}));
-
-const PanelSubtitle = styled("p", {
- shouldForwardProp: (prop) => prop !== "size",
-})<{ size: BrandPanelProps["size"] }>(({ size }) => ({
- margin: 0,
- marginTop: size === "desktop" ? "14px" : "10px",
- fontSize: size === "desktop" ? "20px" : "17px",
- fontWeight: 500,
- lineHeight: size === "desktop" ? "28px" : "24px",
- color: "rgba(255, 255, 255, 0.88)",
- ...brandCopyAnimation,
- animationDelay: "170ms",
-}));
-
-const BulletList = styled("ul")({
- margin: "34px 0 0",
- padding: 0,
- display: "flex",
- flexDirection: "column",
- gap: "14px",
- listStyle: "none",
-});
-
-const Bullet = styled("li")({
- display: "flex",
- alignItems: "center",
- gap: "12px",
- fontSize: "17px",
- fontWeight: 500,
- lineHeight: "24px",
- ...brandCopyAnimation,
- "&:nth-of-type(1)": { animationDelay: "280ms" },
- "&:nth-of-type(2)": { animationDelay: "350ms" },
- "&:nth-of-type(3)": { animationDelay: "420ms" },
-});
-
-const CheckCircle = styled("span")({
- width: "24px",
- height: "24px",
- flex: "0 0 24px",
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- borderRadius: "50%",
- backgroundColor: "rgba(255, 255, 255, 0.14)",
-});
-
-const IllustrationClip = styled("div", {
- shouldForwardProp: (prop) => prop !== "size",
-})<{ size: BrandPanelProps["size"] }>(({ size }) => ({
- width: size === "desktop" ? "313px" : size === "tablet" ? "237px" : "175px",
- height:
- size === "desktop" ? "219px" : size === "tablet" ? "172px" : "127px",
- flexShrink: 0,
- position: "relative",
- overflow: "hidden",
- zIndex: 0,
- ...(size !== "tablet" && {
- animation: `${illustrationReveal} 500ms cubic-bezier(0.22, 1, 0.36, 1) ${size === "desktop" ? "840ms" : "130ms"} both`,
- "@media (prefers-reduced-motion: reduce)": { animation: "none" },
- }),
- ...(size === "desktop"
- ? {
- marginTop: "auto",
- alignSelf: "center",
- "@media (min-width: 1600px)": { width: "355px", height: "249px" },
- }
- : {
- position: "absolute",
- right: size === "tablet" ? "28px" : "-4px",
- // Sit clear of the content sheet, which overlaps the band's
- // bottom edge by 32px (tablet) / 28px (mobile).
- bottom: size === "tablet" ? "44px" : "38px",
- }),
- "&::after": {
- content: '""',
- width:
- size === "desktop" ? "34px" : size === "tablet" ? "26px" : "20px",
- aspectRatio: "1",
- position: "absolute",
- left: "67%",
- top: size === "desktop" ? "59%" : "57%",
- zIndex: 1,
- pointerEvents: "none",
- backgroundColor: "#fff",
- clipPath:
- "polygon(50% 0%, 59% 39%, 100% 50%, 59% 61%, 50% 100%, 41% 61%, 0% 50%, 41% 39%)",
- filter: "drop-shadow(0 0 7px rgba(255, 245, 168, 0.95))",
- animation: `${cameraSparkle} 520ms ease-out ${size === "desktop" ? "1400ms" : size === "tablet" ? "740ms" : "690ms"} both`,
- "@media (prefers-reduced-motion: reduce)": { display: "none" },
- },
- "& > img": {
- display: "block",
- width: "473.694px",
- height: "370px",
- transformOrigin: "top left",
- transform:
- size === "desktop"
- ? "scale(0.66)"
- : size === "tablet"
- ? "scale(0.5)"
- : "scale(0.37)",
- ...(size === "desktop" && {
- "@media (min-width: 1600px)": { transform: "scale(0.75)" },
- }),
- },
-}));
diff --git a/web/apps/photos/src/components/auth/AuthDialog.tsx b/web/apps/photos/src/components/auth/AuthDialog.tsx
deleted file mode 100644
index 79402c1e65..0000000000
--- a/web/apps/photos/src/components/auth/AuthDialog.tsx
+++ /dev/null
@@ -1,98 +0,0 @@
-import { Dialog, GlobalStyles, styled, type ModalProps } from "@mui/material";
-import { SlideUpTransition } from "ente-new/photos/components/mui/SlideUpTransition";
-import type React from "react";
-import {
- authBodyTypography,
- authColorVariables,
- authDisplayFontFamily,
- authMobileMediaQuery,
-} from "./styles";
-
-interface AuthDialogProps extends React.PropsWithChildren {
- open: boolean;
- onClose: ModalProps["onClose"];
- ariaLabelledby?: string;
-}
-
-export const AuthDialog: React.FC<AuthDialogProps> = ({
- open,
- onClose,
- ariaLabelledby,
- children,
-}) => (
- <DialogRoot
- open={open}
- onClose={onClose}
- slots={{ transition: SlideUpTransition }}
- slotProps={{
- backdrop: { sx: { backgroundColor: "rgba(0, 0, 0, 0.4)" } },
- }}
- maxWidth={false}
- aria-labelledby={ariaLabelledby}
- >
- <GlobalStyles styles={authColorVariables} />
- <SheetHandle />
- {children}
- </DialogRoot>
-);
-
-export const AuthDialogHeader = styled("div")({
- display: "flex",
- flexDirection: "column",
- gap: "6px",
-});
-
-export const AuthDialogTitle = styled("h2")({
- margin: 0,
- fontFamily: authDisplayFontFamily,
- fontSize: "22px",
- fontWeight: 600,
- lineHeight: "30px",
- color: "var(--photos-auth-text)",
- [authMobileMediaQuery]: { fontSize: "20px", lineHeight: "28px" },
-});
-
-export const AuthDialogText = styled("p")({
- ...authBodyTypography,
- margin: 0,
- color: "var(--photos-auth-text-muted)",
- textWrap: "pretty",
-});
-
-const DialogRoot = styled(Dialog)(({ theme }) => ({
- "& .MuiDialog-paper": {
- width: "456px",
- maxWidth: "calc(100% - 32px)",
- margin: "16px",
- padding: "32px",
- boxSizing: "border-box",
- borderRadius: "24px",
- backgroundColor: "#fff",
- backgroundImage: "none",
- boxShadow: "0 4px 16px rgba(0, 0, 0, 0.14)",
- ...theme.applyStyles("dark", { backgroundColor: "#252525" }),
- },
- [authMobileMediaQuery]: {
- "& .MuiDialog-container": { alignItems: "flex-end" },
- "& .MuiDialog-paper": {
- width: "100%",
- maxWidth: "100%",
- margin: 0,
- padding: "12px 24px 28px",
- borderRadius: "24px 24px 0 0",
- },
- },
-}));
-
-const SheetHandle = styled("div")({
- display: "none",
- [authMobileMediaQuery]: {
- display: "block",
- width: "36px",
- height: "4px",
- flexShrink: 0,
- margin: "0 auto 20px",
- borderRadius: "999px",
- backgroundColor: "var(--photos-auth-fill-active)",
- },
-});
diff --git a/web/apps/photos/src/components/auth/Button.tsx b/web/apps/photos/src/components/auth/Button.tsx
deleted file mode 100644
index 4cfa67cff7..0000000000
--- a/web/apps/photos/src/components/auth/Button.tsx
+++ /dev/null
@@ -1,144 +0,0 @@
-import { CircularProgress, styled } from "@mui/material";
-import type React from "react";
-import {
- authBodyTypography,
- authFocusRing,
- authTransientProps,
-} from "./styles";
-
-export type ButtonVariant = "primary" | "secondary";
-
-export interface ButtonProps extends Omit<
- React.ButtonHTMLAttributes<HTMLButtonElement>,
- "color" | "children"
-> {
- variant?: ButtonVariant;
- fullWidth?: boolean;
- loading?: boolean;
- loadingMessage?: React.ReactNode;
- children: React.ReactNode;
-}
-
-export function Button({
- variant = "primary",
- fullWidth = false,
- loading = false,
- loadingMessage,
- disabled,
- type = "button",
- children,
- ...buttonProps
-}: ButtonProps): React.JSX.Element {
- return (
- <ButtonRoot
- type={type}
- disabled={disabled || loading}
- aria-busy={loading || undefined}
- $variant={variant}
- $fullWidth={fullWidth}
- $loading={loading}
- {...buttonProps}
- >
- {loading && loadingMessage ? (
- <LoadingContent>
- <CircularProgress size={20} color="inherit" />
- <span>{loadingMessage}</span>
- </LoadingContent>
- ) : (
- <>
- <ButtonLabel $loading={loading}>{children}</ButtonLabel>
- {loading && <CircularProgress size={20} color="inherit" />}
- </>
- )}
- </ButtonRoot>
- );
-}
-
-interface ButtonRootProps {
- $variant: ButtonVariant;
- $fullWidth: boolean;
- $loading: boolean;
-}
-
-const ButtonRoot = styled(
- "button",
- authTransientProps,
-)<ButtonRootProps>(({ $variant, $fullWidth, $loading }) => ({
- ...authBodyTypography,
- width: $fullWidth ? "100%" : "auto",
- height: "52px",
- padding: "14px 24px",
- border: 0,
- borderRadius: "20px",
- display: "inline-flex",
- alignItems: "center",
- justifyContent: "center",
- position: "relative",
- boxSizing: "border-box",
- fontFamily: "inherit",
- color: $variant === "primary" ? "#fff" : "var(--photos-auth-text)",
- backgroundColor:
- $variant === "primary"
- ? "var(--photos-auth-primary)"
- : "var(--photos-auth-button-secondary)",
- boxShadow:
- $variant === "primary"
- ? "inset 0 0 0 1px var(--photos-auth-button-primary-stroke)"
- : "inset 0 0 0 1px var(--photos-auth-button-secondary-stroke)",
- cursor: $loading ? "default" : "pointer",
- transition:
- "background-color 160ms ease, box-shadow 160ms ease, transform 180ms cubic-bezier(0.22, 1, 0.36, 1)",
- "&:hover:not(:disabled)": {
- backgroundColor:
- $variant === "primary"
- ? "var(--photos-auth-primary-hover)"
- : "var(--photos-auth-button-secondary-hover)",
- boxShadow:
- $variant === "primary"
- ? "inset 0 0 0 1px var(--photos-auth-button-primary-stroke-hover)"
- : "inset 0 0 0 1px var(--photos-auth-button-secondary-stroke-hover)",
- transform: "translateY(-2px)",
- },
- "&:active:not(:disabled)": {
- backgroundColor:
- $variant === "primary"
- ? "var(--photos-auth-primary-active)"
- : "var(--photos-auth-button-secondary-active)",
- boxShadow:
- $variant === "primary"
- ? "inset 0 0 0 1px var(--photos-auth-button-primary-stroke-active)"
- : "inset 0 0 0 1px var(--photos-auth-button-secondary-stroke-active)",
- transform: "translateY(0) scale(0.985)",
- },
- "&:focus-visible": authFocusRing,
- "&:disabled": $loading
- ? { cursor: "default" }
- : {
- color: "var(--photos-auth-text-disabled)",
- backgroundColor: "var(--photos-auth-fill-hover)",
- boxShadow: "none",
- cursor: "not-allowed",
- },
- "& > .MuiCircularProgress-root": { position: "absolute" },
- "@media (prefers-reduced-motion: reduce)": {
- transition: "background-color 120ms ease",
- "&:hover:not(:disabled), &:active:not(:disabled)": {
- transform: "none",
- },
- },
-}));
-
-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/Checkbox.tsx b/web/apps/photos/src/components/auth/Checkbox.tsx
deleted file mode 100644
index 6aa86b997f..0000000000
--- a/web/apps/photos/src/components/auth/Checkbox.tsx
+++ /dev/null
@@ -1,105 +0,0 @@
-import { Tick02Icon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
-import { styled } from "@mui/material";
-import type React from "react";
-import {
- authBodyTypography,
- authFocusRing,
- authTransientProps,
-} from "./styles";
-
-export interface CheckboxProps extends Omit<
- React.InputHTMLAttributes<HTMLInputElement>,
- "checked" | "children" | "onChange" | "type"
-> {
- checked: boolean;
- onChange: (checked: boolean) => void;
- label?: React.ReactNode;
-}
-
-export function Checkbox({
- checked,
- onChange,
- disabled,
- label,
- ...inputProps
-}: CheckboxProps): React.JSX.Element {
- function handleChange(event: React.ChangeEvent<HTMLInputElement>) {
- onChange(event.target.checked);
- }
-
- return (
- <CheckboxRoot $disabled={Boolean(disabled)}>
- <CheckboxInput
- type="checkbox"
- checked={checked}
- onChange={handleChange}
- disabled={disabled}
- {...inputProps}
- />
- <CheckboxMark aria-hidden="true">
- {checked && (
- <HugeiconsIcon
- icon={Tick02Icon}
- size={11}
- strokeWidth={3}
- />
- )}
- </CheckboxMark>
- {label && <CheckboxLabelText>{label}</CheckboxLabelText>}
- </CheckboxRoot>
- );
-}
-
-const CheckboxRoot = styled(
- "label",
- authTransientProps,
-)<{ $disabled: boolean }>(({ $disabled }) => ({
- display: "inline-flex",
- alignItems: "flex-start",
- gap: "8px",
- position: "relative",
- cursor: $disabled ? "not-allowed" : "pointer",
-}));
-
-const CheckboxInput = styled("input")({
- width: "1px",
- height: "1px",
- margin: 0,
- padding: 0,
- position: "absolute",
- overflow: "hidden",
- clip: "rect(0 0 0 0)",
- clipPath: "inset(50%)",
- whiteSpace: "nowrap",
-});
-
-const CheckboxMark = styled("span")({
- width: "16px",
- height: "16px",
- flex: "0 0 16px",
- marginTop: "2px",
- borderRadius: "4px",
- display: "inline-flex",
- alignItems: "center",
- justifyContent: "center",
- boxSizing: "border-box",
- color: "#fff",
- backgroundColor: "var(--photos-auth-primary)",
- "input:disabled + &": {
- backgroundColor: "var(--photos-auth-text-disabled)",
- },
- "input:not(:checked) + &": {
- backgroundColor: "transparent",
- boxShadow: "inset 0 0 0 1px var(--photos-auth-text-faint)",
- },
- "input:not(:checked):disabled + &": {
- boxShadow: "inset 0 0 0 1px var(--photos-auth-text-disabled)",
- },
- "input:focus-visible + &": authFocusRing,
-});
-
-const CheckboxLabelText = styled("span")({
- ...authBodyTypography,
- color: "var(--photos-auth-text)",
-});
diff --git a/web/apps/photos/src/components/auth/CredentialsForm.tsx b/web/apps/photos/src/components/auth/CredentialsForm.tsx
deleted file mode 100644
index e3f3a0cb0c..0000000000
--- a/web/apps/photos/src/components/auth/CredentialsForm.tsx
+++ /dev/null
@@ -1,113 +0,0 @@
-import { styled } from "@mui/material";
-import type { VerifyMasterPasswordPresentationProps } from "ente-accounts/components/VerifyMasterPasswordForm";
-import type { CredentialsPresentationProps } from "ente-accounts/pages/credentials";
-import { t } from "i18next";
-import type React from "react";
-import { Trans } from "react-i18next";
-import { Button } from "./Button";
-import { Form } from "./Form";
-import { FormFields } from "./FormFields";
-import { FormFooter } from "./FormFooter";
-import { ScreenHeader } from "./ScreenHeader";
-import { TextField } from "./TextField";
-import { TextLink } from "./TextLink";
-
-export function CredentialsForm({
- userEmail,
- host,
- passwordForm,
- onRecover,
- onChangeEmail,
-}: CredentialsPresentationProps): React.JSX.Element {
- return (
- <>
- <ScreenHeader
- title={t("enter_password")}
- subtitle={
- <Trans
- i18nKey="auth_signing_in_as"
- components={{ a: <Email /> }}
- values={{ email: userEmail }}
- />
- }
- />
- {passwordForm}
- <FormFooter>
- <FooterLinks>
- <TextLink onClick={onRecover}>
- {t("forgot_password")}
- </TextLink>
- <TextLink onClick={onChangeEmail}>
- {t("change_email")}
- </TextLink>
- </FooterLinks>
- <Host>{host ?? ""}</Host>
- </FormFooter>
- </>
- );
-}
-
-export function PasswordForm({
- userEmail,
- password,
- passwordError,
- isSubmitting,
- submitButtonTitle,
- onPasswordChange,
- onSubmit,
-}: VerifyMasterPasswordPresentationProps): React.JSX.Element {
- return (
- <Form onSubmit={onSubmit}>
- <HiddenEmail
- name="email"
- type="email"
- autoComplete="username"
- value={userEmail}
- readOnly
- tabIndex={-1}
- />
- <FormFields>
- <TextField
- name="password"
- value={password}
- onChange={onPasswordChange}
- type="password"
- autoComplete="current-password"
- label={t("password")}
- showPasswordToggle
- autoFocus
- disabled={isSubmitting}
- error={Boolean(passwordError)}
- helperText={passwordError}
- />
- </FormFields>
- <FormFooter>
- <Button fullWidth type="submit" loading={isSubmitting}>
- {submitButtonTitle}
- </Button>
- </FormFooter>
- </Form>
- );
-}
-
-const HiddenEmail = styled("input")({ display: "none" });
-
-const Email = styled("strong")({
- color: "var(--photos-auth-text)",
- wordBreak: "break-word",
-});
-
-const FooterLinks = styled("div")({
- display: "flex",
- justifyContent: "space-between",
- gap: "16px",
-});
-
-const Host = styled("div")({
- minHeight: "16px",
- textAlign: "center",
- fontSize: "12px",
- fontWeight: 500,
- lineHeight: "16px",
- color: "var(--photos-auth-text-faint)",
-});
diff --git a/web/apps/photos/src/components/auth/DevSettingsDialog.tsx b/web/apps/photos/src/components/auth/DevSettingsDialog.tsx
index 1810989b58..59decc814e 100644
--- a/web/apps/photos/src/components/auth/DevSettingsDialog.tsx
+++ b/web/apps/photos/src/components/auth/DevSettingsDialog.tsx
@@ -1,22 +1,22 @@
import { InformationCircleIcon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import { CircularProgress, styled } from "@mui/material";
-import type { DevSettingsPresentationProps } from "ente-new/photos/components/DevSettings";
-import { t } from "i18next";
-import type React from "react";
import {
AuthDialog,
AuthDialogHeader,
AuthDialogText,
AuthDialogTitle,
-} from "./AuthDialog";
-import { Button } from "./Button";
+} from "ente-accounts/components/auth/AuthDialog";
+import { Button } from "ente-accounts/components/auth/Button";
import {
authBodyTypography,
authDialogContentLayout,
authFocusRing,
-} from "./styles";
-import { TextField } from "./TextField";
+} from "ente-accounts/components/auth/styles";
+import { TextField } from "ente-accounts/components/auth/TextField";
+import type { DevSettingsPresentationProps } from "ente-new/photos/components/DevSettings";
+import { t } from "i18next";
+import type React from "react";
export function DevSettingsDialog({
open,
@@ -82,7 +82,7 @@ export function DevSettingsDialog({
<StatusPill role="status">
<CircularProgress
size={18}
- sx={{ color: "var(--photos-auth-primary)" }}
+ sx={{ color: "var(--auth-ui-primary)" }}
/>
<span>{t("auth_endpoint_checking")}</span>
</StatusPill>
@@ -115,8 +115,8 @@ const InfoLink = styled("a")({
alignItems: "center",
justifyContent: "center",
borderRadius: "4px",
- color: "var(--photos-auth-text-faint)",
- "&:hover": { color: "var(--photos-auth-text-muted)" },
+ color: "var(--auth-ui-text-faint)",
+ "&:hover": { color: "var(--auth-ui-text-muted)" },
"&:focus-visible": authFocusRing,
});
@@ -127,9 +127,9 @@ const StatusPill = styled("div")({
gap: "10px",
padding: "12px 14px",
borderRadius: "20px",
- backgroundColor: "var(--photos-auth-button-secondary)",
- boxShadow: "inset 0 0 0 1px var(--photos-auth-stroke)",
- color: "var(--photos-auth-text-muted)",
+ backgroundColor: "var(--auth-ui-button-secondary)",
+ boxShadow: "inset 0 0 0 1px var(--auth-ui-stroke)",
+ color: "var(--auth-ui-text-muted)",
"& > svg, & > .MuiCircularProgress-root": { flexShrink: 0 },
});
diff --git a/web/apps/photos/src/components/auth/Form.tsx b/web/apps/photos/src/components/auth/Form.tsx
deleted file mode 100644
index bf9395fefb..0000000000
--- a/web/apps/photos/src/components/auth/Form.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { styled } from "@mui/material";
-import type React from "react";
-import { authMobileMediaQuery } from "./styles";
-
-export interface FormProps extends React.FormHTMLAttributes<HTMLFormElement> {
- children: React.ReactNode;
-}
-
-export function Form({ children, ...formProps }: FormProps): React.JSX.Element {
- return <FormRoot {...formProps}>{children}</FormRoot>;
-}
-
-const FormRoot = styled("form")({
- width: "100%",
- minHeight: "min-content",
- display: "flex",
- flexDirection: "column",
- gap: "24px",
- [authMobileMediaQuery]: { flex: 1 },
-});
diff --git a/web/apps/photos/src/components/auth/FormFields.tsx b/web/apps/photos/src/components/auth/FormFields.tsx
deleted file mode 100644
index 266b2dc80f..0000000000
--- a/web/apps/photos/src/components/auth/FormFields.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import { styled } from "@mui/material";
-import type React from "react";
-
-export function FormFields({
- children,
-}: React.PropsWithChildren): React.JSX.Element {
- return <FormFieldsRoot>{children}</FormFieldsRoot>;
-}
-
-const FormFieldsRoot = styled("div")({
- "--photos-auth-message-gap": "16px",
- width: "100%",
- display: "flex",
- flexDirection: "column",
- gap: "16px",
-});
diff --git a/web/apps/photos/src/components/auth/FormFooter.tsx b/web/apps/photos/src/components/auth/FormFooter.tsx
deleted file mode 100644
index f59919ed4d..0000000000
--- a/web/apps/photos/src/components/auth/FormFooter.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import { styled } from "@mui/material";
-import type React from "react";
-import { authMobileMediaQuery } from "./styles";
-
-export function FormFooter({
- children,
-}: React.PropsWithChildren): React.JSX.Element {
- return <FormFooterRoot>{children}</FormFooterRoot>;
-}
-
-const FormFooterRoot = styled("div")({
- width: "100%",
- display: "flex",
- flexDirection: "column",
- gap: "16px",
- [authMobileMediaQuery]: { marginTop: "auto" },
-});
diff --git a/web/apps/photos/src/components/auth/LoginForm.tsx b/web/apps/photos/src/components/auth/LoginForm.tsx
deleted file mode 100644
index 7fbf2055ac..0000000000
--- a/web/apps/photos/src/components/auth/LoginForm.tsx
+++ /dev/null
@@ -1,107 +0,0 @@
-import { Input, styled } from "@mui/material";
-import type { LoginPresentationProps } from "ente-accounts/components/LoginContents";
-import { t } from "i18next";
-import type React from "react";
-import { Button } from "./Button";
-import { Form } from "./Form";
-import { FormFields } from "./FormFields";
-import { FormFooter } from "./FormFooter";
-import { ScreenHeader } from "./ScreenHeader";
-import { TextField } from "./TextField";
-import { TextLink } from "./TextLink";
-
-export function LoginForm({
- email,
- emailError,
- host,
- isSubmitting,
- isJoinAlbumContext,
- isEnsu,
- onEmailChange,
- onSubmit,
- onSignUp,
- onCancel,
-}: LoginPresentationProps): React.JSX.Element {
- return (
- <>
- <ScreenHeader
- title={
- isJoinAlbumContext
- ? t("login_to_join_album")
- : t("auth_welcome_back")
- }
- subtitle={t("auth_login_subtitle")}
- />
- <Form onSubmit={onSubmit}>
- <FormFields>
- <TextField
- name="email"
- value={email}
- onChange={onEmailChange}
- type="email"
- autoComplete="username"
- label={t("auth_email_label")}
- placeholder={t("auth_email_placeholder")}
- autoFocus
- disabled={isSubmitting}
- error={Boolean(emailError)}
- helperText={emailError}
- />
- <Input
- sx={{ display: "none" }}
- type="password"
- value=""
- readOnly
- />
- </FormFields>
- <FormFooter>
- <Button fullWidth type="submit" loading={isSubmitting}>
- {t("login")}
- </Button>
- <AccountActions>
- {isEnsu ? (
- <TextLink onClick={onCancel}>
- {t("cancel")}
- </TextLink>
- ) : (
- <AccountPrompt>
- <span>{t("auth_new_account_prompt")}</span>
- <TextLink regular onClick={onSignUp}>
- {t("sign_up")}
- </TextLink>
- </AccountPrompt>
- )}
- <Host>{host ?? ""}</Host>
- </AccountActions>
- </FormFooter>
- </Form>
- </>
- );
-}
-
-const AccountActions = styled("div")({
- display: "flex",
- flexDirection: "column",
- alignItems: "center",
- gap: "10px",
- textAlign: "center",
-});
-
-const AccountPrompt = styled("div")({
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- gap: "6px",
- fontSize: "14px",
- fontWeight: 500,
- lineHeight: "20px",
- color: "var(--photos-auth-text-muted)",
-});
-
-const Host = styled("div")({
- minHeight: "16px",
- fontSize: "12px",
- fontWeight: 500,
- lineHeight: "16px",
- color: "var(--photos-auth-text-faint)",
-});
diff --git a/web/apps/photos/src/components/auth/Message.tsx b/web/apps/photos/src/components/auth/Message.tsx
deleted file mode 100644
index 858d871d26..0000000000
--- a/web/apps/photos/src/components/auth/Message.tsx
+++ /dev/null
@@ -1,121 +0,0 @@
-import {
- Alert02Icon,
- AlertCircleIcon,
- InformationCircleIcon,
- Tick02Icon,
-} from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
-import { styled } from "@mui/material";
-import type React from "react";
-import { useEffect, useRef } from "react";
-import { authMiniTypography, authTransientProps } from "./styles";
-
-export type MessageKind = "error" | "warning" | "success" | "info";
-
-export interface MessageProps {
- children: React.ReactNode;
- kind?: MessageKind;
- note?: boolean;
- visible?: boolean;
- id?: string;
-}
-
-export function Message({
- children,
- kind = "info",
- note = false,
- visible,
- id,
-}: MessageProps): React.JSX.Element {
- const isVisible = visible ?? true;
- const lastVisibleContent = useRef({ children, kind });
- const displayedContent = isVisible
- ? { children, kind }
- : lastVisibleContent.current;
-
- useEffect(() => {
- if (isVisible) lastVisibleContent.current = { children, kind };
- }, [children, isVisible, kind]);
-
- return (
- <MessageRoot
- id={id}
- role={displayedContent.kind === "error" ? "alert" : "status"}
- aria-hidden={!isVisible || undefined}
- $kind={displayedContent.kind}
- $animated={visible !== undefined}
- $visible={isVisible}
- >
- <MessageContent $note={note}>
- <HugeiconsIcon
- icon={messageIcons[displayedContent.kind]}
- size={14}
- strokeWidth={2}
- aria-hidden="true"
- />
- <span>{displayedContent.children}</span>
- </MessageContent>
- </MessageRoot>
- );
-}
-
-const messageIcons = {
- error: AlertCircleIcon,
- warning: Alert02Icon,
- success: Tick02Icon,
- info: InformationCircleIcon,
-} as const;
-
-const MessageRoot = styled(
- "span",
- authTransientProps,
-)<{ $kind: MessageKind; $animated: boolean; $visible: boolean }>(({
- $kind,
- $animated,
- $visible,
-}) => {
- const delay = $visible ? "40ms" : "0ms";
-
- return {
- ...authMiniTypography,
- display: "inline-grid",
- gridTemplateRows: $visible ? "1fr" : "0fr",
- marginTop:
- $animated && !$visible
- ? "calc(-1 * var(--photos-auth-message-gap, 8px))"
- : 0,
- opacity: $visible ? 1 : 0,
- transform: $visible ? "translateY(0)" : "translateY(-4px)",
- visibility: $visible ? "visible" : "hidden",
- color:
- $kind === "error"
- ? "var(--photos-auth-warning)"
- : $kind === "warning"
- ? "var(--photos-auth-caution)"
- : $kind === "success"
- ? "var(--photos-auth-success)"
- : "var(--photos-auth-text-muted)",
- ...($animated && {
- overflow: "hidden",
- transition: [
- `grid-template-rows 360ms cubic-bezier(0.22, 1, 0.36, 1) ${delay}`,
- `margin-top 360ms cubic-bezier(0.22, 1, 0.36, 1) ${delay}`,
- `opacity 360ms cubic-bezier(0.22, 1, 0.36, 1) ${delay}`,
- `transform 360ms cubic-bezier(0.22, 1, 0.36, 1) ${delay}`,
- `visibility 0s linear ${$visible ? "0ms" : "360ms"}`,
- ].join(", "),
- "@media (prefers-reduced-motion: reduce)": { transition: "none" },
- }),
- };
-});
-
-const MessageContent = styled(
- "span",
- authTransientProps,
-)<{ $note: boolean }>(({ $note }) => ({
- minHeight: 0,
- display: "inline-flex",
- alignItems: $note ? "flex-start" : "center",
- gap: $note ? "8px" : "4px",
- "& > svg": { flexShrink: 0 },
-}));
diff --git a/web/apps/photos/src/components/auth/OTPField.tsx b/web/apps/photos/src/components/auth/OTPField.tsx
deleted file mode 100644
index c6e9f8e718..0000000000
--- a/web/apps/photos/src/components/auth/OTPField.tsx
+++ /dev/null
@@ -1,265 +0,0 @@
-import { styled } from "@mui/material";
-import { t } from "i18next";
-import type React from "react";
-import { useEffect, useRef } from "react";
-import {
- authDisplayFontFamily,
- authMiniTypography,
- authTransientProps,
-} from "./styles";
-
-export interface OTPFieldProps {
- id?: string;
- name?: string;
- label?: React.ReactNode;
- value: string;
- onChange: (value: string) => void;
- length?: number;
- error?: boolean;
- disabled?: boolean;
- autoFocus?: boolean;
- ariaLabel?: string;
- ariaDescribedBy?: string;
-}
-
-export function OTPField({
- id,
- name,
- label,
- value,
- onChange,
- length = 6,
- error = false,
- disabled = false,
- autoFocus,
- ariaLabel,
- ariaDescribedBy,
-}: OTPFieldProps): React.JSX.Element {
- const inputRefs = useRef<(HTMLInputElement | null)[]>([]);
- const wasDisabled = useRef(disabled);
- const hadError = useRef(error);
-
- useEffect(() => {
- if (autoFocus && value.length === 0) inputRefs.current[0]?.focus();
- }, [autoFocus, value]);
-
- function isInputValueValid(input: string) {
- return !isNaN(Number(input)) && input.trim().length === 1;
- }
-
- function focusInput(index: number) {
- const nextIndex = Math.max(Math.min(length - 1, index), 0);
- const input = inputRefs.current[nextIndex];
- if (input) {
- input.focus();
- input.select();
- }
- }
-
- useEffect(() => {
- const shouldRestoreFocus =
- error && !disabled && (wasDisabled.current || !hadError.current);
-
- wasDisabled.current = disabled;
- hadError.current = error;
-
- if (shouldRestoreFocus) {
- const index = Math.max(
- Math.min(value.trimEnd().length - 1, length - 1),
- 0,
- );
- const input = inputRefs.current[index];
- input?.focus();
- input?.select();
- }
- }, [disabled, error, length, value]);
-
- function updateDigit(index: number, digit: string) {
- const otp = value.padEnd(length, " ").slice(0, length).split("");
- otp[index] = digit || " ";
- onChange(otp.join(""));
- }
-
- function handleChange(
- index: number,
- event: React.ChangeEvent<HTMLInputElement>,
- ) {
- const input = event.currentTarget.value;
- if (isInputValueValid(input)) {
- updateDigit(index, input);
- focusInput(index + 1);
- }
- }
-
- function handleInput(
- index: number,
- event: React.SyntheticEvent<HTMLInputElement, InputEvent>,
- ) {
- const nativeEvent = event.nativeEvent;
- const input = event.currentTarget.value;
- if (!isInputValueValid(input)) {
- if (
- input.length === length &&
- !input.split("").some((digit) => !isInputValueValid(digit))
- ) {
- onChange(input);
- focusInput(length - 1);
- }
-
- if (
- nativeEvent.data === null &&
- nativeEvent.inputType === "deleteContentBackward"
- ) {
- event.preventDefault();
- updateDigit(index, "");
- focusInput(index - 1);
- }
-
- event.currentTarget.value = "";
- }
- }
-
- function handleKeyDown(
- index: number,
- event: React.KeyboardEvent<HTMLInputElement>,
- ) {
- const otp = value.padEnd(length, " ").slice(0, length).split("");
- if ([event.code, event.key].includes("Backspace")) {
- event.preventDefault();
- updateDigit(index, "");
- focusInput(index - 1);
- } else if (event.code === "Delete") {
- event.preventDefault();
- updateDigit(index, "");
- } else if (event.code === "ArrowLeft") {
- event.preventDefault();
- focusInput(index - 1);
- } 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 === "ArrowUp" || event.code === "ArrowDown") {
- event.preventDefault();
- }
- }
-
- function handlePaste(
- index: number,
- event: React.ClipboardEvent<HTMLInputElement>,
- ) {
- event.preventDefault();
- const otp = value.padEnd(length, " ").slice(0, length).split("");
- const pastedData = event.clipboardData
- .getData("text/plain")
- .slice(0, length - index)
- .split("");
-
- if (pastedData.some((digit) => !isInputValueValid(digit))) return;
-
- pastedData.forEach((digit, offset) => {
- otp[index + offset] = digit;
- });
-
- focusInput(index + pastedData.length);
- onChange(otp.join(""));
- }
-
- const inputAriaLabel = ariaLabel ?? t("verification_code");
-
- return (
- <OTPFieldRoot>
- {label && <OTPLabel>{label}</OTPLabel>}
- <OTPRoot $disabled={disabled}>
- {Array.from({ length }, (_, index) => (
- <OTPInput
- key={index}
- ref={(element) => {
- inputRefs.current[index] = element;
- }}
- id={index === 0 ? id : undefined}
- name={index === 0 ? name : undefined}
- type="tel"
- value={value[index]?.trim() ?? ""}
- onChange={(event) => handleChange(index, event)}
- onFocus={(event) => event.currentTarget.select()}
- onInput={(event) => handleInput(index, event)}
- onKeyDown={(event) => handleKeyDown(index, event)}
- onPaste={(event) => handlePaste(index, event)}
- disabled={disabled}
- autoFocus={autoFocus && index === 0}
- inputMode="numeric"
- pattern="[0-9]*"
- autoComplete={index === 0 ? "one-time-code" : "off"}
- aria-label={`${inputAriaLabel} ${index + 1}`}
- aria-describedby={ariaDescribedBy}
- aria-invalid={error || undefined}
- $error={error}
- />
- ))}
- </OTPRoot>
- </OTPFieldRoot>
- );
-}
-
-const OTPFieldRoot = styled("div")({
- width: "100%",
- display: "flex",
- flexDirection: "column",
- gap: "16px",
- "&:focus-within > span": { color: "var(--photos-auth-text)" },
-});
-
-const OTPLabel = styled("span")({
- ...authMiniTypography,
- color: "var(--photos-auth-text-muted)",
- transition: "color 100ms ease-in",
- "@media (prefers-reduced-motion: reduce)": { transition: "none" },
-});
-
-const OTPRoot = styled(
- "div",
- authTransientProps,
-)<{ $disabled: boolean }>(({ $disabled }) => ({
- width: "100%",
- display: "flex",
- gap: "8px",
- position: "relative",
- containerType: "inline-size",
- cursor: $disabled ? "not-allowed" : "text",
-}));
-
-const OTPInput = styled(
- "input",
- authTransientProps,
-)<{ $error: boolean }>(({ $error }) => ({
- aspectRatio: "44 / 52",
- minWidth: 0,
- flex: "1 1 0",
- padding: 0,
- border: 0,
- borderRadius: "16px",
- boxSizing: "border-box",
- fontFamily: authDisplayFontFamily,
- fontSize: "clamp(20px, 6.6cqi, 30px)",
- fontWeight: 600,
- lineHeight: 1,
- textAlign: "center",
- color: "var(--photos-auth-text)",
- backgroundColor: "var(--photos-auth-field)",
- boxShadow: `inset 0 0 0 1px ${
- $error ? "var(--photos-auth-warning)" : "var(--photos-auth-stroke)"
- }`,
- outline: 0,
- cursor: "text",
- transition: "box-shadow 0.2s ease",
- "&:focus": {
- boxShadow: `inset 0 0 0 1px ${
- $error ? "var(--photos-auth-warning)" : "var(--photos-auth-primary)"
- }`,
- },
- "&:disabled": { cursor: "not-allowed" },
-}));
diff --git a/web/apps/photos/src/components/auth/PasskeyVerificationForm.tsx b/web/apps/photos/src/components/auth/PasskeyVerificationForm.tsx
index 6e3e1a9998..b68f19117c 100644
--- a/web/apps/photos/src/components/auth/PasskeyVerificationForm.tsx
+++ b/web/apps/photos/src/components/auth/PasskeyVerificationForm.tsx
@@ -1,19 +1,19 @@
import { InformationCircleIcon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import { CircularProgress, styled } from "@mui/material";
-import type { VerifyingPasskeyPresentationProps } from "ente-accounts/components/LoginComponents";
-import { t } from "i18next";
-import type React from "react";
-import { Trans } from "react-i18next";
-import { Button } from "./Button";
-import { FormFooter } from "./FormFooter";
-import { ScreenHeader } from "./ScreenHeader";
+import { Button } from "ente-accounts/components/auth/Button";
+import { FormFooter } from "ente-accounts/components/auth/FormFooter";
+import { ScreenHeader } from "ente-accounts/components/auth/ScreenHeader";
import {
authBodyTypography,
authMiniTypography,
authTransientProps,
-} from "./styles";
-import { TextLink } from "./TextLink";
+} from "ente-accounts/components/auth/styles";
+import { TextLink } from "ente-accounts/components/auth/TextLink";
+import type { VerifyingPasskeyPresentationProps } from "ente-accounts/components/LoginComponents";
+import { t } from "i18next";
+import type React from "react";
+import { Trans } from "react-i18next";
export function PasskeyVerificationForm({
email,
@@ -78,10 +78,7 @@ export function PasskeyVerificationForm({
) : (
<CircularProgress
size={20}
- sx={{
- color: "var(--photos-auth-primary)",
- flexShrink: 0,
- }}
+ sx={{ color: "var(--auth-ui-primary)", flexShrink: 0 }}
/>
)}
<StatusText>
@@ -124,7 +121,7 @@ export function PasskeyVerificationForm({
}
const Email = styled("strong")({
- color: "var(--photos-auth-text)",
+ color: "var(--auth-ui-text)",
wordBreak: "break-word",
});
@@ -138,19 +135,19 @@ const StatusCard = styled(
alignItems: $stalled ? "flex-start" : "center",
gap: "12px",
backgroundColor: $stalled
- ? "color-mix(in srgb, var(--photos-auth-caution) 12%, transparent)"
- : "var(--photos-auth-field)",
+ ? "color-mix(in srgb, var(--auth-ui-caution) 12%, transparent)"
+ : "var(--auth-ui-field)",
boxShadow: `inset 0 0 0 1px ${
$stalled
- ? "color-mix(in srgb, var(--photos-auth-caution) 32%, transparent)"
- : "var(--photos-auth-stroke)"
+ ? "color-mix(in srgb, var(--auth-ui-caution) 32%, transparent)"
+ : "var(--auth-ui-stroke)"
}`,
}));
const StatusIcon = styled("div")({
flexShrink: 0,
display: "flex",
- color: "var(--photos-auth-caution)",
+ color: "var(--auth-ui-caution)",
});
const StatusText = styled("div")({
@@ -162,14 +159,14 @@ const StatusText = styled("div")({
const StatusTitle = styled("div")({
...authBodyTypography,
fontWeight: 600,
- color: "var(--photos-auth-text)",
+ color: "var(--auth-ui-text)",
});
const StatusCaption = styled("p")({
...authMiniTypography,
margin: 0,
textWrap: "pretty",
- color: "var(--photos-auth-text-muted)",
+ color: "var(--auth-ui-text-muted)",
});
const FooterLinks = styled("div")({
@@ -182,5 +179,5 @@ const Host = styled("div")({
...authMiniTypography,
minHeight: "16px",
textAlign: "center",
- color: "var(--photos-auth-text-faint)",
+ color: "var(--auth-ui-text-faint)",
});
diff --git a/web/apps/photos/src/components/auth/PasswordStrengthMessage.tsx b/web/apps/photos/src/components/auth/PasswordStrengthMessage.tsx
deleted file mode 100644
index c4eb537f5e..0000000000
--- a/web/apps/photos/src/components/auth/PasswordStrengthMessage.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import type { PasswordStrength } from "ente-accounts/utils/password";
-import { t } from "i18next";
-import type React from "react";
-import { Message, type MessageKind } from "./Message";
-
-interface PasswordStrengthMessageProps {
- strength?: PasswordStrength;
- visible: boolean;
-}
-
-export function PasswordStrengthMessage({
- strength,
- visible,
-}: PasswordStrengthMessageProps): React.JSX.Element {
- const displayedStrength = strength ?? "weak";
-
- const kind: MessageKind =
- displayedStrength === "weak"
- ? "error"
- : displayedStrength === "moderate"
- ? "warning"
- : "success";
-
- return (
- <Message kind={kind} visible={visible}>
- {t("password_strength", { context: displayedStrength })}
- </Message>
- );
-}
diff --git a/web/apps/photos/src/components/auth/RecoveryForm.tsx b/web/apps/photos/src/components/auth/RecoveryForm.tsx
deleted file mode 100644
index a28b6526ae..0000000000
--- a/web/apps/photos/src/components/auth/RecoveryForm.tsx
+++ /dev/null
@@ -1,177 +0,0 @@
-import { styled } from "@mui/material";
-import type { RecoverAccountPresentationProps } from "ente-accounts/pages/recover";
-import type { TwoFactorRecoverPresentationProps } from "ente-accounts/pages/two-factor/recover";
-import log from "ente-base/log";
-import { useFormik } from "formik";
-import { t } from "i18next";
-import React, { useState } from "react";
-import {
- AuthDialog,
- AuthDialogHeader,
- AuthDialogText,
- AuthDialogTitle,
-} from "./AuthDialog";
-import { Button } from "./Button";
-import { Form } from "./Form";
-import { FormFields } from "./FormFields";
-import { FormFooter } from "./FormFooter";
-import { ScreenHeader } from "./ScreenHeader";
-import { authDialogContentLayout } from "./styles";
-import { TextField } from "./TextField";
-import { TextLink } from "./TextLink";
-
-export function RecoverAccountForm(
- props: RecoverAccountPresentationProps,
-): React.JSX.Element {
- const [showNoRecoveryKey, setShowNoRecoveryKey] = useState(false);
-
- return (
- <>
- <RecoveryForm
- {...props}
- onNoRecoveryKey={() => setShowNoRecoveryKey(true)}
- title={t("recover_account")}
- subtitle={t("auth_recover_account_subtitle")}
- />
- <AuthDialog
- open={showNoRecoveryKey}
- onClose={() => setShowNoRecoveryKey(false)}
- ariaLabelledby="no-recovery-key-title"
- >
- <DialogContent>
- <AuthDialogHeader>
- <AuthDialogTitle id="no-recovery-key-title">
- {t("sorry")}
- </AuthDialogTitle>
- <AuthDialogText>
- {t("no_recovery_key_message")}
- </AuthDialogText>
- </AuthDialogHeader>
- <Button
- variant="secondary"
- fullWidth
- autoFocus
- onClick={() => setShowNoRecoveryKey(false)}
- >
- {t("ok")}
- </Button>
- </DialogContent>
- </AuthDialog>
- </>
- );
-}
-
-const DialogContent = styled("div")(authDialogContentLayout);
-
-export function RecoverTwoFactorForm(
- props: TwoFactorRecoverPresentationProps,
-): React.JSX.Element {
- return (
- <RecoveryForm
- {...props}
- title={t("recover_two_factor")}
- subtitle={t("auth_recover_two_factor_subtitle")}
- />
- );
-}
-
-interface RecoveryFormProps extends RecoverAccountPresentationProps {
- title: React.ReactNode;
- subtitle: React.ReactNode;
-}
-
-function RecoveryForm({
- title,
- subtitle,
- onSubmit,
- onNoRecoveryKey,
- onBack,
-}: RecoveryFormProps): React.JSX.Element {
- const formik = useFormik({
- initialValues: { recoveryKey: "" },
- onSubmit: async ({ recoveryKey }, { setFieldError }) => {
- function setRecoveryKeyError(message: string) {
- setFieldError("recoveryKey", message);
- }
-
- if (!recoveryKey) {
- setRecoveryKeyError(t("required"));
- return;
- }
-
- try {
- await onSubmit(recoveryKey, setRecoveryKeyError);
- } catch (error) {
- log.error("Failed to submit recovery key", error);
- setRecoveryKeyError(t("generic_error"));
- }
- },
- });
-
- function handleRecoveryKeyDown(
- event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>,
- ) {
- if (
- event.key === "Enter" &&
- !event.shiftKey &&
- !event.nativeEvent.isComposing
- ) {
- event.preventDefault();
- void formik.submitForm();
- }
- }
-
- return (
- <>
- <ScreenHeader title={title} subtitle={subtitle} />
- <Form onSubmit={formik.handleSubmit}>
- <FormFields>
- <TextField
- name="recoveryKey"
- label={t("recovery_key")}
- placeholder={t("auth_recovery_key_placeholder")}
- value={formik.values.recoveryKey}
- onChange={formik.handleChange}
- onKeyDown={handleRecoveryKeyDown}
- autoComplete="off"
- multiline
- rows={5}
- autoFocus
- disabled={formik.isSubmitting}
- error={Boolean(formik.errors.recoveryKey)}
- helperText={formik.errors.recoveryKey}
- />
- </FormFields>
- <FormFooter>
- <Button
- fullWidth
- type="submit"
- loading={formik.isSubmitting}
- >
- {t("recover")}
- </Button>
- <FooterLinks>
- <TextLink
- onClick={onNoRecoveryKey}
- disabled={formik.isSubmitting}
- >
- {t("no_recovery_key_title")}
- </TextLink>
- <TextLink
- onClick={onBack}
- disabled={formik.isSubmitting}
- >
- {t("go_back")}
- </TextLink>
- </FooterLinks>
- </FormFooter>
- </Form>
- </>
- );
-}
-
-const FooterLinks = styled("div")({
- display: "flex",
- justifyContent: "space-between",
- gap: "16px",
-});
diff --git a/web/apps/photos/src/components/auth/RecoveryKeyForm.tsx b/web/apps/photos/src/components/auth/RecoveryKeyForm.tsx
deleted file mode 100644
index 0d0ac152f4..0000000000
--- a/web/apps/photos/src/components/auth/RecoveryKeyForm.tsx
+++ /dev/null
@@ -1,107 +0,0 @@
-import ContentCopyIcon from "@mui/icons-material/ContentCopy";
-import DoneIcon from "@mui/icons-material/Done";
-import { CircularProgress, styled } from "@mui/material";
-import type { RecoveryKeyPresentationProps } from "ente-accounts/components/RecoveryKey";
-import { useClipboardCopy } from "ente-base/components/utils/hooks";
-import { t } from "i18next";
-import type React from "react";
-import { Button } from "./Button";
-import { FormFooter } from "./FormFooter";
-import { Message } from "./Message";
-import { ScreenHeader } from "./ScreenHeader";
-import { authFocusRing } from "./styles";
-
-export function RecoveryKeyForm({
- recoveryKey,
- onClose,
- onSave,
-}: RecoveryKeyPresentationProps): React.JSX.Element {
- const [copied, handleCopy] = useClipboardCopy(recoveryKey ?? "");
- const CopyIcon = copied ? DoneIcon : ContentCopyIcon;
-
- return (
- <>
- <ScreenHeader
- title={t("auth_recovery_key_title")}
- subtitle={t("recovery_key_description")}
- />
- <RecoveryKeyBox>
- {recoveryKey ? (
- <>
- <RecoveryKeyText>{recoveryKey}</RecoveryKeyText>
- <CopyButton
- type="button"
- onClick={handleCopy}
- aria-label={
- copied
- ? t("copied")
- : t("auth_copy_recovery_key")
- }
- >
- <CopyIcon fontSize="small" />
- </CopyButton>
- </>
- ) : (
- <CircularProgress
- size={24}
- sx={{ color: "var(--photos-auth-primary)" }}
- />
- )}
- </RecoveryKeyBox>
- <Message note>{t("key_not_stored_note")}</Message>
- <FormFooter>
- <Actions>
- <Button fullWidth variant="secondary" onClick={onClose}>
- {t("do_this_later")}
- </Button>
- <Button fullWidth onClick={onSave} disabled={!recoveryKey}>
- {t("save_key")}
- </Button>
- </Actions>
- </FormFooter>
- </>
- );
-}
-
-const RecoveryKeyBox = styled("div")({
- minHeight: "128px",
- padding: "20px",
- borderRadius: "16px",
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- position: "relative",
- boxSizing: "border-box",
- backgroundColor: "var(--photos-auth-field)",
- boxShadow: "inset 0 0 0 1px var(--photos-auth-stroke)",
-});
-
-const RecoveryKeyText = styled("p")({
- margin: 0,
- paddingRight: "28px",
- fontSize: "15px",
- fontWeight: 500,
- lineHeight: "24px",
- wordBreak: "break-word",
- color: "var(--photos-auth-text)",
-});
-
-const CopyButton = styled("button")({
- width: "32px",
- height: "32px",
- padding: 0,
- border: 0,
- borderRadius: "8px",
- display: "inline-flex",
- alignItems: "center",
- justifyContent: "center",
- position: "absolute",
- top: "12px",
- right: "12px",
- backgroundColor: "transparent",
- color: "var(--photos-auth-text-muted)",
- cursor: "pointer",
- "&:focus-visible": authFocusRing,
-});
-
-const Actions = styled("div")({ display: "flex", gap: "12px" });
diff --git a/web/apps/photos/src/components/auth/ScreenHeader.tsx b/web/apps/photos/src/components/auth/ScreenHeader.tsx
deleted file mode 100644
index 42da197b7e..0000000000
--- a/web/apps/photos/src/components/auth/ScreenHeader.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-import { styled } from "@mui/material";
-import type React from "react";
-import { authDisplayFontFamily, authMobileMediaQuery } from "./styles";
-
-export interface ScreenHeaderProps {
- title: React.ReactNode;
- subtitle?: React.ReactNode;
-}
-
-export function ScreenHeader({
- title,
- subtitle,
-}: ScreenHeaderProps): React.JSX.Element {
- return (
- <ScreenHeaderRoot>
- <ScreenTitle>{title}</ScreenTitle>
- {subtitle && <ScreenSubtitle>{subtitle}</ScreenSubtitle>}
- </ScreenHeaderRoot>
- );
-}
-
-const ScreenHeaderRoot = styled("div")({
- display: "flex",
- flexDirection: "column",
- gap: "8px",
-});
-
-const ScreenTitle = styled("h1")({
- margin: 0,
- fontFamily: authDisplayFontFamily,
- fontSize: "30px",
- fontWeight: 600,
- lineHeight: "38px",
- textWrap: "pretty",
- color: "var(--photos-auth-text)",
- [authMobileMediaQuery]: { fontSize: "26px", lineHeight: "34px" },
- "@media (min-width: 1600px)": { fontSize: "32px", lineHeight: "40px" },
-});
-
-const ScreenSubtitle = styled("p")({
- margin: 0,
- fontSize: "16px",
- fontWeight: 500,
- lineHeight: "24px",
- textWrap: "pretty",
- color: "var(--photos-auth-text-muted)",
- [authMobileMediaQuery]: { fontSize: "13px", lineHeight: "20px" },
-});
diff --git a/web/apps/photos/src/components/auth/SecondFactorChoiceDialog.tsx b/web/apps/photos/src/components/auth/SecondFactorChoiceDialog.tsx
deleted file mode 100644
index 475264a817..0000000000
--- a/web/apps/photos/src/components/auth/SecondFactorChoiceDialog.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-import { styled } from "@mui/material";
-import type { SecondFactorChoicePresentationProps } from "ente-accounts/components/SecondFactorChoice";
-import { t } from "i18next";
-import type React from "react";
-import {
- AuthDialog,
- AuthDialogHeader,
- AuthDialogText,
- AuthDialogTitle,
-} from "./AuthDialog";
-import { Button } from "./Button";
-import { authDialogContentLayout } from "./styles";
-
-export function SecondFactorChoiceDialog({
- open,
- onDialogClose,
- onSelect,
-}: SecondFactorChoicePresentationProps): React.JSX.Element {
- return (
- <AuthDialog
- open={open}
- onClose={onDialogClose}
- ariaLabelledby="second-factor-choice-title"
- >
- <ContentRoot>
- <AuthDialogHeader>
- <AuthDialogTitle id="second-factor-choice-title">
- {t("two_factor")}
- </AuthDialogTitle>
- <AuthDialogText>
- {t("auth_second_factor_choice_subtitle")}
- </AuthDialogText>
- </AuthDialogHeader>
- <ButtonStack>
- <Button
- variant="primary"
- fullWidth
- onClick={() => onSelect("totp")}
- >
- {t("totp_login")}
- </Button>
- <Button
- variant="secondary"
- fullWidth
- onClick={() => onSelect("passkey")}
- >
- {t("passkey_login")}
- </Button>
- </ButtonStack>
- </ContentRoot>
- </AuthDialog>
- );
-}
-
-const ContentRoot = styled("div")(authDialogContentLayout);
-
-const ButtonStack = styled("div")({
- display: "flex",
- flexDirection: "column",
- gap: "12px",
-});
diff --git a/web/apps/photos/src/components/auth/SetPasswordForm.tsx b/web/apps/photos/src/components/auth/SetPasswordForm.tsx
deleted file mode 100644
index 7bc8114248..0000000000
--- a/web/apps/photos/src/components/auth/SetPasswordForm.tsx
+++ /dev/null
@@ -1,119 +0,0 @@
-import { styled } from "@mui/material";
-import type { NewPasswordPresentationProps } from "ente-accounts/components/NewPasswordForm";
-import { t } from "i18next";
-import type React from "react";
-import { Button } from "./Button";
-import { Form } from "./Form";
-import { FormFields } from "./FormFields";
-import { FormFooter } from "./FormFooter";
-import { Message } from "./Message";
-import { PasswordStrengthMessage } from "./PasswordStrengthMessage";
-import { ScreenHeader } from "./ScreenHeader";
-import { TextField } from "./TextField";
-import { TextLink } from "./TextLink";
-
-export function SetPasswordForm({
- userEmail,
- password,
- confirmPassword,
- passwordError,
- confirmPasswordError,
- passwordStrength,
- isSubmitting,
- isSubmitDisabled,
- submitButtonTitle,
- onBack,
- onPasswordChange,
- onConfirmPasswordChange,
- onSubmit,
-}: NewPasswordPresentationProps): React.JSX.Element {
- return (
- <>
- <ScreenHeader
- title={submitButtonTitle}
- subtitle={t("auth_password_recovery_warning")}
- />
- <Form onSubmit={onSubmit}>
- <HiddenEmail
- name="email"
- type="email"
- autoComplete="username"
- value={userEmail}
- readOnly
- tabIndex={-1}
- />
- <FormFields>
- <PasswordField>
- <TextField
- name="password"
- label={t("password")}
- placeholder={t("auth_strong_password_placeholder")}
- autoComplete="new-password"
- showPasswordToggle
- value={password}
- onChange={onPasswordChange}
- error={Boolean(passwordError)}
- helperText={passwordError}
- disabled={isSubmitting}
- autoFocus
- />
- <PasswordStrengthMessage
- strength={passwordStrength}
- visible={Boolean(password)}
- />
- </PasswordField>
- <TextField
- name="confirmPassword"
- label={t("confirm_password")}
- placeholder={t("auth_repeat_password_placeholder")}
- autoComplete="new-password"
- showPasswordToggle
- value={confirmPassword}
- onChange={onConfirmPasswordChange}
- error={Boolean(confirmPasswordError)}
- helperText={confirmPasswordError}
- disabled={isSubmitting}
- />
- </FormFields>
- <FormFooter>
- <Button
- fullWidth
- type="submit"
- loading={isSubmitting}
- disabled={isSubmitDisabled}
- >
- {submitButtonTitle}
- </Button>
- {isSubmitting ? (
- <SubmittingMessage>
- <Message>{t("key_generation_in_progress")}</Message>
- </SubmittingMessage>
- ) : null}
- {onBack ? (
- <BackAction>
- <TextLink onClick={onBack} disabled={isSubmitting}>
- {t("go_back")}
- </TextLink>
- </BackAction>
- ) : null}
- </FormFooter>
- </Form>
- </>
- );
-}
-
-const HiddenEmail = styled("input")({ display: "none" });
-
-const PasswordField = styled("div")({
- "--photos-auth-message-gap": "8px",
- display: "flex",
- flexDirection: "column",
- gap: "8px",
-});
-
-const SubmittingMessage = styled("div")({
- display: "flex",
- justifyContent: "center",
-});
-
-const BackAction = styled("div")({ display: "flex", justifyContent: "center" });
diff --git a/web/apps/photos/src/components/auth/SignUpForm.tsx b/web/apps/photos/src/components/auth/SignUpForm.tsx
deleted file mode 100644
index 330f57c141..0000000000
--- a/web/apps/photos/src/components/auth/SignUpForm.tsx
+++ /dev/null
@@ -1,215 +0,0 @@
-import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";
-import { styled, Tooltip } from "@mui/material";
-import type { SignUpPresentationProps } from "ente-accounts/components/SignUpContents";
-import { t } from "i18next";
-import type React from "react";
-import { Trans } from "react-i18next";
-import { Button } from "./Button";
-import { Checkbox } from "./Checkbox";
-import { Form } from "./Form";
-import { FormFields } from "./FormFields";
-import { FormFooter } from "./FormFooter";
-import { PasswordStrengthMessage } from "./PasswordStrengthMessage";
-import { ScreenHeader } from "./ScreenHeader";
-import { TextField } from "./TextField";
-import { TextLink } from "./TextLink";
-
-export function SignUpForm({
- email,
- password,
- confirmPassword,
- referral,
- acceptedTerms,
- emailError,
- passwordError,
- confirmPasswordError,
- passwordStrength,
- isSubmitting,
- isSubmitDisabled,
- isJoinAlbumContext,
- host,
- onEmailChange,
- onPasswordChange,
- onConfirmPasswordChange,
- onReferralChange,
- onAcceptedTermsChange,
- onSubmit,
- onLogin,
-}: SignUpPresentationProps): React.JSX.Element {
- return (
- <>
- <ScreenHeader
- title={
- isJoinAlbumContext
- ? t("signup_to_join_album")
- : t("auth_create_account")
- }
- subtitle={t("auth_signup_subtitle")}
- />
- <Form onSubmit={onSubmit}>
- <FormFields>
- <TextField
- name="email"
- label={t("auth_email_label")}
- placeholder={t("auth_email_placeholder")}
- type="email"
- autoComplete="username"
- value={email}
- onChange={onEmailChange}
- autoFocus
- error={Boolean(emailError)}
- helperText={emailError}
- disabled={isSubmitting}
- />
- <PasswordField>
- <TextField
- name="password"
- label={t("password")}
- placeholder={t("auth_password_placeholder")}
- autoComplete="new-password"
- showPasswordToggle
- value={password}
- onChange={onPasswordChange}
- error={Boolean(passwordError)}
- helperText={passwordError}
- disabled={isSubmitting}
- />
- <PasswordStrengthMessage
- strength={passwordStrength}
- visible={Boolean(passwordStrength)}
- />
- </PasswordField>
- <TextField
- name="confirmPassword"
- label={t("confirm_password")}
- placeholder={t("auth_confirm_password_placeholder")}
- autoComplete="new-password"
- showPasswordToggle
- value={confirmPassword}
- onChange={onConfirmPasswordChange}
- error={Boolean(confirmPasswordError)}
- helperText={confirmPasswordError}
- disabled={isSubmitting}
- />
- <TextField
- name="referral"
- label={
- <ReferralLabel>
- {t("referral_source_hint")}
- <Tooltip title={t("referral_source_info")}>
- <InfoOutlinedIcon
- fontSize="inherit"
- tabIndex={0}
- aria-label={t("referral_source_info")}
- />
- </Tooltip>
- </ReferralLabel>
- }
- placeholder={t("auth_optional")}
- value={referral}
- onChange={onReferralChange}
- disabled={isSubmitting}
- />
- </FormFields>
- <Checkbox
- name="acceptedTerms"
- checked={acceptedTerms}
- onChange={onAcceptedTermsChange}
- disabled={isSubmitting}
- label={
- <TermsText>
- <Trans
- i18nKey="terms_and_conditions"
- components={{
- a: (
- <TermsLink
- href="https://ente.com/terms"
- target="_blank"
- />
- ),
- b: (
- <TermsLink
- href="https://ente.com/privacy"
- target="_blank"
- />
- ),
- }}
- />
- </TermsText>
- }
- />
- <FormFooter>
- <Button
- fullWidth
- type="submit"
- loading={isSubmitting}
- loadingMessage={t("key_generation_in_progress")}
- disabled={isSubmitDisabled}
- >
- {t("create_account")}
- </Button>
- <AccountPrompt>
- <span>{t("auth_existing_account_prompt")}</span>
- <TextLink regular onClick={onLogin}>
- {t("login")}
- </TextLink>
- </AccountPrompt>
- {host ? <Host>{host}</Host> : null}
- </FormFooter>
- </Form>
- </>
- );
-}
-
-const PasswordField = styled("div")({
- "--photos-auth-message-gap": "8px",
- display: "flex",
- flexDirection: "column",
- gap: "8px",
-});
-
-const ReferralLabel = styled("span")({
- display: "inline-flex",
- alignItems: "center",
- gap: "4px",
- "& > svg": { fontSize: "14px" },
-});
-
-const TermsText = styled("span")({
- fontSize: "14px",
- fontWeight: 500,
- lineHeight: "20px",
- color: "var(--photos-auth-text)",
-});
-
-const TermsLink = styled("a")({
- color: "var(--photos-auth-primary)",
- textDecoration: "none",
- "&:hover": { textDecoration: "underline" },
- "&:focus-visible": {
- borderRadius: "4px",
- outline: "2px solid var(--photos-auth-primary)",
- outlineOffset: "2px",
- },
-});
-
-const AccountPrompt = styled("div")({
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- gap: "6px",
- fontSize: "14px",
- fontWeight: 500,
- lineHeight: "20px",
- textAlign: "center",
- color: "var(--photos-auth-text-muted)",
-});
-
-const Host = styled("div")({
- minHeight: "16px",
- fontSize: "12px",
- fontWeight: 500,
- lineHeight: "16px",
- textAlign: "center",
- color: "var(--photos-auth-text-faint)",
-});
diff --git a/web/apps/photos/src/components/auth/TextField.tsx b/web/apps/photos/src/components/auth/TextField.tsx
deleted file mode 100644
index c963b015c0..0000000000
--- a/web/apps/photos/src/components/auth/TextField.tsx
+++ /dev/null
@@ -1,282 +0,0 @@
-import { ViewIcon, ViewOffSlashIcon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
-import { styled } from "@mui/material";
-import { t } from "i18next";
-import type React from "react";
-import { useId, useState } from "react";
-import { Message } from "./Message";
-import {
- authBodyTypography,
- authFocusRing,
- authMiniTypography,
- authTransientProps,
-} from "./styles";
-
-export interface TextFieldProps {
- id?: string;
- label?: React.ReactNode;
- value: string;
- onChange: (
- event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>,
- ) => void;
- onKeyDown?: (
- event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>,
- ) => void;
- onBlur?: (
- event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>,
- ) => void;
- type?: React.HTMLInputTypeAttribute;
- placeholder?: string;
- required?: boolean;
- disabled?: boolean;
- error?: boolean;
- helperText?: React.ReactNode;
- autoFocus?: boolean;
- autoComplete?: string;
- name?: string;
- showPasswordToggle?: boolean;
- multiline?: boolean;
- rows?: number;
- inputMode?: React.HTMLAttributes<HTMLInputElement>["inputMode"];
- ariaLabel?: string;
- trailing?: React.ReactNode;
-}
-
-export function TextField({
- id,
- label,
- value,
- onChange,
- onKeyDown,
- onBlur,
- type = "text",
- placeholder,
- required,
- disabled,
- error,
- helperText,
- autoFocus,
- autoComplete,
- name,
- showPasswordToggle,
- multiline,
- rows = 5,
- inputMode,
- ariaLabel,
- trailing,
-}: TextFieldProps): React.JSX.Element {
- const generatedID = useId();
- const inputID = id ?? generatedID;
- const helperID = `${inputID}-helper`;
- const hasHelper = Boolean(helperText);
- const [isPasswordVisible, setIsPasswordVisible] = useState(false);
- const inputType = showPasswordToggle
- ? isPasswordVisible
- ? "text"
- : "password"
- : type;
-
- function handleInputChange(event: React.ChangeEvent<HTMLInputElement>) {
- onChange(event);
- }
-
- function handleTextAreaChange(
- event: React.ChangeEvent<HTMLTextAreaElement>,
- ) {
- onChange(event);
- }
-
- function handlePasswordToggle() {
- setIsPasswordVisible((isVisible) => !isVisible);
- }
-
- function handlePasswordToggleMouseDown(
- event: React.MouseEvent<HTMLButtonElement>,
- ) {
- event.preventDefault();
- }
-
- const sharedControlProps = {
- id: inputID,
- value,
- placeholder,
- required,
- disabled,
- autoFocus,
- autoComplete,
- name,
- onBlur,
- "aria-label": ariaLabel,
- "aria-invalid": error || undefined,
- "aria-describedby": hasHelper ? helperID : undefined,
- };
-
- return (
- <FieldRoot>
- {label && (
- <FieldLabel htmlFor={inputID}>
- {label}
- {required && (
- <RequiredMark aria-hidden="true"> *</RequiredMark>
- )}
- </FieldLabel>
- )}
- <FieldBox
- $error={Boolean(error)}
- $disabled={Boolean(disabled)}
- $multiline={Boolean(multiline)}
- >
- {multiline ? (
- <TextAreaControl
- {...sharedControlProps}
- rows={rows}
- onChange={handleTextAreaChange}
- onKeyDown={onKeyDown}
- />
- ) : (
- <TextInputControl
- {...sharedControlProps}
- type={inputType}
- inputMode={inputMode}
- onChange={handleInputChange}
- onKeyDown={onKeyDown}
- />
- )}
- {showPasswordToggle && !multiline && (
- <PasswordToggle
- type="button"
- tabIndex={-1}
- aria-label={t("show_or_hide_password")}
- aria-controls={inputID}
- aria-pressed={isPasswordVisible}
- disabled={disabled}
- onClick={handlePasswordToggle}
- onMouseDown={handlePasswordToggleMouseDown}
- >
- <HugeiconsIcon
- icon={
- isPasswordVisible ? ViewOffSlashIcon : ViewIcon
- }
- size={20}
- strokeWidth={2}
- aria-hidden="true"
- />
- </PasswordToggle>
- )}
- {trailing}
- </FieldBox>
- <Message
- id={helperID}
- kind={error ? "error" : "info"}
- visible={hasHelper}
- >
- {helperText}
- </Message>
- </FieldRoot>
- );
-}
-
-const FieldRoot = styled("div")({
- "--photos-auth-message-gap": "9px",
- width: "100%",
- display: "flex",
- flexDirection: "column",
- gap: "9px",
- "&:focus-within > label": { color: "var(--photos-auth-text)" },
-});
-
-const FieldLabel = styled("label")({
- ...authMiniTypography,
- color: "var(--photos-auth-text-muted)",
- transition: "color 100ms ease-in",
- "@media (prefers-reduced-motion: reduce)": { transition: "none" },
-});
-
-const RequiredMark = styled("span")({ color: "var(--photos-auth-warning)" });
-
-interface FieldBoxProps {
- $error: boolean;
- $disabled: boolean;
- $multiline: boolean;
-}
-
-const FieldBox = styled(
- "div",
- authTransientProps,
-)<FieldBoxProps>(({ $error, $disabled, $multiline }) => ({
- width: "100%",
- height: $multiline ? "auto" : "52px",
- minHeight: $multiline ? "112px" : undefined,
- padding: $multiline ? "16px" : "0 16px",
- borderRadius: "16px",
- display: "flex",
- alignItems: $multiline ? "flex-start" : "center",
- gap: "8px",
- boxSizing: "border-box",
- backgroundColor: $disabled
- ? "var(--photos-auth-fill-hover)"
- : "var(--photos-auth-field)",
- boxShadow: $disabled
- ? "none"
- : `inset 0 0 0 1px ${
- $error
- ? "var(--photos-auth-warning)"
- : "var(--photos-auth-stroke)"
- }`,
- "&:focus-within": $disabled
- ? undefined
- : {
- boxShadow: `inset 0 0 0 1px ${
- $error
- ? "var(--photos-auth-warning)"
- : "var(--photos-auth-primary)"
- }`,
- },
-}));
-
-const controlStyles = {
- ...authBodyTypography,
- width: "100%",
- minWidth: 0,
- flex: 1,
- padding: 0,
- border: 0,
- outline: 0,
- background: "transparent",
- fontFamily: "inherit",
- color: "var(--photos-auth-text)",
- "&::placeholder": { color: "var(--photos-auth-text-faint)", opacity: 1 },
- "&:disabled": {
- color: "var(--photos-auth-text-disabled)",
- WebkitTextFillColor: "var(--photos-auth-text-disabled)",
- cursor: "not-allowed",
- },
-};
-
-const TextInputControl = styled("input")({ ...controlStyles });
-
-const TextAreaControl = styled("textarea")({
- ...controlStyles,
- minHeight: "80px",
- resize: "none",
-});
-
-const PasswordToggle = styled("button")({
- width: "20px",
- height: "20px",
- flex: "0 0 20px",
- padding: 0,
- border: 0,
- borderRadius: "4px",
- display: "inline-flex",
- alignItems: "center",
- justifyContent: "center",
- background: "transparent",
- color: "var(--photos-auth-text-faint)",
- cursor: "pointer",
- "&:focus-visible": authFocusRing,
- "&:disabled": {
- color: "var(--photos-auth-text-disabled)",
- cursor: "not-allowed",
- },
-});
diff --git a/web/apps/photos/src/components/auth/TextLink.tsx b/web/apps/photos/src/components/auth/TextLink.tsx
deleted file mode 100644
index cfe5983eb8..0000000000
--- a/web/apps/photos/src/components/auth/TextLink.tsx
+++ /dev/null
@@ -1,55 +0,0 @@
-import { styled } from "@mui/material";
-import type React from "react";
-import {
- authBodyTypography,
- authFocusRing,
- authTransientProps,
-} from "./styles";
-
-export interface TextLinkProps extends Omit<
- React.ButtonHTMLAttributes<HTMLButtonElement>,
- "color" | "children"
-> {
- regular?: boolean;
- children: React.ReactNode;
-}
-
-export function TextLink({
- regular = false,
- type = "button",
- children,
- ...buttonProps
-}: TextLinkProps): React.JSX.Element {
- return (
- <TextLinkRoot type={type} $regular={regular} {...buttonProps}>
- {children}
- </TextLinkRoot>
- );
-}
-
-const TextLinkRoot = styled(
- "button",
- authTransientProps,
-)<{ $regular: boolean }>(({ $regular }) => ({
- ...authBodyTypography,
- display: "inline-flex",
- alignItems: "center",
- gap: "4px",
- padding: 0,
- border: 0,
- background: "transparent",
- fontFamily: "inherit",
- fontWeight: $regular ? 500 : 600,
- color: "var(--photos-auth-primary)",
- textDecoration: "none",
- cursor: "pointer",
- "&:hover:not(:disabled)": {
- textDecoration: "underline",
- textUnderlineOffset: "3px",
- },
- "&:focus-visible": { ...authFocusRing, borderRadius: "4px" },
- "&:disabled": {
- color: "var(--photos-auth-text-disabled)",
- cursor: "not-allowed",
- },
-}));
diff --git a/web/apps/photos/src/components/auth/TwoFactorForm.tsx b/web/apps/photos/src/components/auth/TwoFactorForm.tsx
deleted file mode 100644
index caec794e12..0000000000
--- a/web/apps/photos/src/components/auth/TwoFactorForm.tsx
+++ /dev/null
@@ -1,115 +0,0 @@
-import { styled } from "@mui/material";
-import type { TwoFactorVerifyPresentationProps } from "ente-accounts/pages/two-factor/verify";
-import { isHTTP401Error } from "ente-base/http";
-import log from "ente-base/log";
-import { useFormik } from "formik";
-import { t } from "i18next";
-import type React from "react";
-import { Button } from "./Button";
-import { Form } from "./Form";
-import { FormFields } from "./FormFields";
-import { FormFooter } from "./FormFooter";
-import { Message } from "./Message";
-import { OTPField } from "./OTPField";
-import { ScreenHeader } from "./ScreenHeader";
-import { TextLink } from "./TextLink";
-
-const completeCodePattern = /^\d{6}$/;
-
-export function TwoFactorForm({
- onSubmit,
- onRecover,
- onChangeEmail,
-}: TwoFactorVerifyPresentationProps): React.JSX.Element {
- const formik = useFormik({
- initialValues: { otp: "" },
- validateOnBlur: false,
- validateOnChange: false,
- onSubmit: async ({ otp }, { setFieldError, resetForm }) => {
- if (!completeCodePattern.test(otp)) {
- setFieldError("otp", t("required"));
- return;
- }
-
- try {
- await onSubmit(otp);
- resetForm();
- } catch (error) {
- log.error("Failed to submit 2FA code", error);
- resetForm();
- setFieldError(
- "otp",
- isHTTP401Error(error)
- ? t("incorrect_code")
- : t("generic_error"),
- );
- }
- },
- });
-
- function handleCodeChange(otp: string) {
- const shouldAutoSubmit =
- !completeCodePattern.test(formik.values.otp) &&
- completeCodePattern.test(otp);
-
- void formik.setFieldValue("otp", otp).then(() => {
- if (shouldAutoSubmit && !formik.isSubmitting) {
- void formik.submitForm();
- }
- });
- }
-
- return (
- <>
- <ScreenHeader
- title={t("two_factor")}
- subtitle={t("enter_two_factor_otp")}
- />
- <Form onSubmit={formik.handleSubmit}>
- <FormFields>
- <OTPField
- name="otp"
- value={formik.values.otp}
- onChange={handleCodeChange}
- error={Boolean(formik.errors.otp)}
- disabled={formik.isSubmitting}
- autoFocus
- />
- <Message kind="error" visible={Boolean(formik.errors.otp)}>
- {formik.errors.otp}
- </Message>
- </FormFields>
- <FormFooter>
- <Button
- fullWidth
- type="submit"
- loading={formik.isSubmitting}
- disabled={!completeCodePattern.test(formik.values.otp)}
- >
- {t("verify")}
- </Button>
- <FooterLinks>
- <TextLink
- onClick={onRecover}
- disabled={formik.isSubmitting}
- >
- {t("lost_2fa_device")}
- </TextLink>
- <TextLink
- onClick={onChangeEmail}
- disabled={formik.isSubmitting}
- >
- {t("change_email")}
- </TextLink>
- </FooterLinks>
- </FormFooter>
- </Form>
- </>
- );
-}
-
-const FooterLinks = styled("div")({
- display: "flex",
- justifyContent: "space-between",
- gap: "16px",
-});
diff --git a/web/apps/photos/src/components/auth/VerifyEmailForm.tsx b/web/apps/photos/src/components/auth/VerifyEmailForm.tsx
deleted file mode 100644
index fa5a0fc8bf..0000000000
--- a/web/apps/photos/src/components/auth/VerifyEmailForm.tsx
+++ /dev/null
@@ -1,127 +0,0 @@
-import { styled } from "@mui/material";
-import type { VerifyEmailPresentationProps } from "ente-accounts/pages/verify";
-import log from "ente-base/log";
-import { useFormik } from "formik";
-import { t } from "i18next";
-import type React from "react";
-import { Trans } from "react-i18next";
-import { Button } from "./Button";
-import { Form } from "./Form";
-import { FormFields } from "./FormFields";
-import { FormFooter } from "./FormFooter";
-import { Message } from "./Message";
-import { OTPField } from "./OTPField";
-import { ScreenHeader } from "./ScreenHeader";
-import { TextLink } from "./TextLink";
-
-const completeCodePattern = /^\d{6}$/;
-
-export function VerifyEmailForm({
- email,
- resend,
- onSubmit,
- onResend,
- onChangeEmail,
-}: VerifyEmailPresentationProps): React.JSX.Element {
- const formik = useFormik({
- initialValues: { code: "" },
- onSubmit: async ({ code }, { setFieldError }) => {
- function setCodeError(message: string) {
- setFieldError("code", message);
- }
-
- if (!completeCodePattern.test(code)) {
- setCodeError(t("required"));
- return;
- }
-
- try {
- await onSubmit(code, setCodeError);
- } catch (error) {
- log.error("Failed to submit email verification code", error);
- setCodeError(t("generic_error"));
- }
- },
- });
-
- function handleCodeChange(code: string) {
- const shouldAutoSubmit =
- !completeCodePattern.test(formik.values.code) &&
- completeCodePattern.test(code);
-
- void formik.setFieldValue("code", code).then(() => {
- if (shouldAutoSubmit && !formik.isSubmitting) {
- void formik.submitForm();
- }
- });
- }
-
- const resendLabel =
- resend === "sending"
- ? t("status_sending")
- : resend === "sent"
- ? t("status_sent")
- : t("resend_code");
-
- return (
- <>
- <ScreenHeader
- title={t("auth_check_inbox")}
- subtitle={
- <Trans
- i18nKey="auth_verification_code_sent_to"
- components={{ a: <Email /> }}
- values={{ email }}
- />
- }
- />
- <Form onSubmit={formik.handleSubmit}>
- <FormFields>
- <OTPField
- name="code"
- label={t("verification_code")}
- value={formik.values.code}
- onChange={handleCodeChange}
- error={Boolean(formik.errors.code)}
- disabled={formik.isSubmitting}
- autoFocus
- />
- <Message kind="error" visible={Boolean(formik.errors.code)}>
- {formik.errors.code}
- </Message>
- </FormFields>
- <FormFooter>
- <Button
- fullWidth
- type="submit"
- loading={formik.isSubmitting}
- >
- {t("verify")}
- </Button>
- <FooterLinks>
- <TextLink
- onClick={onResend}
- disabled={resend !== "enable"}
- >
- {resendLabel}
- </TextLink>
- <TextLink onClick={onChangeEmail}>
- {t("change_email")}
- </TextLink>
- </FooterLinks>
- </FormFooter>
- </Form>
- </>
- );
-}
-
-const Email = styled("strong")({
- color: "var(--photos-auth-text)",
- wordBreak: "break-word",
-});
-
-const FooterLinks = styled("div")({
- display: "flex",
- justifyContent: "space-between",
- gap: "16px",
-});
diff --git a/web/apps/photos/src/components/auth/styles.ts b/web/apps/photos/src/components/auth/styles.ts
deleted file mode 100644
index 3c422abb4a..0000000000
--- a/web/apps/photos/src/components/auth/styles.ts
+++ /dev/null
@@ -1,83 +0,0 @@
-export const authColorVariables = {
- ":where(:root)": {
- "--photos-auth-primary": "#08c225",
- "--photos-auth-primary-hover": "#069d1e",
- "--photos-auth-primary-active": "#057c18",
- "--photos-auth-success": "#069d1e",
- "--photos-auth-warning": "#f63a3a",
- "--photos-auth-caution": "#f08a1e",
- "--photos-auth-text": "#000",
- "--photos-auth-text-muted": "#666",
- "--photos-auth-text-faint": "#969696",
- "--photos-auth-text-disabled": "#d6d6d6",
- "--photos-auth-field": "#fff",
- "--photos-auth-fill": "#eaeaea",
- "--photos-auth-fill-hover": "#dedede",
- "--photos-auth-fill-active": "#d2d2d2",
- "--photos-auth-stroke": "#e0e0e0",
- "--photos-auth-button-secondary": "#eaeaea",
- "--photos-auth-button-secondary-hover": "#dedede",
- "--photos-auth-button-secondary-active": "#d2d2d2",
- "--photos-auth-button-secondary-stroke": "transparent",
- "--photos-auth-button-secondary-stroke-hover": "transparent",
- "--photos-auth-button-secondary-stroke-active": "transparent",
- "--photos-auth-button-primary-stroke": "rgba(255, 255, 255, 0.14)",
- "--photos-auth-button-primary-stroke-hover":
- "rgba(255, 255, 255, 0.32)",
- "--photos-auth-button-primary-stroke-active":
- "rgba(255, 255, 255, 0.2)",
- },
- "*:where(.dark)": {
- "--photos-auth-success": "#08c225",
- "--photos-auth-text": "#fff",
- "--photos-auth-text-muted": "#999",
- "--photos-auth-text-disabled": "#4d4d4d",
- "--photos-auth-field": "#1a1a1a",
- "--photos-auth-fill": "#0a0a0a",
- "--photos-auth-fill-hover": "#1a1a1a",
- "--photos-auth-fill-active": "#292929",
- "--photos-auth-stroke": "#3e3e3e",
- "--photos-auth-button-secondary": "#1e1e1e",
- "--photos-auth-button-secondary-hover": "#1a1a1a",
- "--photos-auth-button-secondary-active": "#161616",
- "--photos-auth-button-secondary-stroke": "rgba(255, 255, 255, 0.07)",
- "--photos-auth-button-secondary-stroke-hover":
- "rgba(255, 255, 255, 0.18)",
- "--photos-auth-button-secondary-stroke-active":
- "rgba(255, 255, 255, 0.12)",
- },
-};
-
-const authMobileCutoffPx = 640;
-export const authMobileMediaQuery = `@media (max-width: ${authMobileCutoffPx - 0.05}px)`;
-export const authAboveMobileMediaQuery = `@media (min-width: ${authMobileCutoffPx}px)`;
-
-export const authTransientProps = {
- shouldForwardProp: (prop: string) => !prop.startsWith("$"),
-};
-
-export const authDisplayFontFamily = '"Outfit Variable", sans-serif';
-
-export const authFocusRing = {
- outline: "1px solid var(--photos-auth-primary)",
- outlineOffset: "2px",
-};
-
-export const authBodyTypography = {
- fontSize: "14px",
- fontWeight: 500,
- lineHeight: "20px",
-};
-
-export const authMiniTypography = {
- fontSize: "12px",
- fontWeight: 500,
- lineHeight: "16px",
-};
-
-export const authDialogContentLayout = {
- display: "flex",
- flexDirection: "column",
- gap: "24px",
- [authMobileMediaQuery]: { gap: "20px" },
-} as const;
diff --git a/web/apps/photos/src/pages/change-password.tsx b/web/apps/photos/src/pages/change-password.tsx
index 8e40e54a5a..f762a262bf 100644
--- a/web/apps/photos/src/pages/change-password.tsx
+++ b/web/apps/photos/src/pages/change-password.tsx
@@ -1,7 +1,7 @@
-import { SetPasswordForm } from "@/components/auth/SetPasswordForm";
import { PhotosAuthShell } from "@/components/PhotosAuthShell";
import { featureFlags } from "@/feature-flags";
import type { NewPasswordPresentationProps } from "ente-accounts/components/NewPasswordForm";
+import { SetPasswordForm } from "ente-accounts/components/auth/SetPasswordForm";
import AccountsChangePasswordPage from "ente-accounts/pages/change-password";
import type React from "react";
diff --git a/web/apps/photos/src/pages/credentials.tsx b/web/apps/photos/src/pages/credentials.tsx
index 3d3f4cdd16..9ea700ea61 100644
--- a/web/apps/photos/src/pages/credentials.tsx
+++ b/web/apps/photos/src/pages/credentials.tsx
@@ -1,11 +1,11 @@
-import {
- CredentialsForm,
- PasswordForm,
-} from "@/components/auth/CredentialsForm";
import { PasskeyVerificationForm } from "@/components/auth/PasskeyVerificationForm";
-import { SecondFactorChoiceDialog } from "@/components/auth/SecondFactorChoiceDialog";
import { PhotosAuthShell } from "@/components/PhotosAuthShell";
import { featureFlags } from "@/feature-flags";
+import {
+ CredentialsForm,
+ PasswordForm,
+} from "ente-accounts/components/auth/CredentialsForm";
+import { SecondFactorChoiceDialog } from "ente-accounts/components/auth/SecondFactorChoiceDialog";
import type { VerifyingPasskeyPresentationProps } from "ente-accounts/components/LoginComponents";
import AccountsCredentialsPage, {
type CredentialsPresentationProps,
diff --git a/web/apps/photos/src/pages/generate.tsx b/web/apps/photos/src/pages/generate.tsx
index 7758089a1f..412f72a2ed 100644
--- a/web/apps/photos/src/pages/generate.tsx
+++ b/web/apps/photos/src/pages/generate.tsx
@@ -1,9 +1,9 @@
-import { RecoveryKeyForm } from "@/components/auth/RecoveryKeyForm";
-import { SetPasswordForm } from "@/components/auth/SetPasswordForm";
import { PhotosAuthShell } from "@/components/PhotosAuthShell";
import { featureFlags } from "@/feature-flags";
import type { NewPasswordPresentationProps } from "ente-accounts/components/NewPasswordForm";
import type { RecoveryKeyPresentationProps } from "ente-accounts/components/RecoveryKey";
+import { RecoveryKeyForm } from "ente-accounts/components/auth/RecoveryKeyForm";
+import { SetPasswordForm } from "ente-accounts/components/auth/SetPasswordForm";
import AccountsGeneratePage from "ente-accounts/pages/generate";
import type React from "react";
diff --git a/web/apps/photos/src/pages/index.tsx b/web/apps/photos/src/pages/index.tsx
index d5f9cd7909..801edd30a7 100644
--- a/web/apps/photos/src/pages/index.tsx
+++ b/web/apps/photos/src/pages/index.tsx
@@ -1,9 +1,9 @@
import { DevSettingsDialog } from "@/components/auth/DevSettingsDialog";
-import { LoginForm } from "@/components/auth/LoginForm";
-import { SignUpForm } from "@/components/auth/SignUpForm";
import { PhotosAuthShell } from "@/components/PhotosAuthShell";
import { featureFlags } from "@/feature-flags";
import { Box, Stack, Typography, styled } from "@mui/material";
+import { LoginForm } from "ente-accounts/components/auth/LoginForm";
+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";
diff --git a/web/apps/photos/src/pages/login.tsx b/web/apps/photos/src/pages/login.tsx
index 0650cd9f6b..63dabb89af 100644
--- a/web/apps/photos/src/pages/login.tsx
+++ b/web/apps/photos/src/pages/login.tsx
@@ -1,7 +1,7 @@
-import { LoginForm } from "@/components/auth/LoginForm";
import { PhotosAuthShell } from "@/components/PhotosAuthShell";
import { featureFlags } from "@/feature-flags";
import type { LoginPresentationProps } from "ente-accounts/components/LoginContents";
+import { LoginForm } from "ente-accounts/components/auth/LoginForm";
import AccountsLoginPage from "ente-accounts/pages/login";
import type React from "react";
diff --git a/web/apps/photos/src/pages/passkeys/recover.tsx b/web/apps/photos/src/pages/passkeys/recover.tsx
index ca343f67c0..e9ccb65d79 100644
--- a/web/apps/photos/src/pages/passkeys/recover.tsx
+++ b/web/apps/photos/src/pages/passkeys/recover.tsx
@@ -1,6 +1,6 @@
-import { RecoverTwoFactorForm } from "@/components/auth/RecoveryForm";
import { PhotosAuthShell } from "@/components/PhotosAuthShell";
import { featureFlags } from "@/feature-flags";
+import { RecoverTwoFactorForm } from "ente-accounts/components/auth/RecoveryForm";
import AccountsTwoFactorRecoverPage, {
type TwoFactorRecoverPresentationProps,
} from "ente-accounts/pages/two-factor/recover";
diff --git a/web/apps/photos/src/pages/recover.tsx b/web/apps/photos/src/pages/recover.tsx
index b42ca177d1..c4103e0bcf 100644
--- a/web/apps/photos/src/pages/recover.tsx
+++ b/web/apps/photos/src/pages/recover.tsx
@@ -1,6 +1,6 @@
-import { RecoverAccountForm } from "@/components/auth/RecoveryForm";
import { PhotosAuthShell } from "@/components/PhotosAuthShell";
import { featureFlags } from "@/feature-flags";
+import { RecoverAccountForm } from "ente-accounts/components/auth/RecoveryForm";
import AccountsRecoverPage, {
type RecoverAccountPresentationProps,
} from "ente-accounts/pages/recover";
diff --git a/web/apps/photos/src/pages/signup.tsx b/web/apps/photos/src/pages/signup.tsx
index e5753b1f87..7d225a1948 100644
--- a/web/apps/photos/src/pages/signup.tsx
+++ b/web/apps/photos/src/pages/signup.tsx
@@ -1,7 +1,7 @@
-import { SignUpForm } from "@/components/auth/SignUpForm";
import { PhotosAuthShell } from "@/components/PhotosAuthShell";
import { featureFlags } from "@/feature-flags";
import type { SignUpPresentationProps } from "ente-accounts/components/SignUpContents";
+import { SignUpForm } from "ente-accounts/components/auth/SignUpForm";
import AccountsSignUpPage from "ente-accounts/pages/signup";
import type React from "react";
diff --git a/web/apps/photos/src/pages/two-factor/recover.tsx b/web/apps/photos/src/pages/two-factor/recover.tsx
index fa9c9e6e22..d793985230 100644
--- a/web/apps/photos/src/pages/two-factor/recover.tsx
+++ b/web/apps/photos/src/pages/two-factor/recover.tsx
@@ -1,6 +1,6 @@
-import { RecoverTwoFactorForm } from "@/components/auth/RecoveryForm";
import { PhotosAuthShell } from "@/components/PhotosAuthShell";
import { featureFlags } from "@/feature-flags";
+import { RecoverTwoFactorForm } from "ente-accounts/components/auth/RecoveryForm";
import AccountsTwoFactorRecoverPage, {
type TwoFactorRecoverPresentationProps,
} from "ente-accounts/pages/two-factor/recover";
diff --git a/web/apps/photos/src/pages/two-factor/verify.tsx b/web/apps/photos/src/pages/two-factor/verify.tsx
index 25443673cf..ada85f3178 100644
--- a/web/apps/photos/src/pages/two-factor/verify.tsx
+++ b/web/apps/photos/src/pages/two-factor/verify.tsx
@@ -1,6 +1,6 @@
-import { TwoFactorForm } from "@/components/auth/TwoFactorForm";
import { PhotosAuthShell } from "@/components/PhotosAuthShell";
import { featureFlags } from "@/feature-flags";
+import { TwoFactorForm } from "ente-accounts/components/auth/TwoFactorForm";
import AccountsTwoFactorVerifyPage, {
type TwoFactorVerifyPresentationProps,
} from "ente-accounts/pages/two-factor/verify";
diff --git a/web/apps/photos/src/pages/verify.tsx b/web/apps/photos/src/pages/verify.tsx
index 78fb233273..62f78d4ae7 100644
--- a/web/apps/photos/src/pages/verify.tsx
+++ b/web/apps/photos/src/pages/verify.tsx
@@ -1,8 +1,8 @@
import { PasskeyVerificationForm } from "@/components/auth/PasskeyVerificationForm";
-import { SecondFactorChoiceDialog } from "@/components/auth/SecondFactorChoiceDialog";
-import { VerifyEmailForm } from "@/components/auth/VerifyEmailForm";
import { PhotosAuthShell } from "@/components/PhotosAuthShell";
import { featureFlags } from "@/feature-flags";
+import { SecondFactorChoiceDialog } from "ente-accounts/components/auth/SecondFactorChoiceDialog";
+import { VerifyEmailForm } from "ente-accounts/components/auth/VerifyEmailForm";
import type { VerifyingPasskeyPresentationProps } from "ente-accounts/components/LoginComponents";
import AccountsVerifyPage, {
type VerifyEmailPresentationProps,