Skip to content

armgit / ente

Public Imported from GitHub
0

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

refactor(photos):render-gallery-bar-in-navigation-shell

Aswin Asoke05475e96a52
diff --git a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
index ebf0dc73d2..16a9fd4da9 100644
--- a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
+++ b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
@@ -41,7 +41,7 @@ import {
type CollectionHeaderProps,
} from "./CollectionHeader";
-type GalleryBarAndListHeaderProps = Omit<
+export type GalleryBarAndListHeaderProps = Omit<
GalleryBarImplProps,
| "collectionSummaries"
| "onSelectCollectionID"
diff --git a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
index e32f18e157..eb106fe7dd 100644
--- a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
+++ b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
@@ -1,3 +1,7 @@
+import {
+ GalleryBarAndListHeader,
+ type GalleryBarAndListHeaderProps,
+} from "@/components/Collections/GalleryBarAndListHeader";
import { SearchBar, type SearchBarProps } from "@/components/SearchBar";
import { uploadManager } from "@/services/upload-manager";
import {
@@ -44,15 +48,19 @@ export const PhotosNavigationShell: React.FC<
showRail: boolean;
showNormalNavigation: boolean;
alternateHeader: ReactNode;
- renderGalleryNavigation:
- ((props: GalleryBarPresentationProps) => ReactNode) | undefined;
+ galleryBarProps:
+ | Omit<
+ GalleryBarAndListHeaderProps,
+ keyof GalleryBarPresentationProps
+ >
+ | undefined;
}
>
> = ({
showRail,
showNormalNavigation,
alternateHeader,
- renderGalleryNavigation,
+ galleryBarProps,
children,
...props
}) => {
@@ -148,10 +156,13 @@ export const PhotosNavigationShell: React.FC<
flexDirection: { xs: "column", md: "row" },
}}
>
- {renderGalleryNavigation?.({
- collapsed: showRail && !railOpen,
- mobileDrawerProps,
- })}
+ {galleryBarProps && (
+ <GalleryBarAndListHeader
+ {...galleryBarProps}
+ collapsed={showRail && !railOpen}
+ mobileDrawerProps={mobileDrawerProps}
+ />
+ )}
<Stack
sx={(theme) => ({
flex: 1,
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index ba2b20e619..882419fe84 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -14,7 +14,6 @@ import {
EditAlbumDetailsDialog,
type AlbumDetails,
} from "@/components/Collections/EditAlbumDetailsDialog";
-import { GalleryBarAndListHeader } from "@/components/Collections/GalleryBarAndListHeader";
import { slideshowFiles } from "@/components/Collections/album-slideshow";
import { FamilyManagement } from "@/components/FamilyManagement";
import type { FileListHeaderOrFooter } from "@/components/FileList";
@@ -1995,57 +1994,44 @@ const Page: React.FC = () => {
dispatch({ type: "showPeople" });
}}
onSelectPerson={handleSelectPerson}
- renderGalleryNavigation={
+ galleryBarProps={
isCleanupViewOpen
? undefined
- : (presentationProps) => (
- <GalleryBarAndListHeader
- {...presentationProps}
- {...{
- user,
- // TODO: These are incorrect assertions, the types of the
- // component need to be updated.
- activeCollection: activeCollection!,
- activeCollectionID: activeCollectionID!,
- activePerson,
- setFileListHeader,
- saveGroups,
- canCreateAlbum: !isInArchiveSection,
- onAddSaveGroup,
- onEditAlbumDetails: showEditAlbumDetails,
- onShowMap: handleShowCollectionMap,
- onCollectionSlideshow: startSlideshow,
- }}
- mode={barMode}
- shouldHide={isInSearchMode}
- barCollectionSummaries={
- barCollectionSummaries
- }
- emailByUserID={state.emailByUserID}
- shareSuggestionEmails={
- state.shareSuggestionEmails
- }
- people={
- (state.view?.type == "people"
- ? state.view.visiblePeople
- : undefined) ?? []
- }
- allPeople={
- (state.view?.type == "people"
- ? state.view.people
- : undefined) ?? []
- }
- setBlockingLoad={setBlockingLoad}
- setActiveCollectionID={
- handleShowCollectionSummaryWithID
- }
- hasActiveFileSelection={
- hasActiveFileSelection
- }
- onRemotePull={remotePull}
- onSelectPerson={handleSelectPerson}
- />
- )
+ : {
+ user,
+ // TODO: These are incorrect assertions, the types of the
+ // component need to be updated.
+ activeCollection: activeCollection!,
+ activeCollectionID: activeCollectionID!,
+ activePerson,
+ setFileListHeader,
+ saveGroups,
+ canCreateAlbum: !isInArchiveSection,
+ onAddSaveGroup,
+ onEditAlbumDetails: showEditAlbumDetails,
+ onShowMap: handleShowCollectionMap,
+ onCollectionSlideshow: startSlideshow,
+ mode: barMode,
+ shouldHide: isInSearchMode,
+ barCollectionSummaries,
+ emailByUserID: state.emailByUserID,
+ shareSuggestionEmails:
+ state.shareSuggestionEmails,
+ people:
+ (state.view?.type == "people"
+ ? state.view.visiblePeople
+ : undefined) ?? [],
+ allPeople:
+ (state.view?.type == "people"
+ ? state.view.people
+ : undefined) ?? [],
+ setBlockingLoad,
+ setActiveCollectionID:
+ handleShowCollectionSummaryWithID,
+ hasActiveFileSelection,
+ onRemotePull: remotePull,
+ onSelectPerson: handleSelectPerson,
+ }
}
alternateHeader={
showSelectionBar ? (