Skip to content

armgit / ente

Public Imported from GitHub
0

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

fixing(CollectionMapDialog):fixing-when-no-geotagged-location

Aswin Asok3689d26fa378
diff --git a/web/apps/photos/src/components/Collections/CollectionMapDialog.tsx b/web/apps/photos/src/components/Collections/CollectionMapDialog.tsx
index 1a4525bb54..9464118b18 100644
--- a/web/apps/photos/src/components/Collections/CollectionMapDialog.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionMapDialog.tsx
@@ -247,8 +247,19 @@ function useMapData(
});
void loadAllThumbs(pointsWithThumbs, files);
+ return;
}
+ // Reset state when no geotagged locations exist to avoid showing stale data
+ setState({
+ filesByID: new Map(),
+ mapCenter: null,
+ mapPhotos: [],
+ thumbByFileID: new Map(),
+ isLoading: false,
+ error: null,
+ });
+
return;
} catch (e) {
setState((prev) => ({
@@ -690,6 +701,7 @@ function extractLocationPoints(files: EnteFile[]): JourneyPoint[] {
for (const file of files) {
const loc = fileLocation(file);
if (!loc) continue;
+ if (loc.latitude === 0 && loc.longitude === 0) continue; // Ignore invalid default coordinates
points.push({
lat: loc.latitude,
@@ -852,10 +864,9 @@ export const CollectionMapDialog: React.FC<CollectionMapDialogProps> = ({
return (
<CenteredBox onClose={onClose} closeLabel={t("close")}>
<Typography variant="body" color="text.secondary">
- {t("view_on_map")}
- </Typography>
- <Typography variant="small" color="text.secondary">
- {t("maps_privacy_notice")}
+ {t("no_geotagged_photos", {
+ defaultValue: "No photos found with location information",
+ })}
</Typography>
</CenteredBox>
);
diff --git a/web/packages/base/components/SingleInputDialog.tsx b/web/packages/base/components/SingleInputDialog.tsx
index 9a1cf64b69..bc9d279f2b 100644
--- a/web/packages/base/components/SingleInputDialog.tsx
+++ b/web/packages/base/components/SingleInputDialog.tsx
@@ -1,4 +1,4 @@
-import { Dialog, DialogContent, DialogTitle } from "@mui/material";
+import { Dialog, DialogContent, DialogTitle, useTheme } from "@mui/material";
import type { ModalVisibilityProps } from "ente-base/components/utils/modal";
import React, { useCallback } from "react";
import { SingleInputForm, type SingleInputFormProps } from "./SingleInputForm";
@@ -7,6 +7,8 @@ type SingleInputDialogProps = ModalVisibilityProps &
Omit<SingleInputFormProps, "onCancel"> & {
/** Title of the dialog. */
title: string;
+ /** Optional z-index override to layer above other dialogs. */
+ zIndex?: number;
};
/**
@@ -23,8 +25,12 @@ export const SingleInputDialog: React.FC<SingleInputDialogProps> = ({
onClose,
onSubmit,
title,
+ zIndex,
...rest
}) => {
+ const theme = useTheme();
+ const dialogZIndex = zIndex ?? theme.zIndex.modal + 4;
+
const handleSubmit: SingleInputFormProps["onSubmit"] = useCallback(
async (value, setFieldError) => {
await onSubmit(value, setFieldError);
@@ -39,6 +45,7 @@ export const SingleInputDialog: React.FC<SingleInputDialogProps> = ({
onClose={onClose}
maxWidth="xs"
fullWidth
+ sx={{ zIndex: dialogZIndex }}
slotProps={{ paper: { sx: { p: "8px 4px 4px 4px" } } }}
>
<DialogTitle>{title}</DialogTitle>