π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[photos][web] Move subscription flow into Settings
AswinAsokb1eb13905e25
diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsxindex ff2e6dec4d..d08daa364d 100644--- a/web/apps/photos/src/components/Upload.tsx+++ b/web/apps/photos/src/components/Upload.tsx@@ -115,7 +115,7 @@ interface UploadProps {) => void;onCloseCollectionSelector?: () => void;onUploadFile: (file: EnteFile) => void;- onShowPlanSelector?: () => void;+ onShowSubscription?: () => void;onShowSessionExpiredDialog: () => void;isInHiddenSection?: boolean;}@@ -187,7 +187,7 @@ export const Upload: React.FC<UploadProps> = ({onOpenCollectionSelector,onCloseCollectionSelector,onUploadFile,- onShowPlanSelector,+ onShowSubscription,onShowSessionExpiredDialog,...props}) => {@@ -1126,7 +1126,7 @@ export const Upload: React.FC<UploadProps> = ({color: "critical",caption: t("storage_quota_exceeded"),title: t("upgrade_now"),- onClick: onShowPlanSelector,+ onClick: onShowSubscription,startIcon: Database02Icon,});break;diff --git a/web/apps/photos/src/components/sidebar/Sidebar.tsx b/web/apps/photos/src/components/sidebar/Sidebar.tsxindex 6f143a39f6..40e799b577 100644--- a/web/apps/photos/src/components/sidebar/Sidebar.tsx+++ b/web/apps/photos/src/components/sidebar/Sidebar.tsx@@ -1,4 +1,6 @@import { Export } from "@/components/Export";+import { FamilyManagement } from "@/components/FamilyManagement";+import { PlanSelector } from "@/components/PlanSelector";import { downloadAppDialogAttributes } from "@/components/utils/download";import exportService from "@/services/export";import { performSidebarAction as performSidebarRegistryAction } from "@/services/search/sidebar-search-registry";@@ -71,31 +73,37 @@ import { openManageSubscription } from "./accounts/subscription";import { Preferences, type PreferencesAction } from "./preferences/Preferences";import { sidebarTheme } from "./theme";+export type SidebarPendingAction = SidebarActionID | "subscription";+type SidebarProps = ModalVisibilityProps & {- pendingAction?: SidebarActionID;- onActionHandled?: (actionID: SidebarActionID) => void;+ pendingAction?: SidebarPendingAction;+ onActionHandled?: (actionID: SidebarPendingAction) => void;onShowLargeFiles: () => void;onShowDuplicates: () => void;- onShowPlanSelector: () => void;+ setLoading: (loading: boolean) => void;collectionNameByID: Map<number, string>;- onCloseOverlays: () => void;- children?: (onRootClose: () => void) => React.ReactNode;onAuthenticateUser: () => Promise<boolean>;};export const Sidebar: React.FC<SidebarProps> = ({open,onClose: closeRoot,- onCloseOverlays,- children,pendingAction,onActionHandled,- onShowPlanSelector,+ setLoading,onShowLargeFiles,onShowDuplicates,collectionNameByID,onAuthenticateUser,}) => {+ const { show: onShowPlanSelector, props: planSelectorVisibilityProps } =+ useModalVisibility();+ const {+ show: showFamilyManagement,+ props: familyManagementVisibilityProps,+ } = useModalVisibility();+ const { onClose: closePlanSelector } = planSelectorVisibilityProps;+ const { onClose: closeFamilyManagement } = familyManagementVisibilityProps;const { show: showHelp, props: helpVisibilityProps } = useModalVisibility();const { show: showAccount, props: accountVisibilityProps } =useModalVisibility();@@ -128,8 +136,17 @@ export const Sidebar: React.FC<SidebarProps> = ({closeExport();closeMemberSubscription();closeDownloadAppDialog();+ closePlanSelector();+ closeFamilyManagement();}- }, [open, closeExport, closeMemberSubscription, closeDownloadAppDialog]);+ }, [+ open,+ closeExport,+ closeMemberSubscription,+ closeDownloadAppDialog,+ closePlanSelector,+ closeFamilyManagement,+ ]);const [pendingAccountAction, setPendingAccountAction] =useState<AccountAction>();@@ -149,7 +166,8 @@ export const Sidebar: React.FC<SidebarProps> = ({closeMemberSubscription();closeDownloadAppDialog();setWatchFolderView(false);- onCloseOverlays();+ closePlanSelector();+ closeFamilyManagement();}, [accountVisibilityProps,referralsVisibilityProps,@@ -160,7 +178,8 @@ export const Sidebar: React.FC<SidebarProps> = ({closeMemberSubscription,closeDownloadAppDialog,setWatchFolderView,- onCloseOverlays,+ closePlanSelector,+ closeFamilyManagement,]);const onClose = useCallback(() => {@@ -223,8 +242,12 @@ export const Sidebar: React.FC<SidebarProps> = ({]);const performSidebarAction = useCallback(- async (actionID: SidebarActionID) => {+ async (actionID: SidebarPendingAction) => {if (actionID !== "utility.export") closeSections();+ if (actionID === "subscription") {+ onShowPlanSelector();+ return;+ }return performSidebarRegistryAction(actionID, {onClose,onShowPlanSelector,@@ -288,7 +311,9 @@ export const Sidebar: React.FC<SidebarProps> = ({helpVisibilityProps.open ||freeUpSpaceVisibilityProps.open ||exportVisibilityProps.open ||- watchFolderView;+ watchFolderView ||+ planSelectorVisibilityProps.open ||+ familyManagementVisibilityProps.open;return (<RootSidebarDrawer@@ -401,7 +426,18 @@ export const Sidebar: React.FC<SidebarProps> = ({onActionHandled={setPendingFreeUpSpaceAction}/>)}- {children?.(onClose)}+ <PlanSelector+ {...planSelectorVisibilityProps}+ setLoading={setLoading}+ onManageFamily={showFamilyManagement}+ />+ {familyManagementVisibilityProps.open && (+ <FamilyManagement+ {...familyManagementVisibilityProps}+ onRootClose={onClose}+ onShowPlanSelector={onShowPlanSelector}+ />+ )}</RootSidebarDrawer>);};@@ -584,11 +620,12 @@ const HeaderSection: React.FC<SectionProps> = ({ onCloseSidebar }) => (</SpacedRow>);-type UserDetailsSectionProps = Pick<SidebarProps, "onShowPlanSelector"> & {+interface UserDetailsSectionProps {+ onShowPlanSelector: () => void;sidebarOpen: boolean;showManageMemberSubscription: () => void;manageMemberSubscriptionVisibilityProps: ModalVisibilityProps;-};+}const UserDetailsSection: React.FC<UserDetailsSectionProps> = ({sidebarOpen,@@ -660,9 +697,10 @@ const UserDetailsSection: React.FC<UserDetailsSectionProps> = ({);};-type SubscriptionStatusProps = Pick<SidebarProps, "onShowPlanSelector"> & {+interface SubscriptionStatusProps {+ onShowPlanSelector: () => void;userDetails: UserDetails;-};+}const SubscriptionStatus: React.FC<SubscriptionStatusProps> = ({userDetails,diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex ae2da004a0..bcd4871a5f 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -6,11 +6,9 @@ import {CollectionSelector,type CollectionSelectorAttributes,} from "@/components/CollectionSelector";-import { FamilyManagement } from "@/components/FamilyManagement";import type { FileListHeaderOrFooter } from "@/components/FileList";import { FileListWithViewer } from "@/components/FileListWithViewer";import { FixCreationTime } from "@/components/FixCreationTime";-import { PlanSelector } from "@/components/PlanSelector";import { QuickLinkCreatedNotification } from "@/components/QuickLinkCreatedNotification";import {SelectedFileOptions,@@ -50,7 +48,10 @@ import {type GalleryBarMode,} from "@/components/gallery/reducer";import { useAlbumNavigationData } from "@/components/gallery/use-album-navigation-data";-import { Sidebar } from "@/components/sidebar/Sidebar";+import {+ Sidebar,+ type SidebarPendingAction,+} from "@/components/sidebar/Sidebar";import {notifyOthersFilesDialogAttributes,notifyUnsupportedSharedFavoritesDialogAttributes,@@ -170,10 +171,7 @@ import {filterSearchableFiles,updateSearchCollectionsAndFiles,} from "ente-new/photos/services/search";-import type {- SearchOption,- SidebarActionID,-} from "ente-new/photos/services/search/types";+import type { SearchOption } from "ente-new/photos/services/search/types";import {initSettings,updateMapEnabled,@@ -289,7 +287,7 @@ const Page: React.FC = () => {>(undefined);const postCreateAlbumHidden = useRef(false);const [pendingSidebarAction, setPendingSidebarAction] = useState<- SidebarActionID | undefined+ SidebarPendingAction | undefined>(undefined);const lastAuthenticationForHiddenTimestamp = useRef<number>(0);@@ -301,12 +299,6 @@ const Page: React.FC = () => {const pendingPeopleSearchReset = useRef<(() => void) | undefined>(undefined,);- const { show: showPlanSelector, props: planSelectorVisibilityProps } =- useModalVisibility();- const {- show: showFamilyManagement,- props: familyManagementVisibilityProps,- } = useModalVisibility();const { show: showWhatsNew, props: whatsNewVisibilityProps } =useModalVisibility();const { show: showFixCreationTime, props: fixCreationTimeVisibilityProps } =@@ -387,18 +379,10 @@ const Page: React.FC = () => {}}, []);- const closeSidebarOverlays = useCallback(() => {- planSelectorVisibilityProps.onClose();- familyManagementVisibilityProps.onClose();- }, [- planSelectorVisibilityProps.onClose,- familyManagementVisibilityProps.onClose,- ]);-- const handleSidebarClose = useCallback(() => {- closeSidebarOverlays();- sidebarVisibilityProps.onClose();- }, [closeSidebarOverlays, sidebarVisibilityProps.onClose]);+ const showSubscriptionSettings = useCallback(() => {+ setPendingSidebarAction("subscription");+ showSidebar();+ }, [showSidebar]);const handleSidebarActionHandled = useCallback(() => setPendingSidebarAction(undefined),@@ -883,7 +867,6 @@ const Page: React.FC = () => {uploadTypeSelectorView ||openCollectionSelector ||sidebarVisibilityProps.open ||- planSelectorVisibilityProps.open ||fixCreationTimeVisibilityProps.open ||authenticateUserVisibilityProps.open ||albumNameInputVisibilityProps.open ||@@ -2136,23 +2119,6 @@ const Page: React.FC = () => {return <div></div>;}- const renderSubscriptionDialogs = (onRootClose = handleSidebarClose) => (- <>- <PlanSelector- {...planSelectorVisibilityProps}- setLoading={(v) => setBlockingLoad(v)}- onManageFamily={showFamilyManagement}- />- {familyManagementVisibilityProps.open && (- <FamilyManagement- {...familyManagementVisibilityProps}- onRootClose={onRootClose}- onShowPlanSelector={showPlanSelector}- />- )}- </>- );-const selectGalleryCollection =barMode == "links"? (collectionID: number) =>@@ -2192,7 +2158,6 @@ const Page: React.FC = () => {onDrop={setDragAndDropFiles}>{blockingLoad && <TranslucentLoadingOverlay />}- {!sidebarVisibilityProps.open && renderSubscriptionDialogs()}<CollectionSelectoropen={openCollectionSelector}onClose={handleCloseCollectionSelector}@@ -2520,27 +2485,20 @@ const Page: React.FC = () => {onUploadFile={(file) =>dispatch({ type: "uploadFile", file })}- onShowPlanSelector={showPlanSelector}+ onShowSubscription={showSubscriptionSettings}onShowSessionExpiredDialog={showSessionExpiredDialog}isInHiddenSection={barMode == "hidden-albums"}/><Sidebar{...sidebarVisibilityProps}- onClose={handleSidebarClose}onShowLargeFiles={handleShowLargeFiles}onShowDuplicates={handleShowDuplicates}pendingAction={pendingSidebarAction}onActionHandled={handleSidebarActionHandled}- onShowPlanSelector={showPlanSelector}collectionNameByID={collectionNameByID}- onCloseOverlays={closeSidebarOverlays}+ setLoading={setBlockingLoad}onAuthenticateUser={authenticateUser}- >- {(onRootClose) =>- sidebarVisibilityProps.open &&- renderSubscriptionDialogs(onRootClose)- }- </Sidebar>+ /><WhatsNew {...whatsNewVisibilityProps} /><PeopleConsentDialog{...peopleConsentVisibilityProps}