π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[web][photos] Move album creation into navigation shell
AswinAsokd5af459a217b
diff --git a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsxindex 7e89d3d28c..16bf95f2eb 100644--- a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx+++ b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx@@ -41,7 +41,6 @@ import {CollectionHeader,type CollectionHeaderProps,} from "./CollectionHeader";-import { CreateAlbumDialog } from "./CreateAlbumDialog";export type GalleryBarAndListHeaderProps = Omit<GalleryBarImplProps,@@ -50,7 +49,6 @@ export type GalleryBarAndListHeaderProps = Omit<| "onSelectCollectionID"| "collectionsSortBy"| "onChangeCollectionsSortBy"- | "onCreateAlbum"> & {onAlbumSummariesChange: (albums: CollectionSummary[],@@ -100,6 +98,7 @@ export const GalleryBarAndListHeader: React.FC<onAlbumSearchQueryChange,onShowAlbumOverview,onShowPeopleOverview,+ onCreateAlbum,onSelectPerson,saveGroups,hasActiveFileSelection,@@ -115,14 +114,6 @@ export const GalleryBarAndListHeader: React.FC<collapsed,mobileDrawerProps,}) => {- const { show: showAlbumNameInput, props: albumNameInputVisibilityProps } =- useModalVisibility();- const [createInHiddenSection, setCreateInHiddenSection] = useState(false);- const openAlbumCreation = () => {- setCreateInHiddenSection(mode == "hidden-albums");- showAlbumNameInput();- };-const { show: showCollectionShare, props: collectionShareVisibilityProps } =useModalVisibility();const { show: showCollectionCast, props: collectionCastVisibilityProps } =@@ -340,6 +331,7 @@ export const GalleryBarAndListHeader: React.FC<onAlbumSearchQueryChange,onShowAlbumOverview,onShowPeopleOverview,+ onCreateAlbum,activeCollectionID,people: sortedPeople,activePerson,@@ -355,7 +347,6 @@ export const GalleryBarAndListHeader: React.FC<onSelectPerson={selectPerson}onChangeCollectionsSortBy={setCollectionsSortBy}onChangePeopleSortBy={onChangePeopleSortBy}- onCreateAlbum={openAlbumCreation}collectionSummaries={mode == "albums"? sidebarCollectionSummaries@@ -364,12 +355,6 @@ export const GalleryBarAndListHeader: React.FC<visibleAlbumFilters={visibleAlbumFilters}/>- <CreateAlbumDialog- {...albumNameInputVisibilityProps}- isHidden={createInHiddenSection}- onRemotePull={onRemotePull}- onSelectCollectionID={selectCollection}- />{activeCollection && (<><CollectionSharediff --git a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsxindex 47756ba741..1d53393820 100644--- a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx+++ b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx@@ -1,3 +1,4 @@+import { CreateAlbumDialog } from "@/components/Collections/CreateAlbumDialog";import {GalleryBarAndListHeader,type GalleryBarAndListHeaderProps,@@ -54,7 +55,7 @@ export const PhotosNavigationShell: React.FC<galleryBarProps:| Omit<GalleryBarAndListHeaderProps,- keyof GalleryBarPresentationProps+ keyof GalleryBarPresentationProps | "onCreateAlbum">| undefined;}@@ -74,6 +75,13 @@ export const PhotosNavigationShell: React.FC<const { show: showMobileNavigation, props: mobileDrawerProps } =useModalVisibility();const { onClose: closeMobileNavigation } = mobileDrawerProps;+ const { show: showAlbumNameInput, props: albumNameInputVisibilityProps } =+ useModalVisibility();+ const [createInHiddenSection, setCreateInHiddenSection] = useState(false);+ const openAlbumCreation = () => {+ setCreateInHiddenSection(props.mode == "hidden-albums");+ showAlbumNameInput();+ };useEffect(() => {setNavigationCollapsed(false);}, [props.mode, props.isInSearchMode]);@@ -203,13 +211,30 @@ export const PhotosNavigationShell: React.FC<}}>{galleryBarProps && (- <GalleryBarAndListHeader- {...galleryBarProps}- collapsed={- showRail && (!railOpen || navigationCollapsed)- }- mobileDrawerProps={mobileDrawerProps}- />+ <>+ <GalleryBarAndListHeader+ {...galleryBarProps}+ collapsed={+ showRail &&+ (!railOpen || navigationCollapsed)+ }+ mobileDrawerProps={mobileDrawerProps}+ onCreateAlbum={openAlbumCreation}+ />+ {!galleryBarProps.shouldHide && (+ <CreateAlbumDialog+ {...albumNameInputVisibilityProps}+ isHidden={createInHiddenSection}+ onRemotePull={galleryBarProps.onRemotePull}+ onSelectCollectionID={(id) => {+ galleryBarProps.setActiveCollectionID(+ id,+ );+ closeMobileNavigation();+ }}+ />+ )}+ </>)}<Stacksx={(theme) => ({diff --git a/web/apps/photos/tests/sidebar-quick-links.test.tsx b/web/apps/photos/tests/sidebar-quick-links.test.tsxindex 85446f6ed0..f2130a93ec 100644--- a/web/apps/photos/tests/sidebar-quick-links.test.tsx+++ b/web/apps/photos/tests/sidebar-quick-links.test.tsx@@ -25,9 +25,6 @@ vi.mock("../src/components/Collections/AlbumCastDialog", () => ({vi.mock("../src/components/Collections/CollectionHeader", () => ({CollectionHeader: () => null,}));-vi.mock("../src/components/Collections/CreateAlbumDialog", () => ({- CreateAlbumDialog: () => null,-}));vi.mock("@/utils/album-filters", () => import("../src/utils/album-filters"));vi.mock("@/utils/people-sort", () => import("../src/utils/people-sort"));@@ -70,6 +67,7 @@ const renderSidebar = (peopleSortBy: "name-asc",saveGroups: [],setActiveCollectionID: vi.fn(),+ onCreateAlbum: vi.fn(),mobileDrawerProps: { open: true, onClose: vi.fn() },} as unknown as GalleryBarAndListHeaderProps;renderToStaticMarkup(<GalleryBarAndListHeader {...props} />);