π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Split profile creation and photo onboarding
Anand Baburajan71ee5cd9d0d8
diff --git a/web/apps/space/public/_redirects b/web/apps/space/public/_redirectsindex 20f5de5e0c..46215c87d6 100644--- a/web/apps/space/public/_redirects+++ b/web/apps/space/public/_redirects@@ -17,7 +17,8 @@/manifest.webmanifest /manifest.webmanifest 200/passkeys/finish /passkeys/finish 200/passkeys/verify /passkeys/verify 200-/setup-profile /setup-profile 200+/create-profile /create-profile 200+/add-profile-photo /add-profile-photo 200/signup /signup 200/two-factor/verify /two-factor/verify 200/verify /verify 200diff --git a/web/apps/space/src/components/SpaceAvatarCropPage.tsx b/web/apps/space/src/components/SpaceAvatarCropPage.tsxindex a8ae784f04..6a3d8e1945 100644--- a/web/apps/space/src/components/SpaceAvatarCropPage.tsx+++ b/web/apps/space/src/components/SpaceAvatarCropPage.tsx@@ -10,6 +10,12 @@ const textBase = "#000";const textLight = "#969696";const warning = "#F63A3A";+export const spaceAppAvatarCropSize =+ "min(calc(100vw - 48px), calc(100dvh - 308px), 342px)";+export const spaceSetupAvatarCropSize =+ "min(calc(100vw - 48px), calc(100dvh - 294px), 342px)";+export const spaceSetupAvatarCropFooterHeight = "130px";+interface SpaceAvatarCropPageProps {aspect?: number;background: string;@@ -26,6 +32,7 @@ interface SpaceAvatarCropPageProps {onCropComplete: (croppedArea: Area, croppedAreaPixels: Area) => void;onDone: () => void;onZoomChange: (zoom: number) => void;+ secondaryActionVariant?: "button" | "text";title?: string;zoom: number;}@@ -33,9 +40,16 @@ interface SpaceAvatarCropPageProps {const SpaceAvatarCropPageButton: React.FC<{children: React.ReactNode;disabled?: boolean;+ height?: number;loading?: boolean;onClick?: () => void;-}> = ({ children, disabled = false, loading = false, onClick }) => (+}> = ({+ children,+ disabled = false,+ height = 44,+ loading = false,+ onClick,+}) => (<BoxclassName={!disabled || loading ? "green-bg" : undefined}component="button"@@ -56,7 +70,7 @@ const SpaceAvatarCropPageButton: React.FC<{fontFamily: '"Inter Variable", Inter, sans-serif',fontSize: 14,fontWeight: 500,- height: 44,+ height,justifyContent: "center",lineHeight: "20px",minWidth: 0,@@ -73,11 +87,12 @@ const SpaceAvatarCropPageButton: React.FC<{</Box>);-const SpaceAvatarCropPageLinkButton: React.FC<{+const SpaceAvatarCropPageSecondaryAction: React.FC<{children: React.ReactNode;disabled?: boolean;onClick?: () => void;-}> = ({ children, disabled = false, onClick }) => (+ variant: "button" | "text";+}> = ({ children, disabled = false, onClick, variant }) => (<Boxcomponent="button"type="button"@@ -85,31 +100,38 @@ const SpaceAvatarCropPageLinkButton: React.FC<{onClick={onClick}sx={{alignItems: "center",- bgcolor: "transparent",+ alignSelf: "center",+ bgcolor: variant == "button" ? "#F2F2F2" : "transparent",border: 0,+ borderRadius: variant == "button" ? "20px" : 0,color: "#666",cursor: disabled ? "default" : "pointer",display: "flex",fontFamily: '"Inter Variable", Inter, sans-serif',fontSize: 14,- fontWeight: 500,+ fontWeight: variant == "button" ? 600 : 500,+ height: variant == "button" ? 48 : undefined,justifyContent: "center",lineHeight: "20px",minWidth: 0,- opacity: 0.8,- p: 0,+ opacity: disabled ? 0.56 : variant == "button" ? 1 : 0.8,+ p: variant == "button" ? undefined : 0,+ px: variant == "button" ? 2 : undefined,textAlign: "center",- textDecoration: "underline",+ textDecoration: variant == "text" ? "underline" : "none",textDecorationSkipInk: "none",textUnderlineOffset: "2px",textUnderlinePosition: "from-font",- width: "fit-content",- alignSelf: "center",+ width: variant == "button" ? "100%" : "fit-content","&:focus-visible": {- borderRadius: "4px",+ borderRadius: variant == "button" ? "20px" : "4px",outline: `2px solid ${green}`,- outlineOffset: 4,+ outlineOffset: variant == "button" ? 2 : 4,},+ "&:hover":+ !disabled && variant == "button"+ ? { bgcolor: "#ECECEC" }+ : undefined,}}>{children}@@ -130,6 +152,7 @@ export const SpaceAvatarCropPage: React.FC<SpaceAvatarCropPageProps> = ({onCropComplete,onDone,onZoomChange,+ secondaryActionVariant = "text",title = "Edit profile picture",zoom,aspect = 1,@@ -144,8 +167,8 @@ export const SpaceAvatarCropPage: React.FC<SpaceAvatarCropPageProps> = ({component="main"sx={{"--avatar-crop-size": isAppHeader- ? "min(calc(100vw - 48px), calc(100dvh - 308px), 342px)"- : "min(calc(100vw - 48px), calc(100dvh - 294px), 342px)",+ ? spaceAppAvatarCropSize+ : spaceSetupAvatarCropSize,"--profile-crop-width": isCoverCrop? "100%": "min(calc(100vw - 48px), 342px)",@@ -167,13 +190,15 @@ export const SpaceAvatarCropPage: React.FC<SpaceAvatarCropPageProps> = ({display: "grid",gridTemplateRows: isAppHeader? "56px minmax(0, 1fr) auto auto"- : "42px minmax(0, 1fr) auto auto",+ : `42px minmax(0, 1fr) auto ${spaceSetupAvatarCropFooterHeight}`,height: "100%",minHeight: 0,mx: "auto",overflowX: "hidden",overflowY: "hidden",- pb: "calc(24px + env(safe-area-inset-bottom))",+ pb: isAppHeader+ ? "calc(24px + env(safe-area-inset-bottom))"+ : "calc(20px + env(safe-area-inset-bottom))",pt: isAppHeader ? 0 : "32px",px: isAppHeader ? 0 : 3,width: "100%",@@ -341,7 +366,10 @@ export const SpaceAvatarCropPage: React.FC<SpaceAvatarCropPageProps> = ({boxSizing: "border-box",display: "flex",flexDirection: "column",- gap: "16px",+ gap:+ secondaryActionVariant == "button"+ ? "10px"+ : "16px",gridRow: 4,pt: 3,px: isAppHeader ? 3 : 0,@@ -350,17 +378,21 @@ export const SpaceAvatarCropPage: React.FC<SpaceAvatarCropPageProps> = ({><SpaceAvatarCropPageButtondisabled={isSaving || isDoneDisabled}+ height={+ secondaryActionVariant == "button" ? 48 : undefined+ }loading={isSaving}onClick={onDone}>{isSaving ? <SpaceButtonSpinner /> : "Done"}</SpaceAvatarCropPageButton>- <SpaceAvatarCropPageLinkButton+ <SpaceAvatarCropPageSecondaryActiondisabled={isSaving}onClick={onChooseAnother}+ variant={secondaryActionVariant}>Change picture- </SpaceAvatarCropPageLinkButton>+ </SpaceAvatarCropPageSecondaryAction></Box></Box></Box>diff --git a/web/apps/space/src/components/SpaceAvatarEditButton.tsx b/web/apps/space/src/components/SpaceAvatarEditButton.tsxdeleted file mode 100644index a366c5b3b3..0000000000--- a/web/apps/space/src/components/SpaceAvatarEditButton.tsx+++ /dev/null@@ -1,80 +0,0 @@-import { Box } from "@mui/material";-import React from "react";-import { spaceTouchTargetSize } from "styles/touchTargets";--const green = "#08C225";-const editButtonVisualSize = 30;--const PencilIcon: React.FC = () => (- <Box- component="svg"- viewBox="0 0 24 24"- aria-hidden- sx={{ display: "block", height: 18, width: 18 }}- >- <path- d="M14.25 5.25L18.75 9.75M4.75 19.25L8.9 18.45L19.35 8C20.25 7.1 20.25 5.65 19.35 4.75C18.45 3.85 17 3.85 16.1 4.75L5.65 15.2L4.75 19.25Z"- fill="none"- stroke="currentColor"- strokeLinecap="round"- strokeLinejoin="round"- strokeWidth="1.8"- />- </Box>-);--interface SpaceAvatarEditButtonProps {- ariaLabel?: string;- disabled?: boolean;- onClick?: () => void;-}--export const SpaceAvatarEditButton: React.FC<SpaceAvatarEditButtonProps> = ({- ariaLabel = "Edit profile picture",- disabled = false,- onClick,-}) => (- <Box- component="button"- type="button"- aria-label={ariaLabel}- disabled={disabled}- onClick={onClick}- sx={{- alignItems: "center",- bgcolor: "transparent",- border: 0,- borderRadius: "50%",- bottom: 3,- color: "white",- cursor: disabled ? "default" : "pointer",- display: "flex",- height: spaceTouchTargetSize,- justifyContent: "center",- position: "absolute",- right: -5,- width: spaceTouchTargetSize,- "&:focus-visible": {- outline: `2px solid ${green}`,- outlineOffset: 3,- },- }}- >- <Box- className="green-bg"- component="span"- sx={{- alignItems: "center",- bgcolor: green,- borderRadius: "50%",- boxShadow: "0 1px 3px rgba(0, 0, 0, 0.08)",- display: "flex",- height: editButtonVisualSize,- justifyContent: "center",- width: editButtonVisualSize,- }}- >- <PencilIcon />- </Box>- </Box>-);diff --git a/web/apps/space/src/pages/add-profile-photo.tsx b/web/apps/space/src/pages/add-profile-photo.tsxnew file mode 100644index 0000000000..e613501169--- /dev/null+++ b/web/apps/space/src/pages/add-profile-photo.tsx@@ -0,0 +1,119 @@+import { SpacePageMeta } from "components/SpacePageMeta";+import { SpaceRouteFallback } from "components/SpaceRouteFallback";+import React, { useEffect, useMemo, useState } from "react";+import { SetupProfilePhotoScreen } from "screens/SetupProfilePhotoScreen";+import { setupProfileBackground } from "screens/SetupProfileScreen";+import { savedPendingSpaceInvite } from "services/spaceInvite";+import {+ saveSpaceProfile,+ spaceProfileErrorMessage,+} from "services/spaceProfile";+import { useSpaceAppState } from "state/spaceAppState";+import { acceptPendingSpaceInvite } from "utils/spacePendingInvite";+import { spaceRoutes } from "utils/spaceRoutes";+import { useSpaceRouter } from "utils/spaceRouteTransitions";++const Page: React.FC = () => {+ const router = useSpaceRouter();+ const {+ onboardingEntrySource,+ pendingCreateProfile,+ profile,+ profileLoadError,+ profileLoadStatus,+ setPendingCreateProfile,+ setProfile,+ setSkipNextHomeFeedSkeleton,+ } = useSpaceAppState();+ const createProfileSource = pendingCreateProfile?.source ?? "verify";+ const isAddFriendLinkOnboarding =+ onboardingEntrySource == "add-friend-link";+ const [setupError, setSetupError] = useState<string>();+ const [isSubmitting, setIsSubmitting] = useState(false);+ const existingProfileRoute = useMemo(+ () =>+ isAddFriendLinkOnboarding || createProfileSource == "login"+ ? spaceRoutes.home+ : spaceRoutes.invite,+ [createProfileSource, isAddFriendLinkOnboarding],+ );++ useEffect(() => {+ if (profileLoadStatus != "ready" || isSubmitting) {+ return;+ }++ if (profile) {+ void acceptPendingSpaceInvite()+ .catch((error: unknown) =>+ console.error("Failed to accept pending invite", error),+ )+ .finally(() => void router.replace(existingProfileRoute));+ } else if (!pendingCreateProfile) {+ void router.replace(spaceRoutes.createProfile());+ }+ }, [+ existingProfileRoute,+ isSubmitting,+ pendingCreateProfile,+ profile,+ profileLoadStatus,+ router,+ ]);++ if (profileLoadStatus != "ready" || profile || !pendingCreateProfile) {+ return (+ <SpaceRouteFallback+ background={setupProfileBackground}+ message={profileLoadError}+ />+ );+ }++ return (+ <>+ <SpacePageMeta themeColor={setupProfileBackground} />+ <SetupProfilePhotoScreen+ errorMessage={setupError}+ isSubmitting={isSubmitting}+ onBack={() =>+ void router.push(+ spaceRoutes.createProfile(createProfileSource),+ )+ }+ onContinue={async (avatarFile) => {+ setIsSubmitting(true);+ setSetupError(undefined);+ try {+ const savedProfile = await saveSpaceProfile(+ {+ avatarFile,+ avatarUrl: null,+ fullName: pendingCreateProfile.fullName,+ username: pendingCreateProfile.username,+ },+ savedPendingSpaceInvite()?.spaceId,+ );+ const acceptedInvite = await acceptPendingSpaceInvite();+ setProfile(savedProfile);+ setPendingCreateProfile(null);+ if (!acceptedInvite) {+ setSkipNextHomeFeedSkeleton(true);+ }+ await router.push(+ isAddFriendLinkOnboarding+ ? spaceRoutes.home+ : spaceRoutes.invite,+ );+ } catch (error) {+ console.error("Space profile setup failed", error);+ setSetupError(spaceProfileErrorMessage(error));+ setIsSubmitting(false);+ }+ }}+ />+ </>+ );+};++export default Page;diff --git a/web/apps/space/src/pages/setup-profile.tsx b/web/apps/space/src/pages/create-profile.tsxsimilarity index 68%rename from web/apps/space/src/pages/setup-profile.tsxrename to web/apps/space/src/pages/create-profile.tsxindex 230e14f7c8..c05284f58a 100644--- a/web/apps/space/src/pages/setup-profile.tsx+++ b/web/apps/space/src/pages/create-profile.tsx@@ -5,35 +5,32 @@ import {SetupProfileScreen,setupProfileBackground,} from "screens/SetupProfileScreen";-import { savedPendingSpaceInvite } from "services/spaceInvite";import {- saveSpaceProfile,- spaceProfileErrorMessage,spaceUsernameAvailability,spaceUsernameValidationError,} from "services/spaceProfile";import { useSpaceAppState } from "state/spaceAppState";import { acceptPendingSpaceInvite } from "utils/spacePendingInvite";-import { setupProfileSourceFromQuery, spaceRoutes } from "utils/spaceRoutes";+import { createProfileSourceFromQuery, spaceRoutes } from "utils/spaceRoutes";import { useSpaceRouter } from "utils/spaceRouteTransitions";const Page: React.FC = () => {const router = useSpaceRouter();const {onboardingEntrySource,+ pendingCreateProfile,profile,profileLoadError,profileLoadStatus,refreshProfile,- setProfile,- setSkipNextHomeFeedSkeleton,+ setPendingCreateProfile,} = useSpaceAppState();- const backSource = setupProfileSourceFromQuery(router.query.from);+ const backSource = createProfileSourceFromQuery(router.query.from);const isAddFriendLinkOnboarding =onboardingEntrySource == "add-friend-link";- const [setupError, setSetupError] = useState<string>();- const [isSubmitting, setIsSubmitting] = useState(false);- const [draftUsername, setDraftUsername] = useState("");+ const [draftUsername, setDraftUsername] = useState(+ pendingCreateProfile?.username ?? "",+ );const [usernameStatus, setUsernameStatus] = useState<"available" | "unavailable">();@@ -112,9 +109,7 @@ const Page: React.FC = () => {<><SpacePageMeta themeColor={setupProfileBackground} /><SetupProfileScreen- ctaLabel={isAddFriendLinkOnboarding ? "Done" : "Next"}- errorMessage={setupError}- isSubmitting={isSubmitting}+ initialProfile={pendingCreateProfile}onBack={() =>void router.push(backSource == "login"@@ -122,29 +117,12 @@ const Page: React.FC = () => {: spaceRoutes.verify,)}- onContinue={async (nextProfile) => {- setIsSubmitting(true);- setSetupError(undefined);- try {- const savedProfile = await saveSpaceProfile(- nextProfile,- savedPendingSpaceInvite()?.spaceId,- );- const acceptedInvite = await acceptPendingSpaceInvite();- setProfile(savedProfile);- if (!acceptedInvite) {- setSkipNextHomeFeedSkeleton(true);- }- void router.push(- isAddFriendLinkOnboarding- ? spaceRoutes.home- : spaceRoutes.invite,- );- } catch (error) {- console.error("Space profile setup failed", error);- setSetupError(spaceProfileErrorMessage(error));- setIsSubmitting(false);- }+ onContinue={(nextProfile) => {+ setPendingCreateProfile({+ ...nextProfile,+ source: backSource,+ });+ void router.push(spaceRoutes.addProfilePhoto);}}onUsernameChange={setDraftUsername}usernameStatus={usernameStatus}diff --git a/web/apps/space/src/pages/invite.tsx b/web/apps/space/src/pages/invite.tsxindex 6b3fd3b094..3912e22c33 100644--- a/web/apps/space/src/pages/invite.tsx+++ b/web/apps/space/src/pages/invite.tsx@@ -16,7 +16,7 @@ const Page: React.FC = () => {useEffect(() => {if (profileLoadStatus == "ready" && !profile) {- void router.replace(spaceRoutes.setupProfile());+ void router.replace(spaceRoutes.createProfile());}}, [profile, profileLoadStatus, router]);diff --git a/web/apps/space/src/pages/verify.tsx b/web/apps/space/src/pages/verify.tsxindex df299b43e3..0f1b400d92 100644--- a/web/apps/space/src/pages/verify.tsx+++ b/web/apps/space/src/pages/verify.tsx@@ -133,14 +133,14 @@ const Page: React.FC = () => {const verifySignupEmail = async (code: string) => {if (!isLiveSignupVerification) {- void router.push(spaceRoutes.setupProfile());+ void router.push(spaceRoutes.createProfile());return;}try {await completeSpaceSignup(signupEmail, code);setIsLiveSignupVerification(false);- void router.push(spaceRoutes.setupProfile());+ void router.push(spaceRoutes.createProfile());} catch (error) {if (!isExpectedVerificationError(error)) {console.error("Space signup verification failed", error);diff --git a/web/apps/space/src/screens/ProfileImageViewerScreen.tsx b/web/apps/space/src/screens/ProfileImageViewerScreen.tsxindex 35e5135ca0..478c536121 100644--- a/web/apps/space/src/screens/ProfileImageViewerScreen.tsx+++ b/web/apps/space/src/screens/ProfileImageViewerScreen.tsx@@ -1,6 +1,7 @@import { ArrowLeft02Icon } from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";import { Box, Skeleton } from "@mui/material";+import { spaceAppAvatarCropSize } from "components/SpaceAvatarCropPage";import { SpaceAvatarImage } from "components/SpaceAvatarImage";import React, { useRef } from "react";import type { SetupProfile } from "screens/SetupProfileScreen";@@ -203,7 +204,7 @@ export const ProfileImageViewerScreen: React.FC<display: "flex",justifyContent: "center",overflow: "hidden",- width: "min(64vw, 240px)",+ width: spaceAppAvatarCropSize,}}>{isAvatarURLPending ? (diff --git a/web/apps/space/src/screens/SetupProfilePhotoScreen.tsx b/web/apps/space/src/screens/SetupProfilePhotoScreen.tsxnew file mode 100644index 0000000000..5ff3f9a2b5--- /dev/null+++ b/web/apps/space/src/screens/SetupProfilePhotoScreen.tsx@@ -0,0 +1,438 @@+import { Box } from "@mui/material";+import {+ SpaceAvatarCropPage,+ spaceSetupAvatarCropFooterHeight,+ spaceSetupAvatarCropSize,+} from "components/SpaceAvatarCropPage";+import { SpaceAvatarImage } from "components/SpaceAvatarImage";+import { SpaceBackIcon } from "components/SpaceBackIcon";+import { SpaceButtonSpinner } from "components/SpaceButtonSpinner";+import React, { useEffect, useRef, useState } from "react";+import type { Area, Point } from "react-easy-crop";+import { setupProfileBackground } from "screens/SetupProfileScreen";+import { spaceTouchTargetSize } from "styles/touchTargets";+import {+ prepareSpaceAvatarImageFromCrop,+ spaceAvatarCropImageForFile,+ spaceAvatarImageErrorMessage,+ spaceAvatarImageInputAccept,+} from "utils/spacePostImage";++const green = "#08C225";+const textBase = "#000";+const textLight = "#969696";+const textMuted = "#666";+const warning = "#F63A3A";++interface AvatarCropImage {+ file: File;+ url: string;+}++interface SetupProfilePhotoScreenProps {+ errorMessage?: string;+ isSubmitting?: boolean;+ onBack: () => void;+ onContinue: (avatarFile: File | null) => Promise<void>;+}++const AvatarPlaceholder: React.FC = () => (+ <SpaceAvatarImage aria-hidden border="4px solid white" borderRadius="50%" />+);++export const SetupProfilePhotoScreen: React.FC<+ SetupProfilePhotoScreenProps+> = ({ errorMessage, isSubmitting = false, onBack, onContinue }) => {+ const [avatarCropImage, setAvatarCropImage] =+ useState<AvatarCropImage | null>(null);+ const [avatarCrop, setAvatarCrop] = useState<Point>({ x: 0, y: 0 });+ const [avatarCropPixels, setAvatarCropPixels] = useState<Area | null>(null);+ const [avatarError, setAvatarError] = useState<string>();+ const [avatarZoom, setAvatarZoom] = useState(1);+ const [isApplyingAvatarCrop, setIsApplyingAvatarCrop] = useState(false);+ const [isPreparingAvatar, setIsPreparingAvatar] = useState(false);+ const [isSkipping, setIsSkipping] = useState(false);+ const avatarCropUrlRef = useRef<string | null>(null);+ const avatarSelectionIDRef = useRef(0);+ const fileInputRef = useRef<HTMLInputElement | null>(null);+ const canAddPicture = !isSubmitting && !isPreparingAvatar;+ const canSkip = !isSubmitting && !isPreparingAvatar;++ useEffect(+ () => () => {+ if (avatarCropUrlRef.current) {+ URL.revokeObjectURL(avatarCropUrlRef.current);+ }+ },+ [],+ );++ const clearAvatarCropImage = () => {+ avatarSelectionIDRef.current += 1;+ if (avatarCropUrlRef.current) {+ URL.revokeObjectURL(avatarCropUrlRef.current);+ avatarCropUrlRef.current = null;+ }+ setAvatarCropImage(null);+ setAvatarCrop({ x: 0, y: 0 });+ setAvatarCropPixels(null);+ setAvatarZoom(1);+ setIsApplyingAvatarCrop(false);+ setIsPreparingAvatar(false);+ };++ const prepareSelectedAvatar = async (file: File, selectionID: number) => {+ setIsPreparingAvatar(true);+ if (avatarCropUrlRef.current) {+ URL.revokeObjectURL(avatarCropUrlRef.current);+ avatarCropUrlRef.current = null;+ }+ setAvatarCropImage(null);+ setAvatarCropPixels(null);+ try {+ const cropImage = await spaceAvatarCropImageForFile(file);+ if (avatarSelectionIDRef.current != selectionID) {+ URL.revokeObjectURL(cropImage.url);+ return;+ }++ avatarCropUrlRef.current = cropImage.url;+ setAvatarCrop({ x: 0, y: 0 });+ setAvatarCropImage({ file, url: cropImage.url });+ setAvatarCropPixels(null);+ setAvatarError(undefined);+ setAvatarZoom(1);+ } catch (error) {+ if (avatarSelectionIDRef.current != selectionID) return;+ console.error("Failed to prepare space avatar", error);+ setAvatarError(spaceAvatarImageErrorMessage(error));+ } finally {+ if (avatarSelectionIDRef.current == selectionID) {+ setIsPreparingAvatar(false);+ }+ }+ };++ const handleAvatarChange: React.ChangeEventHandler<HTMLInputElement> = (+ event,+ ) => {+ const file = event.target.files?.[0];+ event.target.value = "";+ if (!file) return;++ const selectionID = avatarSelectionIDRef.current + 1;+ avatarSelectionIDRef.current = selectionID;+ setAvatarError(undefined);+ void prepareSelectedAvatar(file, selectionID);+ };++ const applyAvatarCrop = async () => {+ if (!avatarCropImage || !avatarCropPixels) return;++ setIsApplyingAvatarCrop(true);+ try {+ const avatar = await prepareSpaceAvatarImageFromCrop(+ avatarCropImage.file,+ avatarCropImage.url,+ avatarCropPixels,+ );++ setAvatarError(undefined);+ await onContinue(avatar.file);+ setIsApplyingAvatarCrop(false);+ } catch (error) {+ console.error("Failed to crop space avatar", error);+ setAvatarError(spaceAvatarImageErrorMessage(error));+ setIsApplyingAvatarCrop(false);+ }+ };++ const skipProfilePicture = async () => {+ setIsSkipping(true);+ await onContinue(null);+ setIsSkipping(false);+ };++ const avatarFileInput = (+ <Box+ component="input"+ ref={fileInputRef}+ accept={spaceAvatarImageInputAccept}+ onChange={handleAvatarChange}+ type="file"+ sx={{ display: "none" }}+ />+ );++ if (avatarCropImage) {+ return (+ <>+ {avatarFileInput}+ <SpaceAvatarCropPage+ background={setupProfileBackground}+ crop={avatarCrop}+ errorMessage={errorMessage ?? avatarError}+ imageURL={avatarCropImage.url}+ isDoneDisabled={!avatarCropPixels}+ isSaving={isApplyingAvatarCrop || isSubmitting}+ onBack={clearAvatarCropImage}+ onChooseAnother={() => fileInputRef.current?.click()}+ onCropChange={setAvatarCrop}+ onCropComplete={(_croppedArea, croppedAreaPixels) =>+ setAvatarCropPixels(croppedAreaPixels)+ }+ onDone={() => void applyAvatarCrop()}+ onZoomChange={setAvatarZoom}+ secondaryActionVariant="button"+ title="Add a profile photo"+ zoom={avatarZoom}+ />+ </>+ );+ }++ return (+ <Box+ component="main"+ sx={{+ bgcolor: setupProfileBackground,+ color: textBase,+ display: "grid",+ height: "100dvh",+ inset: 0,+ overflow: "hidden",+ placeItems: { xs: "stretch", sm: "start center" },+ position: "fixed",+ width: "100%",+ }}+ >+ <Box+ sx={{+ bgcolor: setupProfileBackground,+ boxSizing: "border-box",+ display: "grid",+ gridTemplateRows: `42px minmax(0, 1fr) auto ${spaceSetupAvatarCropFooterHeight}`,+ height: "100%",+ minHeight: 0,+ mx: "auto",+ overflow: "hidden",+ pb: "calc(20px + env(safe-area-inset-bottom))",+ pt: "32px",+ px: 3,+ width: "100%",+ "@media (min-width: 600px)": { maxWidth: 390 },+ }}+ >+ <Box+ component="header"+ sx={{+ display: "grid",+ gridTemplateColumns: `${spaceTouchTargetSize}px 1fr ${spaceTouchTargetSize}px`,+ height: spaceTouchTargetSize,+ width: "100%",+ }}+ >+ <Box+ component="button"+ type="button"+ aria-label="Back"+ disabled={isSubmitting}+ onClick={onBack}+ sx={{+ alignItems: "center",+ bgcolor: "transparent",+ border: 0,+ color: textBase,+ cursor: isSubmitting ? "default" : "pointer",+ display: "flex",+ height: spaceTouchTargetSize,+ justifyContent: "flex-start",+ p: 0,+ width: spaceTouchTargetSize,+ "&:focus-visible": {+ borderRadius: "50%",+ outline: `2px solid ${green}`,+ outlineOffset: 2,+ },+ }}+ >+ <SpaceBackIcon />+ </Box>+ <Box+ component="h1"+ sx={{+ alignSelf: "center",+ fontFamily: '"Inter Variable", Inter, sans-serif',+ fontSize: 20,+ fontWeight: 600,+ justifySelf: "center",+ lineHeight: "28px",+ m: 0,+ whiteSpace: "nowrap",+ }}+ >+ Add a profile photo+ </Box>+ <Box />+ </Box>++ {avatarFileInput}+ <Box+ component="button"+ type="button"+ aria-label="Add profile picture"+ disabled={!canAddPicture}+ onClick={() => fileInputRef.current?.click()}+ sx={{+ alignItems: "center",+ alignSelf: "center",+ aspectRatio: "1 / 1",+ bgcolor: "transparent",+ border: 0,+ borderRadius: "50%",+ color: textBase,+ cursor: canAddPicture ? "pointer" : "default",+ display: "flex",+ gridRow: 2,+ justifyContent: "center",+ justifySelf: "center",+ overflow: "hidden",+ p: 0,+ width: spaceSetupAvatarCropSize,+ "&:focus-visible": {+ outline: `2px solid ${green}`,+ outlineOffset: 3,+ },+ }}+ >+ {isPreparingAvatar ? (+ <Box+ component="span"+ sx={{+ color: textLight,+ fontFamily:+ '"Inter Variable", Inter, sans-serif',+ fontSize: 13,+ fontWeight: 600,+ lineHeight: "18px",+ }}+ >+ Preparing...+ </Box>+ ) : (+ <AvatarPlaceholder />+ )}+ </Box>+ {(avatarError || errorMessage) && (+ <Box+ role="alert"+ sx={{+ color: warning,+ fontFamily: '"Inter Variable", Inter, sans-serif',+ fontSize: 13,+ fontWeight: 500,+ gridRow: 3,+ lineHeight: "18px",+ mt: 2,+ textAlign: "center",+ }}+ >+ {errorMessage ?? avatarError}+ </Box>+ )}++ <Box+ sx={{+ bgcolor: setupProfileBackground,+ bottom: 0,+ boxSizing: "border-box",+ display: "flex",+ flexDirection: "column",+ gap: "10px",+ left: "50%",+ maxWidth: 390,+ p: "16px 24px calc(20px + env(safe-area-inset-bottom))",+ position: "fixed",+ transform: "translateX(-50%)",+ width: "100%",+ }}+ >+ <Box+ className="green-bg"+ component="button"+ type="button"+ disabled={!canAddPicture}+ aria-label={isPreparingAvatar ? "Preparing" : undefined}+ aria-busy={isPreparingAvatar ? true : undefined}+ onClick={() => fileInputRef.current?.click()}+ sx={{+ alignItems: "center",+ bgcolor: green,+ border: 0,+ borderRadius: "20px",+ color: "white",+ cursor: canAddPicture ? "pointer" : "default",+ display: "flex",+ fontFamily: '"Inter Variable", Inter, sans-serif',+ fontSize: 14,+ fontWeight: 500,+ height: 48,+ justifyContent: "center",+ lineHeight: "20px",+ p: "14px 24px",+ width: "100%",+ "&:focus-visible": {+ outline: `2px solid ${green}`,+ outlineOffset: 3,+ },+ "&:hover": canAddPicture+ ? { bgcolor: "#07AE22" }+ : undefined,+ }}+ >+ {isPreparingAvatar ? (+ <SpaceButtonSpinner />+ ) : (+ "Add picture"+ )}+ </Box>+ <Box+ component="button"+ type="button"+ disabled={!canSkip}+ aria-label={isSkipping ? "Saving" : undefined}+ aria-busy={isSkipping ? true : undefined}+ onClick={() => void skipProfilePicture()}+ sx={{+ alignItems: "center",+ bgcolor: "#F2F2F2",+ border: 0,+ borderRadius: "20px",+ color: textMuted,+ cursor: canSkip ? "pointer" : "default",+ display: "flex",+ fontFamily: '"Inter Variable", Inter, sans-serif',+ fontSize: 14,+ fontWeight: 600,+ height: 48,+ justifyContent: "center",+ lineHeight: "20px",+ opacity: canSkip || isSkipping ? 1 : 0.56,+ p: "14px 24px",+ width: "100%",+ "&:focus-visible": {+ outline: `2px solid ${green}`,+ outlineOffset: 2,+ },+ "&:hover": canSkip+ ? { bgcolor: "#ECECEC" }+ : undefined,+ }}+ >+ {isSkipping ? <SpaceButtonSpinner /> : "Skip for now"}+ </Box>+ </Box>+ </Box>+ </Box>+ );+};diff --git a/web/apps/space/src/screens/SetupProfileScreen.tsx b/web/apps/space/src/screens/SetupProfileScreen.tsxindex 7c86d8559c..17f1733db1 100644--- a/web/apps/space/src/screens/SetupProfileScreen.tsx+++ b/web/apps/space/src/screens/SetupProfileScreen.tsx@@ -1,18 +1,7 @@import { Box } from "@mui/material";-import { SpaceAvatarCropPage } from "components/SpaceAvatarCropPage";-import { SpaceAvatarEditButton } from "components/SpaceAvatarEditButton";-import { SpaceAvatarImage } from "components/SpaceAvatarImage";import { SpaceBackIcon } from "components/SpaceBackIcon";-import { SpaceButtonSpinner } from "components/SpaceButtonSpinner";-import React, { useEffect, useRef, useState } from "react";-import type { Area, Point } from "react-easy-crop";+import React, { useState } from "react";import { spaceTouchTargetSize } from "styles/touchTargets";-import {- prepareSpaceAvatarImageFromCrop,- spaceAvatarCropImageForFile,- spaceAvatarImageErrorMessage,- spaceAvatarImageInputAccept,-} from "utils/spacePostImage";export const setupProfileBackground = "#FAFAFA";@@ -42,17 +31,12 @@ export interface SetupProfileInput extends SetupProfile {coverFile?: File | null;}-interface AvatarCropImage {- file: File;- url: string;-}+export type SetupProfileDetails = Pick<SetupProfile, "fullName" | "username">;interface SetupProfileScreenProps {- ctaLabel?: string;- errorMessage?: string;- isSubmitting?: boolean;+ initialProfile?: SetupProfileDetails | null;onBack: () => void;- onContinue?: (profile: SetupProfileInput) => Promise<void> | void;+ onContinue: (profile: SetupProfileDetails) => void;onUsernameChange?: (username: string) => void;usernameStatus?: "available" | "unavailable";}@@ -69,10 +53,6 @@ interface TextInputProps {value?: string;}-const AvatarPlaceholder: React.FC = () => (- <SpaceAvatarImage aria-hidden border="4px solid white" borderRadius="50%" />-);-const CheckIcon: React.FC = () => (<Boxcomponent="svg"@@ -215,193 +195,34 @@ const TextInput: React.FC<TextInputProps> = ({);export const SetupProfileScreen: React.FC<SetupProfileScreenProps> = ({- ctaLabel = "Next",- errorMessage,- isSubmitting = false,+ initialProfile,onBack,onContinue,onUsernameChange,usernameStatus,}) => {- const [avatarFile, setAvatarFile] = useState<File | null>(null);- const [avatarUrl, setAvatarUrl] = useState<string | null>(null);- const [avatarCropImage, setAvatarCropImage] =- useState<AvatarCropImage | null>(null);- const [avatarCrop, setAvatarCrop] = useState<Point>({ x: 0, y: 0 });- const [avatarCropPixels, setAvatarCropPixels] = useState<Area | null>(null);- const [avatarError, setAvatarError] = useState<string>();- const [avatarZoom, setAvatarZoom] = useState(1);- const [username, setUsername] = useState("");- const [fullName, setFullName] = useState("");- const [isApplyingAvatarCrop, setIsApplyingAvatarCrop] = useState(false);- const [isPreparingAvatar, setIsPreparingAvatar] = useState(false);- const avatarCropUrlRef = useRef<string | null>(null);- const avatarUrlRef = useRef<string | null>(null);- const avatarSelectionIDRef = useRef(0);- const fileInputRef = useRef<HTMLInputElement | null>(null);-+ const [username, setUsername] = useState(initialProfile?.username ?? "");+ const [fullName, setFullName] = useState(initialProfile?.fullName ?? "");const canContinue =- !isSubmitting &&- !avatarCropImage &&- !isApplyingAvatarCrop &&- !isPreparingAvatar &&usernameStatus != "unavailable" &&username.trim().length > 0 &&fullName.trim().length > 0;- const isContinueButtonActive = canContinue || isSubmitting;-- useEffect(- () => () => {- if (avatarCropUrlRef.current) {- URL.revokeObjectURL(avatarCropUrlRef.current);- }- if (avatarUrlRef.current) URL.revokeObjectURL(avatarUrlRef.current);- },- [],- );-- const clearAvatarCropImage = () => {- avatarSelectionIDRef.current += 1;- if (avatarCropUrlRef.current) {- URL.revokeObjectURL(avatarCropUrlRef.current);- avatarCropUrlRef.current = null;- }- setAvatarCropImage(null);- setAvatarCrop({ x: 0, y: 0 });- setAvatarCropPixels(null);- setAvatarZoom(1);- setIsApplyingAvatarCrop(false);- setIsPreparingAvatar(false);- };-- const prepareSelectedAvatar = async (file: File, selectionID: number) => {- setIsPreparingAvatar(true);- if (avatarCropUrlRef.current) {- URL.revokeObjectURL(avatarCropUrlRef.current);- avatarCropUrlRef.current = null;- }- setAvatarCropImage(null);- setAvatarCropPixels(null);- try {- const cropImage = await spaceAvatarCropImageForFile(file);- if (avatarSelectionIDRef.current != selectionID) {- URL.revokeObjectURL(cropImage.url);- return;- }-- avatarCropUrlRef.current = cropImage.url;- setAvatarCrop({ x: 0, y: 0 });- setAvatarCropImage({ file, url: cropImage.url });- setAvatarCropPixels(null);- setAvatarError(undefined);- setAvatarZoom(1);- } catch (error) {- if (avatarSelectionIDRef.current != selectionID) return;- console.error("Failed to prepare space avatar", error);- setAvatarError(spaceAvatarImageErrorMessage(error));- } finally {- if (avatarSelectionIDRef.current == selectionID) {- setIsPreparingAvatar(false);- }- }- };-- const handleAvatarChange: React.ChangeEventHandler<HTMLInputElement> = (- event,- ) => {- const file = event.target.files?.[0];- event.target.value = "";- if (!file) return;-- const selectionID = avatarSelectionIDRef.current + 1;- avatarSelectionIDRef.current = selectionID;- setAvatarError(undefined);-- void prepareSelectedAvatar(file, selectionID);- };-- const applyAvatarCrop = async () => {- if (!avatarCropImage || !avatarCropPixels) return;-- setIsApplyingAvatarCrop(true);- try {- const avatar = await prepareSpaceAvatarImageFromCrop(- avatarCropImage.file,- avatarCropImage.url,- avatarCropPixels,- );-- if (avatarUrlRef.current) URL.revokeObjectURL(avatarUrlRef.current);- const nextUrl = URL.createObjectURL(avatar.file);- avatarUrlRef.current = nextUrl;- setAvatarError(undefined);- setAvatarFile(avatar.file);- setAvatarUrl(nextUrl);- clearAvatarCropImage();- } catch (error) {- console.error("Failed to crop space avatar", error);- setAvatarError(spaceAvatarImageErrorMessage(error));- setIsApplyingAvatarCrop(false);- }- };const handleUsernameChange = (value: string) => {setUsername(value);onUsernameChange?.(value);};- const submitProfile = () => {+ const handleSubmit: React.SubmitEventHandler<HTMLFormElement> = (event) => {+ event.preventDefault();if (canContinue) {- void onContinue?.({- avatarFile,- avatarUrl,+ onContinue({fullName: fullName.trim(),username: username.trim(),});}};- const handleSubmit: React.SubmitEventHandler<HTMLFormElement> = (event) => {- event.preventDefault();- submitProfile();- };-- const avatarFileInput = (- <Box- component="input"- ref={fileInputRef}- accept={spaceAvatarImageInputAccept}- onChange={handleAvatarChange}- type="file"- sx={{ display: "none" }}- />- );-- if (avatarCropImage) {- return (- <>- {avatarFileInput}- <SpaceAvatarCropPage- background={setupProfileBackground}- crop={avatarCrop}- errorMessage={avatarError}- imageURL={avatarCropImage.url}- isDoneDisabled={!avatarCropPixels}- isSaving={isApplyingAvatarCrop}- onBack={clearAvatarCropImage}- onChooseAnother={() => fileInputRef.current?.click()}- onCropChange={setAvatarCrop}- onCropComplete={(_croppedArea, croppedAreaPixels) =>- setAvatarCropPixels(croppedAreaPixels)- }- onDone={() => void applyAvatarCrop()}- onZoomChange={setAvatarZoom}- zoom={avatarZoom}- />- </>- );- }-return (<Boxcomponent="main"@@ -476,7 +297,7 @@ export const SetupProfileScreen: React.FC<SetupProfileScreenProps> = ({whiteSpace: "nowrap",}}>- Setup your profile+ Create your profile</Box><Box /></Box>@@ -487,149 +308,50 @@ export const SetupProfileScreen: React.FC<SetupProfileScreenProps> = ({noValidateonSubmit={handleSubmit}sx={{- alignItems: "center",display: "flex",flexDirection: "column",- mt: "32px",+ gap: "24px",+ mt: "52px",width: "100%",}}>- {avatarFileInput}-- <Box sx={{ position: "relative" }}>- <Box- component="button"- type="button"- aria-label={- avatarUrl- ? "Change profile picture"- : "Upload profile picture"- }- disabled={isPreparingAvatar}- onClick={() => fileInputRef.current?.click()}- sx={{- alignItems: "center",- aspectRatio: "1 / 1",- bgcolor: "transparent",- border: 0,- borderRadius: "50%",- color: textBase,- cursor: isPreparingAvatar- ? "default"- : "pointer",- display: "flex",- height: 112,- justifyContent: "center",- overflow: "hidden",- p: 0,- position: "relative",- width: 112,- "&:focus-visible": {- outline: `2px solid ${green}`,- outlineOffset: 3,- },- }}- >- {isPreparingAvatar ? (- <Box- component="span"- sx={{- color: textLight,- fontFamily:- '"Inter Variable", Inter, sans-serif',- fontSize: 13,- fontWeight: 600,- lineHeight: "18px",- }}- >- Preparing...- </Box>- ) : avatarUrl ? (- <Box- component="img"- alt=""- src={avatarUrl}- sx={{- display: "block",- height: "100%",- objectFit: "cover",- objectPosition: "center",- width: "100%",- }}- />- ) : (- <AvatarPlaceholder />- )}- </Box>- <SpaceAvatarEditButton- disabled={isPreparingAvatar}- onClick={() => fileInputRef.current?.click()}- />- </Box>-- <Box- sx={{- display: "flex",- flexDirection: "column",- gap: "24px",- mt: "52px",- width: "100%",- }}- >- <TextInput- autoCapitalize="none"- endAdornment={- <UsernameStatusIcon status={usernameStatus} />- }- id="space-setup-profile-username"- label="Username"- onChange={handleUsernameChange}- placeholder="username"- required- startAdornment={- <Box- component="span"- aria-hidden- sx={{- color: textBase,- flexShrink: 0,- fontFamily:- '"Inter Variable", Inter, sans-serif',- fontSize: 14,- fontWeight: 500,- lineHeight: "20px",- }}- >- ente.space/- </Box>- }- value={username}- />- <TextInput- id="space-setup-profile-name"- label="Name"- onChange={setFullName}- placeholder="Enter your name"- required- value={fullName}- />- {(avatarError || errorMessage) && (+ <TextInput+ autoCapitalize="none"+ endAdornment={+ <UsernameStatusIcon status={usernameStatus} />+ }+ id="space-setup-profile-username"+ label="Username"+ onChange={handleUsernameChange}+ placeholder="username"+ required+ startAdornment={<Box- role="alert"+ component="span"+ aria-hiddensx={{- color: warning,+ color: textBase,+ flexShrink: 0,fontFamily:'"Inter Variable", Inter, sans-serif',- fontSize: 13,+ fontSize: 14,fontWeight: 500,- lineHeight: "18px",- mt: "-8px",+ lineHeight: "20px",}}>- {errorMessage ?? avatarError}+ ente.space/</Box>- )}- </Box>+ }+ value={username}+ />+ <TextInput+ id="space-setup-profile-name"+ label="Name"+ onChange={setFullName}+ placeholder="Enter your name"+ required+ value={fullName}+ /></Box><Box@@ -646,21 +368,17 @@ export const SetupProfileScreen: React.FC<SetupProfileScreenProps> = ({}}><Box- className={- isContinueButtonActive ? "green-bg" : undefined- }+ className={canContinue ? "green-bg" : undefined}component="button"form={setupProfileFormID}type="submit"disabled={!canContinue}- aria-label={isSubmitting ? "Saving" : undefined}- aria-busy={isSubmitting ? true : undefined}sx={{alignItems: "center",- bgcolor: isContinueButtonActive ? green : "#F5F5F5",+ bgcolor: canContinue ? green : "#F5F5F5",border: 0,borderRadius: "20px",- color: isContinueButtonActive ? "white" : textLight,+ color: canContinue ? "white" : textLight,cursor: canContinue ? "pointer" : "default",display: "flex",fontFamily: '"Inter Variable", Inter, sans-serif',@@ -680,7 +398,7 @@ export const SetupProfileScreen: React.FC<SetupProfileScreenProps> = ({: undefined,}}>- {isSubmitting ? <SpaceButtonSpinner /> : ctaLabel}+ Next</Box></Box></Box>diff --git a/web/apps/space/src/state/SpaceAppStateProvider.tsx b/web/apps/space/src/state/SpaceAppStateProvider.tsxindex 2ec6fbd08f..f7b5f9c0a3 100644--- a/web/apps/space/src/state/SpaceAppStateProvider.tsx+++ b/web/apps/space/src/state/SpaceAppStateProvider.tsx@@ -23,6 +23,7 @@ import {import {type LocalSpaceFeedPost,type OnboardingEntrySource,+ type PendingCreateProfile,type RefreshSpaceProfileOptions,type SpaceAppState,SpaceAppStateContext,@@ -49,6 +50,8 @@ export const SpaceAppStateProvider: React.FC<React.PropsWithChildren> = ({useState<File | null>(null);const [pendingProfileCoverFile, setPendingProfileCoverFile] =useState<File | null>(null);+ const [pendingCreateProfile, setPendingCreateProfile] =+ useState<PendingCreateProfile | null>(null);const [profile, setProfile] = useState<SetupProfile | null>(null);const [profileLoadError, setProfileLoadError] = useState<string>();const [profileLoadStatus, setProfileLoadStatus] =@@ -214,6 +217,7 @@ export const SpaceAppStateProvider: React.FC<React.PropsWithChildren> = ({setPendingPasskeyVerification(null);setPendingProfileAvatarFile(null);setPendingProfileCoverFile(null);+ setPendingCreateProfile(null);setOnboardingEntrySource("direct");setSkipNextHomeFeedSkeleton(false);setLocalFeedPosts([]);@@ -265,6 +269,7 @@ export const SpaceAppStateProvider: React.FC<React.PropsWithChildren> = ({pendingPasskeyVerification,pendingProfileAvatarFile,pendingProfileCoverFile,+ pendingCreateProfile,profile,profileLoadError,profileLoadStatus,@@ -279,6 +284,7 @@ export const SpaceAppStateProvider: React.FC<React.PropsWithChildren> = ({setPendingPasskeyVerification,setPendingProfileAvatarFile,setPendingProfileCoverFile,+ setPendingCreateProfile,setProfile: applyProfile,setSkipNextHomeFeedSkeleton,setSignupEmail,@@ -293,6 +299,7 @@ export const SpaceAppStateProvider: React.FC<React.PropsWithChildren> = ({pendingPasskeyVerification,pendingProfileAvatarFile,pendingProfileCoverFile,+ pendingCreateProfile,profile,profileLoadError,profileLoadStatus,diff --git a/web/apps/space/src/state/spaceAppState.tsx b/web/apps/space/src/state/spaceAppState.tsxindex 936d92598f..61ef6720c4 100644--- a/web/apps/space/src/state/spaceAppState.tsx+++ b/web/apps/space/src/state/spaceAppState.tsx@@ -1,12 +1,19 @@import type { FriendProfile } from "data/friends";import React, { createContext, useContext } from "react";import type { SpaceLoginCredentials } from "screens/LoginScreen";-import type { SetupProfile } from "screens/SetupProfileScreen";+import type {+ SetupProfile,+ SetupProfileDetails,+} from "screens/SetupProfileScreen";import type { SpacePost } from "services/space";import type { PendingSpacePasskeyVerification } from "services/spacePasskeyVerification";+import type { CreateProfileSource } from "utils/spaceRoutes";export type OnboardingEntrySource = "direct" | "add-friend-link";export type SpaceProfileLoadStatus = "error" | "loading" | "ready";+export type PendingCreateProfile = SetupProfileDetails & {+ source: CreateProfileSource;+};export interface RefreshSpaceProfileOptions {throwOnError?: boolean;@@ -58,6 +65,7 @@ export interface SpaceAppState {pendingPasskeyVerification: PendingSpacePasskeyVerification | null;pendingProfileAvatarFile: File | null;pendingProfileCoverFile: File | null;+ pendingCreateProfile: PendingCreateProfile | null;profile: SetupProfile | null;profileLoadError?: string;profileLoadStatus: SpaceProfileLoadStatus;@@ -87,6 +95,9 @@ export interface SpaceAppState {setPendingProfileCoverFile: React.Dispatch<React.SetStateAction<File | null>>;+ setPendingCreateProfile: React.Dispatch<+ React.SetStateAction<PendingCreateProfile | null>+ >;setProfile: (profile: SetupProfile | null) => void;setSkipNextHomeFeedSkeleton: React.Dispatch<React.SetStateAction<boolean>>;setSignupEmail: React.Dispatch<React.SetStateAction<string>>;diff --git a/web/apps/space/src/utils/spaceLoginNavigation.ts b/web/apps/space/src/utils/spaceLoginNavigation.tsindex f2d6fb0a98..1fa0506b57 100644--- a/web/apps/space/src/utils/spaceLoginNavigation.ts+++ b/web/apps/space/src/utils/spaceLoginNavigation.ts@@ -28,5 +28,5 @@ export const routeAfterCompletedLogin = async (return;}- await routeTo(spaceRoutes.setupProfile("login"));+ await routeTo(spaceRoutes.createProfile("login"));};diff --git a/web/apps/space/src/utils/spaceRouteTransitions.tsx b/web/apps/space/src/utils/spaceRouteTransitions.tsxindex 6ea3d1b02a..1e30d7282b 100644--- a/web/apps/space/src/utils/spaceRouteTransitions.tsx+++ b/web/apps/space/src/utils/spaceRouteTransitions.tsx@@ -45,11 +45,12 @@ const parentRoutePaths = (path: string) => {"/app/settings": ["/app/profile"],"/app/settings/profile": ["/app/settings"],"/app/settings/profile/name": ["/app/settings/profile"],- "/invite": ["/setup-profile"],+ "/invite": ["/add-profile-photo"],"/login": ["/"],"/passkeys/finish": ["/passkeys/verify"],"/passkeys/verify": ["/login", "/verify"],- "/setup-profile": ["/login", "/verify"],+ "/create-profile": ["/login", "/verify"],+ "/add-profile-photo": ["/create-profile"],"/signup": ["/"],"/two-factor/verify": ["/login", "/verify"],"/verify": ["/login", "/signup"],diff --git a/web/apps/space/src/utils/spaceRoutes.ts b/web/apps/space/src/utils/spaceRoutes.tsindex 1047d967f1..47f7cc3b24 100644--- a/web/apps/space/src/utils/spaceRoutes.ts+++ b/web/apps/space/src/utils/spaceRoutes.ts@@ -1,4 +1,4 @@-export type SetupProfileSource = "login" | "verify";+export type CreateProfileSource = "login" | "verify";export type ProfileImageFlowSource = "profile" | "settings";export type VerifyFlow = "login" | "signup";@@ -40,8 +40,9 @@ export const spaceRoutes = {settings: "/app/settings",settingsProfile: "/app/settings/profile",settingsProfileName: "/app/settings/profile/name",- setupProfile: (from?: SetupProfileSource) =>- from == "login" ? "/setup-profile?from=login" : "/setup-profile",+ createProfile: (from?: CreateProfileSource) =>+ from == "login" ? "/create-profile?from=login" : "/create-profile",+ addProfilePhoto: "/add-profile-photo",signup: "/signup",twoFactorVerify: "/two-factor/verify",verify: "/verify",@@ -52,9 +53,9 @@ export const verifyFlowFromQuery = (value: string | string[] | undefined,): VerifyFlow => (valueFromQuery(value) == "login" ? "login" : "signup");-export const setupProfileSourceFromQuery = (+export const createProfileSourceFromQuery = (value: string | string[] | undefined,-): SetupProfileSource =>+): CreateProfileSource =>valueFromQuery(value) == "login" ? "login" : "verify";export const profileImageFlowSourceFromQuery = (