Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(photos):integrate-free-up-space-navigation-shell

Aswin Asokaa7c936b88bc
diff --git a/web/apps/photos/src/components/gallery/DuplicatesView.tsx b/web/apps/photos/src/components/gallery/DuplicatesView.tsx
index 1f016c17fa..485d6adc0a 100644
--- a/web/apps/photos/src/components/gallery/DuplicatesView.tsx
+++ b/web/apps/photos/src/components/gallery/DuplicatesView.tsx
@@ -3,7 +3,6 @@ import {
removeSelectedDuplicateGroups,
type DuplicateGroup,
} from "@/services/dedup";
-import ArrowBackIcon from "@mui/icons-material/ArrowBack";
import DoneIcon from "@mui/icons-material/Done";
import RemoveCircleOutlinedIcon from "@mui/icons-material/RemoveCircleOutlined";
import SortIcon from "@mui/icons-material/Sort";
@@ -11,7 +10,6 @@ import {
Box,
Checkbox,
Divider,
- IconButton,
LinearProgress,
Stack,
styled,
@@ -55,14 +53,10 @@ import {
} from "react-window";
interface DuplicatesViewProps {
- onBack: () => void;
onRemoteFilesPull: () => Promise<void>;
}
-export function DuplicatesView({
- onBack,
- onRemoteFilesPull,
-}: DuplicatesViewProps) {
+export function DuplicatesView({ onRemoteFilesPull }: DuplicatesViewProps) {
const { onGenericError } = useBaseContext();
const [state, dispatch] = useReducer(dedupReducer, initialDedupState);
@@ -135,7 +129,6 @@ export function DuplicatesView({
return (
<Stack sx={{ flex: 1, minHeight: 0 }}>
<Navbar
- onBack={onBack}
sortOrder={state.sortOrder}
onChangeSortOrder={(sortOrder) =>
dispatch({ type: "changeSortOrder", sortOrder })
@@ -285,14 +278,12 @@ const deducePrunableCountAndSize = (duplicateGroups: DuplicateGroup[]) => {
};
interface NavbarProps {
- onBack: () => void;
sortOrder: SortOrder;
onChangeSortOrder: (sortOrder: SortOrder) => void;
onDeselectAll: () => void;
}
const Navbar: React.FC<NavbarProps> = ({
- onBack,
sortOrder,
onChangeSortOrder,
onDeselectAll,
@@ -303,20 +294,11 @@ const Navbar: React.FC<NavbarProps> = ({
sx={(theme) => ({
alignItems: "center",
justifyContent: "space-between",
- padding: "8px 4px",
+ padding: "8px 16px",
+ minHeight: "56px",
borderBottom: `1px solid ${theme.vars.palette.divider}`,
})}
>
- <Box
- sx={{
- // Match the two right-side icons and their gap.
- minWidth: "100px",
- }}
- >
- <IconButton onClick={onBack} aria-label={t("go_back")}>
- <ArrowBackIcon />
- </IconButton>
- </Box>
<Typography variant="h6">{t("remove_duplicates")}</Typography>
<Stack direction="row" sx={{ gap: "4px" }}>
<SortMenu {...{ sortOrder, onChangeSortOrder }} />
diff --git a/web/apps/photos/src/components/gallery/LargeFilesView.tsx b/web/apps/photos/src/components/gallery/LargeFilesView.tsx
index 6e8221a624..b23366d961 100644
--- a/web/apps/photos/src/components/gallery/LargeFilesView.tsx
+++ b/web/apps/photos/src/components/gallery/LargeFilesView.tsx
@@ -6,13 +6,11 @@ import {
type LargeFileFilter,
type LargeFileItem,
} from "@/services/large-files";
-import ArrowBackIcon from "@mui/icons-material/ArrowBack";
import ImageIcon from "@mui/icons-material/Image";
import VideocamIcon from "@mui/icons-material/Videocam";
import {
Box,
Chip,
- IconButton,
LinearProgress,
Stack,
styled,
@@ -52,14 +50,10 @@ import {
} from "react-window";
interface LargeFilesViewProps {
- onBack: () => void;
onRemoteFilesPull: () => Promise<void>;
}
-export function LargeFilesView({
- onBack,
- onRemoteFilesPull,
-}: LargeFilesViewProps) {
+export function LargeFilesView({ onRemoteFilesPull }: LargeFilesViewProps) {
const { showMiniDialog, onGenericError } = useBaseContext();
const { setIsFileViewerOpen } = usePhotosAppContext();
@@ -179,7 +173,6 @@ export function LargeFilesView({
return (
<Stack sx={{ flex: 1, minHeight: 0 }}>
<Navbar
- onBack={onBack}
filter={state.filter}
onChangeFilter={(filter) =>
dispatch({ type: "changeFilter", filter })
@@ -200,12 +193,11 @@ export function LargeFilesView({
}
interface NavbarProps {
- onBack: () => void;
filter: LargeFileFilter;
onChangeFilter: (filter: LargeFileFilter) => void;
}
-const Navbar: React.FC<NavbarProps> = ({ filter, onChangeFilter, onBack }) => {
+const Navbar: React.FC<NavbarProps> = ({ filter, onChangeFilter }) => {
return (
<Stack>
<Stack
@@ -213,17 +205,12 @@ const Navbar: React.FC<NavbarProps> = ({ filter, onChangeFilter, onBack }) => {
sx={(theme) => ({
alignItems: "center",
justifyContent: "space-between",
- padding: "8px 4px",
+ padding: "8px 16px",
+ minHeight: "56px",
borderBottom: `1px solid ${theme.vars.palette.divider}`,
})}
>
- <Box sx={{ minWidth: "100px" }}>
- <IconButton onClick={onBack} aria-label={t("go_back")}>
- <ArrowBackIcon />
- </IconButton>
- </Box>
<Typography variant="h6">{t("large_files_title")}</Typography>
- <Box sx={{ minWidth: "100px" }} />
</Stack>
<FilterChips {...{ filter, onChangeFilter }} />
</Stack>
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index bdd8632e2a..6dac2e8f25 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -1360,6 +1360,7 @@ const Page: React.FC = () => {
options?: { shouldExitSearchMode?: boolean },
) => {
if (searchOption) {
+ setCleanupView(undefined);
const type = searchOption.suggestion.type;
if (type == "collection") {
dispatch({
@@ -1462,11 +1463,6 @@ const Page: React.FC = () => {
[handleShowCleanupView],
);
- const handleCloseCleanupView = useCallback(() => {
- setCleanupView(undefined);
- dispatch({ type: "showAll" });
- }, []);
-
const handleSidebarShowCollectionSummary = showCollectionSummary;
const handleDownloadStatusNotificationsShowCollectionSummary = useCallback(
@@ -1595,6 +1591,7 @@ const Page: React.FC = () => {
const handleSelectPerson = useCallback(
(personID: string) => {
+ setCleanupView(undefined);
closeCollectionMap();
dispatch({ type: "showPerson", personID });
},
@@ -1938,7 +1935,7 @@ const Page: React.FC = () => {
</>
);
- const showNormalNavigation = !isCleanupViewOpen && !showSelectionBar;
+ const showNormalNavigation = !showSelectionBar;
return (
<FullScreenDropZone
@@ -1982,7 +1979,7 @@ const Page: React.FC = () => {
/>
)}
<PhotosNavigationShell
- showRail={!isCleanupViewOpen}
+ showRail
showNormalNavigation={showNormalNavigation}
isInSearchMode={isInSearchMode}
onSidebar={showSidebar}
@@ -1991,7 +1988,10 @@ const Page: React.FC = () => {
handleShowCollectionSummaryWithID(PseudoCollectionID.all)
}
onSelectSearchOption={handleSelectSearchOption}
- onSelectPeople={() => dispatch({ type: "showPeople" })}
+ onSelectPeople={() => {
+ setCleanupView(undefined);
+ dispatch({ type: "showPeople" });
+ }}
onSelectPerson={handleSelectPerson}
alternateHeader={
showSelectionBar ? (
@@ -2080,15 +2080,9 @@ const Page: React.FC = () => {
</>
)}
{cleanupView === "duplicates" ? (
- <DuplicatesView
- onBack={handleCloseCleanupView}
- onRemoteFilesPull={remoteFilesPull}
- />
+ <DuplicatesView onRemoteFilesPull={remoteFilesPull} />
) : cleanupView === "large-files" ? (
- <LargeFilesView
- onBack={handleCloseCleanupView}
- onRemoteFilesPull={remoteFilesPull}
- />
+ <LargeFilesView onRemoteFilesPull={remoteFilesPull} />
) : !isInSearchMode &&
!isFirstLoad &&
!state.collectionFiles.length &&