From 10a9ad02f891d435882e007fd656693cb8724f6e Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Mon, 10 Mar 2025 16:42:59 +0530 Subject: [PATCH] Remove no longer needed zi workarounds --- .../src/components/Collections/AlbumCastDialog.tsx | 8 +------- .../photos/src/components/FilesDownloadProgress.tsx | 6 +----- web/apps/photos/src/pages/_app.tsx | 9 ++------- web/packages/base/components/MiniDialog.tsx | 6 +++--- web/packages/gallery/components/FileInfo.tsx | 12 +----------- .../gallery/components/FileInfoComponents.tsx | 8 +------- .../new/photos/components/FileDateTimePicker.tsx | 6 ------ .../new/photos/components/FileViewerComponents.tsx | 2 -- .../new/photos/components/ImageEditorOverlay.tsx | 3 +-- .../new/photos/components/utils/z-index.tsx | 13 +------------ 10 files changed, 11 insertions(+), 62 deletions(-) diff --git a/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx b/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx index 6618280209..7ba3203c15 100644 --- a/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx +++ b/web/apps/photos/src/components/Collections/AlbumCastDialog.tsx @@ -4,7 +4,6 @@ import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton"; import log from "@/base/log"; import type { Collection } from "@/media/collection"; import { useSettingsSnapshot } from "@/new/photos/components/utils/use-snapshot"; -import { aboveFileViewerContentZ } from "@/new/photos/components/utils/z-index"; import { publishCastPayload, revokeAllCastTokens, @@ -130,12 +129,7 @@ export const AlbumCastDialog: React.FC = ({ }, [open]); return ( - + {view == "choose" && ( {browserCanCast && ( diff --git a/web/apps/photos/src/components/FilesDownloadProgress.tsx b/web/apps/photos/src/components/FilesDownloadProgress.tsx index fa015e482d..414aead441 100644 --- a/web/apps/photos/src/components/FilesDownloadProgress.tsx +++ b/web/apps/photos/src/components/FilesDownloadProgress.tsx @@ -1,6 +1,5 @@ import { useBaseContext } from "@/base/context"; import { Notification } from "@/new/photos/components/Notification"; -import { aboveFileViewerContentZ } from "@/new/photos/components/utils/z-index"; import { t } from "i18next"; import { GalleryContext } from "pages/gallery"; import { useContext } from "react"; @@ -118,10 +117,7 @@ export const FilesDownloadProgress: React.FC = ({ = ({ Component, pageProps }) => { + - - - + {isDesktop && {title}} diff --git a/web/packages/base/components/MiniDialog.tsx b/web/packages/base/components/MiniDialog.tsx index b4138df40f..eb31f37df6 100644 --- a/web/packages/base/components/MiniDialog.tsx +++ b/web/packages/base/components/MiniDialog.tsx @@ -153,7 +153,7 @@ export interface MiniDialogAttributes { buttonDirection?: "row" | "column"; } -type MiniDialogProps = Pick & { +type MiniDialogProps = Pick & { onClose: () => void; attributes?: MiniDialogAttributes; }; @@ -168,7 +168,7 @@ type MiniDialogProps = Pick & { */ export const AttributedMiniDialog: React.FC< React.PropsWithChildren -> = ({ open, onClose, sx, attributes, children }) => { +> = ({ open, onClose, attributes, children }) => { const [phase, setPhase] = useState< "loading" | "secondary-loading" | "failed" | undefined >(); @@ -268,7 +268,7 @@ export const AttributedMiniDialog: React.FC< return ( ), )(({ theme }) => ({ - zIndex: fileInfoDrawerZ, // [Note: Lighter backdrop for overlays on photo viewer] // // The default backdrop color we use for the drawer in light mode is too @@ -817,12 +812,7 @@ const RenameFileDialog: React.FC = ({ }; return ( - + {t("rename_file")} diff --git a/web/packages/gallery/components/FileInfoComponents.tsx b/web/packages/gallery/components/FileInfoComponents.tsx index fda2bc286e..367611c037 100644 --- a/web/packages/gallery/components/FileInfoComponents.tsx +++ b/web/packages/gallery/components/FileInfoComponents.tsx @@ -1,4 +1,3 @@ -import { aboveFileViewerContentZ } from "@/new/photos/components/utils/z-index"; import ContentCopyIcon from "@mui/icons-material/ContentCopy"; import DoneIcon from "@mui/icons-material/Done"; import { IconButton, Tooltip, type SvgIconProps } from "@mui/material"; @@ -28,12 +27,7 @@ export const CopyButton: React.FC = ({ text, size }) => { const Icon = copied ? DoneIcon : ContentCopyIcon; return ( - + diff --git a/web/packages/new/photos/components/FileDateTimePicker.tsx b/web/packages/new/photos/components/FileDateTimePicker.tsx index e8c080b9ec..a3e4a3e0e2 100644 --- a/web/packages/new/photos/components/FileDateTimePicker.tsx +++ b/web/packages/new/photos/components/FileDateTimePicker.tsx @@ -6,7 +6,6 @@ import { import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs"; import dayjs, { Dayjs } from "dayjs"; import React, { useState } from "react"; -import { aboveFileViewerContentZ } from "./utils/z-index"; interface FileDateTimePickerProps { /** @@ -93,11 +92,6 @@ export const FileDateTimePicker: React.FC = ({ layout: { sx: { ".MuiTimeClock-root": { minHeight: "336px" } }, }, - - /* We also get opened from the info drawer in the photo - viewer, so give our dialog a higher z-index than both the - photo viewer and the info drawer */ - dialog: { sx: { zIndex: aboveFileViewerContentZ } }, }} /> diff --git a/web/packages/new/photos/components/FileViewerComponents.tsx b/web/packages/new/photos/components/FileViewerComponents.tsx index 6cc139ea64..d45e04daa0 100644 --- a/web/packages/new/photos/components/FileViewerComponents.tsx +++ b/web/packages/new/photos/components/FileViewerComponents.tsx @@ -7,7 +7,6 @@ import log from "@/base/log"; import { Stack, Typography, type ModalProps } from "@mui/material"; import { t } from "i18next"; import { useState } from "react"; -import { aboveFileViewerContentZ } from "./utils/z-index"; type ConfirmDeleteFileDialogProps = ModalVisibilityProps & { /** @@ -59,7 +58,6 @@ export const ConfirmDeleteFileDialog: React.FC< onClose={handleClose} title={t("trash_file_title")} sx={(theme) => ({ - zIndex: aboveFileViewerContentZ, // See: [Note: Lighter backdrop for overlays on photo viewer] ...theme.applyStyles("light", { ".MuiBackdrop-root": { diff --git a/web/packages/new/photos/components/ImageEditorOverlay.tsx b/web/packages/new/photos/components/ImageEditorOverlay.tsx index 413a7d3878..d3f1be3889 100644 --- a/web/packages/new/photos/components/ImageEditorOverlay.tsx +++ b/web/packages/new/photos/components/ImageEditorOverlay.tsx @@ -22,7 +22,6 @@ import { downloadAndRevokeObjectURL } from "@/base/utils/web"; import { downloadManager } from "@/gallery/services/download"; import type { Collection } from "@/media/collection"; import type { EnteFile } from "@/media/file"; -import { aboveFileViewerContentZ } from "@/new/photos/components/utils/z-index"; import { getLocalCollections } from "@/new/photos/services/collections"; import { CenteredFlex } from "@ente/shared/components/Container"; import ChevronRightIcon from "@mui/icons-material/ChevronRight"; @@ -525,8 +524,8 @@ export const ImageEditorOverlay: React.FC = ({ diff --git a/web/packages/new/photos/components/utils/z-index.tsx b/web/packages/new/photos/components/utils/z-index.tsx index e96154e5c0..23a8174ac1 100644 --- a/web/packages/new/photos/components/utils/z-index.tsx +++ b/web/packages/new/photos/components/utils/z-index.tsx @@ -20,20 +20,9 @@ * tries to hold those customizations. */ -/** - * PhotoSwipe sets the zIndex of its "pswp" class to 1500. We need to go higher - * than that for our drawers and dialogs to get them to show above it. - */ -export const photoSwipeZ = 1500; - -/** - * The file info drawer needs to be higher than the photo viewer. - */ -export const fileInfoDrawerZ = photoSwipeZ + 1; - /** * Dialogs (not necessarily always) need to be higher still so to ensure they * are visible above the file info drawer in case they are shown in response to * some action taken in the file info drawer. */ -export const aboveFileViewerContentZ = fileInfoDrawerZ + 1; +export const aboveFileViewerContentZ = 1502;