Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web][photos] Render gallery bar inside navigation shell

AswinAsokef3299f80fa8
diff --git a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
index 16ad3c6693..d3b9247fe4 100644
--- a/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
+++ b/web/apps/photos/src/components/gallery/PhotosNavigationShell.tsx
@@ -32,24 +32,20 @@ import { t } from "i18next";
import { useCallback, useEffect, useState, type ReactNode } from "react";
import type { RemotePullOpts } from ".";
-import type {
- GalleryBarImplProps,
- GalleryBarPresentationProps,
+import {
+ GalleryBarImpl,
+ type GalleryBarImplProps,
+ type GalleryBarPresentationProps,
} from "./BarImpl";
import type { GalleryBarMode } from "./reducer";
-type GalleryBarRenderProps = GalleryBarPresentationProps &
- Pick<
- GalleryBarImplProps,
- "onCreateAlbum" | "onSelectCollectionID" | "onSelectPerson"
- >;
-
-interface GalleryNavigation {
- activeCollectionID: number | undefined;
- onSelectCollectionID: (collectionID: number) => void;
- onRemotePull: (opts?: RemotePullOpts) => Promise<void>;
- renderGalleryBar: (props: GalleryBarRenderProps) => ReactNode;
-}
+type GalleryNavigation = Omit<
+ GalleryBarImplProps,
+ | keyof GalleryBarPresentationProps
+ | "mode"
+ | "onCreateAlbum"
+ | "onSelectPerson"
+> & { onRemotePull: (opts?: RemotePullOpts) => Promise<void> };
type PhotosNavigationShellProps = SearchBarProps & {
onSidebar: () => void;
@@ -235,27 +231,26 @@ export const PhotosNavigationShell: React.FC<
flexDirection: { xs: "column", md: "row" },
}}
>
- {galleryNavigation && (
+ {galleryNavigation && !props.isInSearchMode && (
<>
- {galleryNavigation.renderGalleryBar({
- collapsed:
+ <GalleryBarImpl
+ {...galleryNavigation}
+ mode={props.mode}
+ collapsed={
showRail &&
- (!railOpen || navigationCollapsed),
- mobileDrawerProps,
- onCreateAlbum: openAlbumCreation,
- onSelectCollectionID: selectCollection,
- onSelectPerson: selectPerson,
- })}
- {!props.isInSearchMode && (
- <CreateAlbumDialog
- {...albumNameInputVisibilityProps}
- isHidden={createInHiddenSection}
- onRemotePull={
- galleryNavigation.onRemotePull
- }
- onSelectCollectionID={selectCollection}
- />
- )}
+ (!railOpen || navigationCollapsed)
+ }
+ mobileDrawerProps={mobileDrawerProps}
+ onCreateAlbum={openAlbumCreation}
+ onSelectCollectionID={selectCollection}
+ onSelectPerson={selectPerson}
+ />
+ <CreateAlbumDialog
+ {...albumNameInputVisibilityProps}
+ isHidden={createInHiddenSection}
+ onRemotePull={galleryNavigation.onRemotePull}
+ onSelectCollectionID={selectCollection}
+ />
</>
)}
<Stack
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 87621093ab..f49b69ef08 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -36,7 +36,6 @@ import {
type RemotePullOpts,
} from "@/components/gallery";
import { AlbumsOverview } from "@/components/gallery/AlbumsOverview";
-import { GalleryBarImpl } from "@/components/gallery/BarImpl";
import { DuplicatesView } from "@/components/gallery/DuplicatesView";
import { LargeFilesView } from "@/components/gallery/LargeFilesView";
import { PeopleOverview } from "@/components/gallery/PeopleOverview";
@@ -2194,48 +2193,23 @@ const Page: React.FC = () => {
activeCollectionID: galleryBarActiveCollectionID,
onSelectCollectionID: selectGalleryCollection,
onRemotePull: remotePull,
- renderGalleryBar: (presentationProps) =>
- !isInSearchMode && (
- <GalleryBarImpl
- {...presentationProps}
- {...{
- activePerson,
- albumFilter,
- albumSearchQuery,
- collectionsSortBy,
- onChangeCollectionsSortBy,
- normalCollectionSummaries,
- peopleSortBy,
- }}
- mode={barMode}
- activeCollectionID={
- galleryBarActiveCollectionID
- }
- onAlbumSearchQueryChange={
- setAlbumSearchQuery
- }
- onShowAlbumOverview={
- handleShowAlbumOverview
- }
- onShowPeopleOverview={
- handleShowPeople
- }
- collectionSummaries={
- sidebarCollectionSummaries
- }
- visibleAlbumFilters={
- sidebarAlbumFilters
- }
- uncategorizedCollectionSummaryID={
- state.uncategorizedCollectionSummaryID
- }
- onShowCollectionSummary={
- showCollectionSummary
- }
- onChangePeopleSortBy={setPeopleSortBy}
- people={sortedPeople}
- />
- ),
+ activePerson,
+ albumFilter,
+ albumSearchQuery,
+ onAlbumSearchQueryChange: setAlbumSearchQuery,
+ onShowAlbumOverview: handleShowAlbumOverview,
+ onShowPeopleOverview: handleShowPeople,
+ collectionSummaries: sidebarCollectionSummaries,
+ visibleAlbumFilters: sidebarAlbumFilters,
+ normalCollectionSummaries,
+ uncategorizedCollectionSummaryID:
+ state.uncategorizedCollectionSummaryID,
+ onShowCollectionSummary: showCollectionSummary,
+ collectionsSortBy,
+ onChangeCollectionsSortBy,
+ peopleSortBy,
+ onChangePeopleSortBy: setPeopleSortBy,
+ people: sortedPeople,
}
}
alternateHeader={