Skip to content

armgit / ente

Public Imported from GitHub
0

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

feat(photos):add-header-and-navigation-rail

Aswin Asokfcdd880d92d5
diff --git a/web/apps/photos/src/components/SearchBar.tsx b/web/apps/photos/src/components/SearchBar.tsx
index 39533b39e6..15226b2cd6 100644
--- a/web/apps/photos/src/components/SearchBar.tsx
+++ b/web/apps/photos/src/components/SearchBar.tsx
@@ -71,7 +71,10 @@ export interface SearchBarProps {
onSelectPerson: (personID: string) => void;
}
-export const SearchBar: React.FC<SearchBarProps> = (props) => {
+export const SearchBar: React.FC<
+ SearchBarProps & { placement?: "header" | "rail" }
+> = ({ placement = "header", ...props }) => {
+ const isRail = placement === "rail";
const isSmallWidth = useIsSmallWidth();
const [open, setOpen] = useState(false);
const [searchResetKey, setSearchResetKey] = useState(0);
@@ -108,37 +111,44 @@ export const SearchBar: React.FC<SearchBarProps> = (props) => {
return () => document.removeEventListener("keydown", handleKeyDown);
}, []);
+ const closeButton = !isRail && props.isInSearchMode && (
+ <Tooltip title={t("close")}>
+ <IconButton
+ aria-label={t("close")}
+ onClick={clearSearch}
+ sx={{ mr: "8px" }}
+ >
+ <CloseIcon />
+ </IconButton>
+ </Tooltip>
+ );
+
return (
<>
- {props.isInSearchMode && (
- <Tooltip title={t("close")}>
- <IconButton
- aria-label={t("close")}
- onClick={clearSearch}
- sx={{ mr: "8px" }}
+ <Stack
+ direction={isRail ? "column" : "row"}
+ sx={{ alignItems: "center", gap: isRail ? "12px" : 0 }}
+ >
+ {closeButton}
+ <Tooltip title={`Search (${shortcut})`}>
+ <FocusVisibleButton
+ color="secondary"
+ aria-label={t("search")}
+ aria-haspopup="dialog"
+ onClick={showSearch}
+ sx={{
+ minWidth: 0,
+ width: isRail || isSmallWidth ? 40 : 48,
+ height: isRail || isSmallWidth ? 40 : 48,
+ p: 0,
+ mr: isRail ? 0 : "8px",
+ borderRadius: isRail ? "12px" : "16px",
+ }}
>
- <CloseIcon />
- </IconButton>
+ <HugeiconsIcon icon={Search01Icon} size={20} />
+ </FocusVisibleButton>
</Tooltip>
- )}
- <Tooltip title={`Search (${shortcut})`}>
- <FocusVisibleButton
- color="secondary"
- aria-label={t("search")}
- aria-haspopup="dialog"
- onClick={showSearch}
- sx={{
- minWidth: 0,
- width: isSmallWidth ? 40 : 48,
- height: isSmallWidth ? 40 : 48,
- p: 0,
- mr: "8px",
- borderRadius: "16px",
- }}
- >
- <HugeiconsIcon icon={Search01Icon} size={20} />
- </FocusVisibleButton>
- </Tooltip>
+ </Stack>
<ThemeProvider theme={sidebarTheme}>
<Dialog
open={open}
diff --git a/web/apps/photos/src/components/gallery/NormalNavbarContents.tsx b/web/apps/photos/src/components/gallery/NormalNavbarContents.tsx
deleted file mode 100644
index a740d4b139..0000000000
--- a/web/apps/photos/src/components/gallery/NormalNavbarContents.tsx
+++ /dev/null
@@ -1,77 +0,0 @@
-import { SearchBar, type SearchBarProps } from "@/components/SearchBar";
-import { uploadManager } from "@/services/upload-manager";
-import { Upload01Icon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
-import MenuIcon from "@mui/icons-material/Menu";
-import { Box, IconButton } from "@mui/material";
-import { EnteLogo, EnteLogoBox } from "ente-base/components/EnteLogo";
-import type { ButtonishProps } from "ente-base/components/mui";
-import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
-import { useIsSmallWidth } from "ente-base/components/utils/hooks";
-import { t } from "i18next";
-
-type NormalNavbarContentsProps = SearchBarProps & {
- onSidebar: () => void;
- onUpload: () => void;
-};
-
-export const NormalNavbarContents: React.FC<NormalNavbarContentsProps> = ({
- onSidebar,
- onUpload,
- ...props
-}) => (
- <Box
- sx={{
- position: "relative",
- display: "flex",
- alignItems: "center",
- flex: 1,
- }}
- >
- <SidebarButton onClick={onSidebar} />
- <EnteLogoBox
- sx={{
- position: "absolute",
- left: "50%",
- transform: "translateX(-50%)",
- pointerEvents: "none",
- "& svg": { height: { xs: "15px", sm: "20px" } },
- }}
- >
- <EnteLogo height={15} />
- </EnteLogoBox>
- <Box sx={{ flex: 1 }} />
- <SearchBar {...props} />
- <UploadButton onClick={onUpload} />
- </Box>
-);
-
-const SidebarButton: React.FC<ButtonishProps> = ({ onClick }) => (
- <IconButton {...{ onClick }}>
- <MenuIcon />
- </IconButton>
-);
-
-export const UploadButton: React.FC<ButtonishProps> = ({ onClick }) => {
- const disabled = uploadManager.isUploadInProgress();
- const isSmallWidth = useIsSmallWidth();
-
- const icon = <HugeiconsIcon icon={Upload01Icon} size={20} />;
-
- return (
- <>
- {isSmallWidth ? (
- <IconButton {...{ onClick, disabled }}>{icon}</IconButton>
- ) : (
- <FocusVisibleButton
- color="secondary"
- startIcon={icon}
- sx={{ borderRadius: "16px" }}
- {...{ onClick, disabled }}
- >
- {t("upload")}
- </FocusVisibleButton>
- )}
- </>
- );
-};
diff --git a/web/apps/photos/src/components/gallery/PhotosNavigationSheel.tsx b/web/apps/photos/src/components/gallery/PhotosNavigationSheel.tsx
new file mode 100644
index 0000000000..b5e6f5a420
--- /dev/null
+++ b/web/apps/photos/src/components/gallery/PhotosNavigationSheel.tsx
@@ -0,0 +1,231 @@
+import { SearchBar, type SearchBarProps } from "@/components/SearchBar";
+import { uploadManager } from "@/services/upload-manager";
+import { Upload01Icon } from "@hugeicons/core-free-icons";
+import { HugeiconsIcon } from "@hugeicons/react";
+import HomeIcon from "@mui/icons-material/HomeOutlined";
+import MenuIcon from "@mui/icons-material/Menu";
+import SettingsIcon from "@mui/icons-material/SettingsOutlined";
+import { Box, IconButton, Stack, Tooltip } from "@mui/material";
+import { EnteLogo, EnteLogoBox } from "ente-base/components/EnteLogo";
+import type { ButtonishProps } from "ente-base/components/mui";
+import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
+import { NavbarBase } from "ente-base/components/Navbar";
+import { useIsSmallWidth } from "ente-base/components/utils/hooks";
+import { ut } from "ente-base/i18n";
+import { t } from "i18next";
+import type { ReactNode } from "react";
+
+type PhotosNavigationSheelProps = SearchBarProps & {
+ onSidebar: () => void;
+ onUpload: () => void;
+ onHome: () => void;
+};
+
+export const PhotosNavigationSheel: React.FC<
+ React.PropsWithChildren<
+ PhotosNavigationSheelProps & {
+ showRail: boolean;
+ showNormalNavigation: boolean;
+ hasSelection: boolean;
+ alternateHeader: ReactNode;
+ }
+ >
+> = ({
+ showRail,
+ showNormalNavigation,
+ hasSelection,
+ alternateHeader,
+ children,
+ ...props
+}) => {
+ const isSmallWidth = useIsSmallWidth();
+ return (
+ <Stack
+ sx={(theme) => ({
+ flex: 1,
+ minWidth: 0,
+ minHeight: 0,
+ ...(showRail && {
+ [theme.breakpoints.up("sm")]: {
+ bgcolor: "#F4F4F4",
+ ...theme.applyStyles("light", {
+ "& > :first-child .MuiButton-colorSecondary, & > :last-child > nav .MuiButton-colorSecondary":
+ { "--mui-palette-secondary-main": "#FFFFFF" },
+ }),
+ ...theme.applyStyles("dark", { bgcolor: "#161616" }),
+ },
+ }),
+ })}
+ >
+ {showRail && (
+ <NavbarBase
+ sx={[
+ {
+ mb: { xs: "12px", sm: 0 },
+ px: { xs: "4px", sm: "16px" },
+ borderBottom: { sm: "none" },
+ },
+ hasSelection && { borderColor: "accent.main" },
+ ]}
+ >
+ {showNormalNavigation ? (
+ <NormalHeaderContents {...props} />
+ ) : (
+ alternateHeader
+ )}
+ </NavbarBase>
+ )}
+ <Stack direction="row" sx={{ flex: 1, minWidth: 0, minHeight: 0 }}>
+ {showRail && (
+ <Box
+ component="nav"
+ sx={{
+ display: { xs: "none", sm: "flex" },
+ flexDirection: "column",
+ alignItems: "center",
+ flexShrink: 0,
+ width: "72px",
+ py: "12px",
+ gap: "12px",
+ }}
+ >
+ {!isSmallWidth && showNormalNavigation && (
+ <NormalNavigationRail {...props} />
+ )}
+ </Box>
+ )}
+ <Stack
+ sx={(theme) => ({
+ flex: 1,
+ minWidth: 0,
+ minHeight: 0,
+ pt: showRail ? { xs: 0, sm: "12px" } : 0,
+ ...(showRail && {
+ [theme.breakpoints.up("sm")]: {
+ "--mui-palette-background-default": "#FFFFFF",
+ bgcolor: "background.default",
+ ...theme.applyStyles("dark", {
+ "--mui-palette-background-default":
+ "#212121",
+ }),
+ },
+ }),
+ })}
+ >
+ {children}
+ </Stack>
+ </Stack>
+ </Stack>
+ );
+};
+
+const NormalHeaderContents: React.FC<PhotosNavigationSheelProps> = ({
+ onSidebar,
+ onUpload,
+ onHome,
+ ...props
+}) => {
+ const isSmallWidth = useIsSmallWidth();
+
+ return (
+ <Box
+ sx={{
+ position: "relative",
+ display: "flex",
+ alignItems: "center",
+ flex: 1,
+ }}
+ >
+ {isSmallWidth && <SidebarButton onClick={onSidebar} />}
+ {!isSmallWidth && (
+ <Tooltip title={ut("Home")}>
+ <FocusVisibleButton
+ color="secondary"
+ aria-label={ut("Home")}
+ onClick={onHome}
+ sx={{
+ minWidth: 0,
+ width: 40,
+ height: 40,
+ p: 0,
+ borderRadius: "12px",
+ }}
+ >
+ <HomeIcon sx={{ fontSize: 20 }} />
+ </FocusVisibleButton>
+ </Tooltip>
+ )}
+ <EnteLogoBox
+ sx={{
+ position: "absolute",
+ left: "50%",
+ transform: "translateX(-50%)",
+ pointerEvents: "none",
+ "& svg": { height: { xs: "15px", sm: "20px" } },
+ }}
+ >
+ <EnteLogo height={15} />
+ </EnteLogoBox>
+ <Box sx={{ flex: 1 }} />
+ {isSmallWidth && <SearchBar {...props} />}
+ <UploadButton onClick={onUpload} />
+ </Box>
+ );
+};
+
+const NormalNavigationRail: React.FC<
+ SearchBarProps & { onSidebar: () => void }
+> = ({ onSidebar, ...props }) => (
+ <>
+ <SearchBar {...props} placement="rail" />
+ <Box sx={{ flex: 1 }} />
+ <Tooltip title={t("settings")}>
+ <FocusVisibleButton
+ color="secondary"
+ aria-label={t("settings")}
+ aria-haspopup="dialog"
+ onClick={onSidebar}
+ sx={{
+ minWidth: 0,
+ width: 40,
+ height: 40,
+ flexShrink: 0,
+ p: 0,
+ borderRadius: "12px",
+ }}
+ >
+ <SettingsIcon sx={{ fontSize: 20 }} />
+ </FocusVisibleButton>
+ </Tooltip>
+ </>
+);
+
+const SidebarButton: React.FC<ButtonishProps> = ({ onClick }) => (
+ <IconButton {...{ onClick }}>
+ <MenuIcon />
+ </IconButton>
+);
+
+export const UploadButton: React.FC<ButtonishProps> = ({ onClick }) => {
+ const disabled = uploadManager.isUploadInProgress();
+ const isSmallWidth = useIsSmallWidth();
+
+ const icon = <HugeiconsIcon icon={Upload01Icon} size={20} />;
+
+ return (
+ <>
+ {isSmallWidth ? (
+ <IconButton {...{ onClick, disabled }}>{icon}</IconButton>
+ ) : (
+ <FocusVisibleButton
+ color="secondary"
+ startIcon={icon}
+ sx={{ borderRadius: "16px" }}
+ {...{ onClick, disabled }}
+ >
+ {t("upload")}
+ </FocusVisibleButton>
+ )}
+ </>
+ );
+};
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 8c96f77784..7db719aa72 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -38,9 +38,9 @@ import {
import { DuplicatesView } from "@/components/gallery/DuplicatesView";
import { LargeFilesView } from "@/components/gallery/LargeFilesView";
import {
- NormalNavbarContents,
+ PhotosNavigationSheel,
UploadButton,
-} from "@/components/gallery/NormalNavbarContents";
+} from "@/components/gallery/PhotosNavigationSheel";
import { TrashFilesDialog } from "@/components/gallery/TrashFilesDialog";
import {
findCollectionCreatingIfNeeded,
@@ -72,7 +72,6 @@ import { isSessionInvalid } from "ente-accounts/services/session";
import { ensureLocalUser } from "ente-accounts/services/user";
import { isDesktop } from "ente-base/app";
import type { MiniDialogAttributes } from "ente-base/components/MiniDialog";
-import { NavbarBase } from "ente-base/components/Navbar";
import { SingleInputDialog } from "ente-base/components/SingleInputDialog";
import { CenteredRow } from "ente-base/components/containers";
import { TranslucentLoadingOverlay } from "ente-base/components/loaders";
@@ -1940,6 +1939,12 @@ const Page: React.FC = () => {
</>
);
+ const showNormalNavigation =
+ !isCleanupViewOpen &&
+ !showSelectionBar &&
+ barMode !== "hidden-albums" &&
+ (isInSearchMode || !isInArchiveSection);
+
return (
<FullScreenDropZone
message={
@@ -1981,126 +1986,208 @@ const Page: React.FC = () => {
{...trashFilesDialog}
/>
)}
- {!isCleanupViewOpen && (
- <>
- <NavbarBase
- sx={[
- {
- mb: "12px",
- px: "24px",
- "@media (width < 720px)": { px: "4px" },
- },
- showSelectionBar && { borderColor: "accent.main" },
- ]}
- >
- {showSelectionBar ? (
- <SelectedFileOptions
- barMode={barMode}
- isInSearchMode={isInSearchMode}
- collection={
- isInSearchMode
- ? undefined
- : activeCollection
- }
- collectionSummary={
- isInSearchMode
- ? undefined
- : activeCollectionSummary
- }
- selectedFileCount={selected.count}
- selectedOwnFileCount={selected.ownCount}
- selectedFavoriteCount={selectedFavoriteCount}
- onClearSelection={clearSelection}
- onDelete={() => handleDeleteFiles()}
- onRemoveFilesFromCollection={
- handleRemoveFilesFromCollection
- }
- onOpenCollectionSelector={
- handleOpenCollectionSelector
- }
- onSelectAll={handleSelectAll}
- isAllSelected={isAllSelectedInView}
- {...{
- createOnCreateForCollectionOp,
- createOnSelectForCollectionOp,
- createFileOpHandler,
- onShowAssignPersonDialog:
- showAddPersonAction
- ? showContextMenuAssignPerson
- : undefined,
- }}
- onEditLocation={showEditLocation}
- />
- ) : barMode == "hidden-albums" ? (
- <SectionNavbarContents
- title={t("section_hidden")}
- onBack={() => dispatch({ type: "showAlbums" })}
- onUpload={openUploader}
- />
- ) : !isInSearchMode && isInArchiveSection ? (
- <SectionNavbarContents
- title={t("section_archive")}
- onBack={() => dispatch({ type: "showAlbums" })}
- onUpload={openUploader}
- />
- ) : (
- <NormalNavbarContents
- {...{ isInSearchMode }}
- onSidebar={showSidebar}
- onUpload={openUploader}
- onSelectSearchOption={handleSelectSearchOption}
- onSelectPeople={() =>
- dispatch({ type: "showPeople" })
- }
- onSelectPerson={handleSelectPerson}
- />
+ <PhotosNavigationSheel
+ showRail={!isCleanupViewOpen}
+ showNormalNavigation={showNormalNavigation}
+ hasSelection={showSelectionBar}
+ isInSearchMode={isInSearchMode}
+ onSidebar={showSidebar}
+ onUpload={openUploader}
+ onHome={() =>
+ handleShowCollectionSummaryWithID(PseudoCollectionID.all)
+ }
+ onSelectSearchOption={handleSelectSearchOption}
+ onSelectPeople={() => dispatch({ type: "showPeople" })}
+ onSelectPerson={handleSelectPerson}
+ alternateHeader={
+ showSelectionBar ? (
+ <SelectedFileOptions
+ barMode={barMode}
+ isInSearchMode={isInSearchMode}
+ collection={
+ isInSearchMode ? undefined : activeCollection
+ }
+ collectionSummary={
+ isInSearchMode
+ ? undefined
+ : activeCollectionSummary
+ }
+ selectedFileCount={selected.count}
+ selectedOwnFileCount={selected.ownCount}
+ selectedFavoriteCount={selectedFavoriteCount}
+ onClearSelection={clearSelection}
+ onDelete={() => handleDeleteFiles()}
+ onRemoveFilesFromCollection={
+ handleRemoveFilesFromCollection
+ }
+ onOpenCollectionSelector={
+ handleOpenCollectionSelector
+ }
+ onSelectAll={handleSelectAll}
+ isAllSelected={isAllSelectedInView}
+ {...{
+ createOnCreateForCollectionOp,
+ createOnSelectForCollectionOp,
+ createFileOpHandler,
+ onShowAssignPersonDialog: showAddPersonAction
+ ? showContextMenuAssignPerson
+ : undefined,
+ }}
+ onEditLocation={showEditLocation}
+ />
+ ) : barMode == "hidden-albums" ? (
+ <SectionNavbarContents
+ title={t("section_hidden")}
+ onBack={() => dispatch({ type: "showAlbums" })}
+ onUpload={openUploader}
+ />
+ ) : !isInSearchMode && isInArchiveSection ? (
+ <SectionNavbarContents
+ title={t("section_archive")}
+ onBack={() => dispatch({ type: "showAlbums" })}
+ onUpload={openUploader}
+ />
+ ) : null
+ }
+ >
+ {!isCleanupViewOpen && (
+ <>
+ {isFirstLoad && <FirstLoadMessage />}
+ {isOffline && <OfflineMessage />}
+
+ <GalleryBarAndListHeader
+ {...{
+ 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) ?? []
+ }
+ onChangeMode={handleChangeBarMode}
+ setBlockingLoad={setBlockingLoad}
+ setActiveCollectionID={
+ handleShowCollectionSummaryWithID
+ }
+ hasActiveFileSelection={hasActiveFileSelection}
+ onRemotePull={remotePull}
+ onSelectPerson={handleSelectPerson}
+ />
+ </>
+ )}
+ {cleanupView === "duplicates" ? (
+ <DuplicatesView
+ onBack={handleCloseCleanupView}
+ onRemoteFilesPull={remoteFilesPull}
+ />
+ ) : cleanupView === "large-files" ? (
+ <LargeFilesView
+ onBack={handleCloseCleanupView}
+ onRemoteFilesPull={remoteFilesPull}
+ />
+ ) : !isInSearchMode &&
+ !isFirstLoad &&
+ !state.collectionFiles.length &&
+ activeCollectionID === PseudoCollectionID.all ? (
+ <GalleryEmptyState
+ isUploadInProgress={uploadManager.isUploadInProgress()}
+ onUpload={openUploader}
+ />
+ ) : !isInSearchMode &&
+ !isFirstLoad &&
+ state.view?.type == "people" &&
+ !state.view.activePerson ? (
+ <PeopleEmptyState />
+ ) : (
+ <FileListWithViewer
+ mode={barMode}
+ modePlus={isInSearchMode ? "search" : barMode}
+ header={fileListHeader}
+ footer={fileListFooter}
+ user={user}
+ files={filteredFiles}
+ onShowMap={handleShowCollectionMap}
+ enableDownload={true}
+ disableGrouping={
+ state.searchSuggestion?.type == "clip" ||
+ (!isInSearchMode &&
+ activeCollection?.pubMagicMetadata?.data
+ .sortBy === "fileName")
+ }
+ enableSelect={true}
+ selected={selected}
+ setSelected={setSelected}
+ // TODO: Incorrect assertion, need to update the type
+ activeCollectionID={activeCollectionID!}
+ activeCollectionSummary={activeCollectionSummary}
+ activePersonID={activePerson?.id}
+ isInIncomingSharedCollection={activeCollectionSummary?.attributes.has(
+ "sharedIncoming",
)}
- </NavbarBase>
- {isFirstLoad && <FirstLoadMessage />}
- {isOffline && <OfflineMessage />}
-
- <GalleryBarAndListHeader
+ isInHiddenSection={barMode == "hidden-albums"}
+ onContextMenuAction={handleContextMenuAction}
+ onContextMenuOpenChange={setIsContextMenuOpen}
+ suppressSelectionUI={suppressContextSelectionBar}
+ showAddPersonAction={showAddPersonAction}
+ showEditLocationAction={selected.ownCount > 0}
{...{
- user,
- // TODO: These are incorrect assertions, the types of the
- // component need to be updated.
- activeCollection: activeCollection!,
- activeCollectionID: activeCollectionID!,
- activePerson,
- setFileListHeader,
- saveGroups,
- canCreateAlbum: !isInArchiveSection,
+ favoriteFileIDs,
+ collectionNameByID,
+ fileNormalCollectionIDs,
+ fileCollectionIDs,
+ hiddenCollectionIDs,
+ pendingFavoriteUpdates,
+ pendingVisibilityUpdates,
onAddSaveGroup,
- onEditAlbumDetails: showEditAlbumDetails,
- onShowMap: handleShowCollectionMap,
- onCollectionSlideshow: startSlideshow,
}}
- mode={barMode}
- shouldHide={isInSearchMode}
- barCollectionSummaries={barCollectionSummaries}
+ collectionSummaries={normalCollectionSummaries}
emailByUserID={state.emailByUserID}
- shareSuggestionEmails={state.shareSuggestionEmails}
- people={
- (state.view?.type == "people"
- ? state.view.visiblePeople
- : undefined) ?? []
- }
- allPeople={
- (state.view?.type == "people"
- ? state.view.people
- : undefined) ?? []
- }
- onChangeMode={handleChangeBarMode}
- setBlockingLoad={setBlockingLoad}
- setActiveCollectionID={
- handleShowCollectionSummaryWithID
+ onToggleFavorite={handleFileViewerToggleFavorite}
+ onFileVisibilityUpdate={
+ handleFileViewerFileVisibilityUpdate
}
- hasActiveFileSelection={hasActiveFileSelection}
+ onSendLink={handleFileViewerSendLink}
+ onMarkTempDeleted={handleMarkTempDeleted}
+ onSetOpenFileViewer={setIsFileViewerOpen}
onRemotePull={remotePull}
+ onRemoteFilesPull={remoteFilesPull}
+ onVisualFeedback={handleVisualFeedback}
+ onSelectCollection={handleSelectCollection}
onSelectPerson={handleSelectPerson}
+ onAddFileToCollection={handleAddSingleFileToCollection}
+ pendingFileIndex={pendingFileNavigation?.fileIndex}
+ pendingFileSidebar={pendingFileNavigation?.sidebar}
+ pendingHighlightCommentID={
+ pendingFileNavigation?.commentID
+ }
+ onPendingNavigationConsumed={
+ handlePendingNavigationConsumed
+ }
/>
- </>
- )}
+ )}
+ </PhotosNavigationSheel>
<Upload
{...{
user,
@@ -2153,94 +2240,6 @@ const Page: React.FC = () => {
title={t("add_a_person")}
onSelectPerson={handleContextMenuSelectPerson}
/>
- {cleanupView === "duplicates" ? (
- <DuplicatesView
- onBack={handleCloseCleanupView}
- onRemoteFilesPull={remoteFilesPull}
- />
- ) : cleanupView === "large-files" ? (
- <LargeFilesView
- onBack={handleCloseCleanupView}
- onRemoteFilesPull={remoteFilesPull}
- />
- ) : !isInSearchMode &&
- !isFirstLoad &&
- !state.collectionFiles.length &&
- activeCollectionID === PseudoCollectionID.all ? (
- <GalleryEmptyState
- isUploadInProgress={uploadManager.isUploadInProgress()}
- onUpload={openUploader}
- />
- ) : !isInSearchMode &&
- !isFirstLoad &&
- state.view?.type == "people" &&
- !state.view.activePerson ? (
- <PeopleEmptyState />
- ) : (
- <FileListWithViewer
- mode={barMode}
- modePlus={isInSearchMode ? "search" : barMode}
- header={fileListHeader}
- footer={fileListFooter}
- user={user}
- files={filteredFiles}
- onShowMap={handleShowCollectionMap}
- enableDownload={true}
- disableGrouping={
- state.searchSuggestion?.type == "clip" ||
- (!isInSearchMode &&
- activeCollection?.pubMagicMetadata?.data.sortBy ===
- "fileName")
- }
- enableSelect={true}
- selected={selected}
- setSelected={setSelected}
- // TODO: Incorrect assertion, need to update the type
- activeCollectionID={activeCollectionID!}
- activeCollectionSummary={activeCollectionSummary}
- activePersonID={activePerson?.id}
- isInIncomingSharedCollection={activeCollectionSummary?.attributes.has(
- "sharedIncoming",
- )}
- isInHiddenSection={barMode == "hidden-albums"}
- onContextMenuAction={handleContextMenuAction}
- onContextMenuOpenChange={setIsContextMenuOpen}
- suppressSelectionUI={suppressContextSelectionBar}
- showAddPersonAction={showAddPersonAction}
- showEditLocationAction={selected.ownCount > 0}
- {...{
- favoriteFileIDs,
- collectionNameByID,
- fileNormalCollectionIDs,
- fileCollectionIDs,
- hiddenCollectionIDs,
- pendingFavoriteUpdates,
- pendingVisibilityUpdates,
- onAddSaveGroup,
- }}
- collectionSummaries={normalCollectionSummaries}
- emailByUserID={state.emailByUserID}
- onToggleFavorite={handleFileViewerToggleFavorite}
- onFileVisibilityUpdate={
- handleFileViewerFileVisibilityUpdate
- }
- onSendLink={handleFileViewerSendLink}
- onMarkTempDeleted={handleMarkTempDeleted}
- onSetOpenFileViewer={setIsFileViewerOpen}
- onRemotePull={remotePull}
- onRemoteFilesPull={remoteFilesPull}
- onVisualFeedback={handleVisualFeedback}
- onSelectCollection={handleSelectCollection}
- onSelectPerson={handleSelectPerson}
- onAddFileToCollection={handleAddSingleFileToCollection}
- pendingFileIndex={pendingFileNavigation?.fileIndex}
- pendingFileSidebar={pendingFileNavigation?.sidebar}
- pendingHighlightCommentID={pendingFileNavigation?.commentID}
- onPendingNavigationConsumed={
- handlePendingNavigationConsumed
- }
- />
- )}
{slideshow &&
slideshow.collectionID === activeCollection?.id &&
!isInSearchMode && (