Skip to content

armgit / ente

Public Imported from GitHub
0

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

Undep

Manav Rathid0f206741f50
diff --git a/web/apps/photos/src/components/PhotoViewer/FileInfo.tsx b/web/apps/photos/src/components/PhotoViewer/FileInfo.tsx
index e5b79af4d6..c6bef09278 100644
--- a/web/apps/photos/src/components/PhotoViewer/FileInfo.tsx
+++ b/web/apps/photos/src/components/PhotoViewer/FileInfo.tsx
@@ -77,7 +77,6 @@ import {
import { Formik } from "formik";
import { t } from "i18next";
import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
-import { PublicCollectionGalleryContext } from "utils/publicCollectionGallery";
import * as Yup from "yup";
// Re-uses images from ~leaflet package.
@@ -101,7 +100,15 @@ export interface FileInfoProps {
closePhotoViewer: () => void;
file: EnteFile | undefined;
exif: FileInfoExif | undefined;
+ /**
+ * TODO: Rename and flip to allowEdits.
+ */
shouldDisableEdits?: boolean;
+ /**
+ * If `true`, an inline map will be shown (if the user has enabled it) using
+ * the file's location.
+ */
+ allowMap: boolean;
scheduleUpdate: () => void;
refreshPhotoswipe: () => void;
fileToCollectionsMap?: Map<number, number[]>;
@@ -120,6 +127,7 @@ export interface FileInfoProps {
export const FileInfo: React.FC<FileInfoProps> = ({
shouldDisableEdits,
+ allowMap,
showInfo,
handleCloseInfo,
file,
@@ -136,9 +144,6 @@ export const FileInfo: React.FC<FileInfoProps> = ({
const { mapEnabled } = useSettingsSnapshot();
const { showMiniDialog } = useContext(AppContext);
- const publicCollectionGalleryContext = useContext(
- PublicCollectionGalleryContext,
- );
const [exifInfo, setExifInfo] = useState<ExifInfo | undefined>();
const { show: showRawExif, props: rawExifVisibilityProps } =
@@ -240,8 +245,7 @@ export const FileInfo: React.FC<FileInfoProps> = ({
icon={<LocationOnOutlinedIcon />}
title={t("location")}
caption={
- !mapEnabled ||
- publicCollectionGalleryContext.credentials ? (
+ !mapEnabled || !allowMap ? (
<Link
href={openStreetMapLink(location)}
target="_blank"
@@ -267,7 +271,7 @@ export const FileInfo: React.FC<FileInfoProps> = ({
/>
}
/>
- {!publicCollectionGalleryContext.credentials && (
+ {allowMap && (
<MapBox
location={location}
mapEnabled={mapEnabled}
diff --git a/web/apps/photos/src/components/PhotoViewer/index.tsx b/web/apps/photos/src/components/PhotoViewer/index.tsx
index 6d47486512..5a8b8ae5e4 100644
--- a/web/apps/photos/src/components/PhotoViewer/index.tsx
+++ b/web/apps/photos/src/components/PhotoViewer/index.tsx
@@ -137,8 +137,8 @@ export const PhotoViewer: React.FC<PhotoViewerProps> = ({
collectionNameMap,
onSelectPerson,
}) => {
- const galleryContext = useContext(GalleryContext);
const { showLoadingBar, hideLoadingBar } = useContext(AppContext);
+ const galleryContext = useContext(GalleryContext);
const publicCollectionGalleryContext = useContext(
PublicCollectionGalleryContext,
);
@@ -968,6 +968,7 @@ export const PhotoViewer: React.FC<PhotoViewerProps> = ({
file={photoSwipe?.currItem as EnteFile}
exif={exif?.value}
shouldDisableEdits={!isOwnFile}
+ allowMap={!publicCollectionGalleryContext.credentials}
showCollectionChips={
!isTrashCollection && isOwnFile && !isInHiddenSection
}