Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(FileViewer):added-zIndex-to-show-Viewer-top-of-modal

Aswin Asok229b255d6843
diff --git a/web/apps/photos/src/components/Collections/CollectionMapDialog.tsx b/web/apps/photos/src/components/Collections/CollectionMapDialog.tsx
index ab66cb7ead..e65f1dcc5c 100644
--- a/web/apps/photos/src/components/Collections/CollectionMapDialog.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionMapDialog.tsx
@@ -31,13 +31,7 @@ import {
} from "ente-new/photos/services/photos-fdb";
import { t } from "i18next";
import "leaflet/dist/leaflet.css";
-import React, {
- Activity,
- useCallback,
- useEffect,
- useMemo,
- useState,
-} from "react";
+import React, { useCallback, useEffect, useMemo, useState } from "react";
import {
calculateOptimalZoom,
clusterPhotosByProximity,
@@ -551,20 +545,19 @@ export const CollectionMapDialog: React.FC<CollectionMapDialogProps> = ({
return (
<>
- <Activity mode={openFileViewer ? "visible" : "hidden"}>
- <FileViewer
- open={openFileViewer}
- onClose={handleCloseFileViewer}
- initialIndex={currentFileIndex}
- files={viewerFiles}
- user={user}
- onVisualFeedback={() => {
- // No-op for map view
- }}
- />
- </Activity>
+ <FileViewer
+ open={openFileViewer}
+ onClose={handleCloseFileViewer}
+ initialIndex={currentFileIndex}
+ files={viewerFiles}
+ user={user}
+ onVisualFeedback={() => {
+ // No-op for map view
+ }}
+ zIndex={1301}
+ />
- <Dialog fullScreen open={open && !openFileViewer} onClose={onClose}>
+ <Dialog fullScreen open={open} onClose={onClose}>
<Box
sx={{
position: "relative",
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx
index 10fbf06e77..bb693df91f 100644
--- a/web/packages/gallery/components/viewer/FileViewer.tsx
+++ b/web/packages/gallery/components/viewer/FileViewer.tsx
@@ -136,6 +136,12 @@ export type FileViewerProps = ModalVisibilityProps & {
* See: [Note: Gallery children can assume user]
*/
user?: LocalUser;
+ /**
+ * Optional z-index for the PhotoSwipe dialog.
+ *
+ * Use this when FileViewer needs to appear above other dialogs/modals.
+ */
+ zIndex?: number;
/**
* The list of files that are currently being displayed in the context in
* which the file viewer was invoked.
@@ -292,6 +298,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({
open,
onClose,
user,
+ zIndex,
files,
initialIndex,
disableDownload,
@@ -820,6 +827,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({
initialIndex,
haveUser,
showFullscreenButton,
+ zIndex,
delegate: delegateRef.current!,
onClose: () => {
if (psRef.current) handleClose();
@@ -848,6 +856,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({
open,
onClose,
user,
+ zIndex,
initialIndex,
disableDownload,
showFullscreenButton,
diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts
index 8457cac408..bce15c998f 100644
--- a/web/packages/gallery/components/viewer/photoswipe.ts
+++ b/web/packages/gallery/components/viewer/photoswipe.ts
@@ -92,7 +92,7 @@ export interface FileViewerPhotoSwipeDelegate {
type FileViewerPhotoSwipeOptions = Pick<
FileViewerProps,
- "initialIndex" | "showFullscreenButton"
+ "initialIndex" | "showFullscreenButton" | "zIndex"
> & {
/**
* `true` if we're running in the context of a logged in user, and so
@@ -193,6 +193,7 @@ export class FileViewerPhotoSwipe {
initialIndex,
haveUser,
showFullscreenButton,
+ zIndex,
delegate,
onClose,
onAnnotate,
@@ -1658,6 +1659,11 @@ export class FileViewerPhotoSwipe {
// Initializing PhotoSwipe adds it to the DOM as a dialog-like div with
// the class "pswp".
pswp.init();
+
+ // Apply custom z-index if provided.
+ if (zIndex !== undefined && pswp.element) {
+ pswp.element.style.zIndex = String(zIndex);
+ }
}
/**