Skip to content

armgit / ente

Public Imported from GitHub
0

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

chore(CollectionHeader):added-map-view-to-favorites-and-shared-incoming

Aswin Asok02c0d179f9c6
diff --git a/web/apps/photos/src/components/Collections/CollectionHeader.tsx b/web/apps/photos/src/components/Collections/CollectionHeader.tsx
index 2769b2704d..cafcaceaae 100644
--- a/web/apps/photos/src/components/Collections/CollectionHeader.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionHeader.tsx
@@ -13,6 +13,7 @@ import LinkIcon from "@mui/icons-material/Link";
import LogoutIcon from "@mui/icons-material/Logout";
import MapOutlinedIcon from "@mui/icons-material/MapOutlined";
import MoreHorizIcon from "@mui/icons-material/MoreHoriz";
+import PublicIcon from "@mui/icons-material/Public";
import PushPinIcon from "@mui/icons-material/PushPin";
import PushPinOutlinedIcon from "@mui/icons-material/PushPinOutlined";
import SortIcon from "@mui/icons-material/Sort";
@@ -507,6 +508,15 @@ const CollectionHeaderOptions: React.FC<CollectionHeaderProps> = ({
case "sharedIncoming":
menuOptions = [
+ shouldShowMapOption(collectionSummary) && (
+ <OverflowMenuOption
+ key="map"
+ onClick={handleShowMap}
+ startIcon={<MapOutlinedIcon />}
+ >
+ {t("map")}
+ </OverflowMenuOption>
+ ),
// Pin/Unpin for shared incoming collections
collectionSummary.attributes.has("shareePinned") ? (
<OverflowMenuOption
@@ -733,6 +743,7 @@ const CollectionHeaderOptions: React.FC<CollectionHeaderProps> = ({
collectionSummary={collectionSummary}
isQuickLinkAlbum={!!isQuickLinkAlbum}
isDownloadInProgress={isActiveCollectionDownloadInProgress}
+ onMapClick={handleShowMap}
onEmptyTrashClick={confirmEmptyTrash}
onDownloadClick={downloadCollection}
onShareClick={
@@ -797,6 +808,7 @@ interface QuickOptionsProps {
collectionSummary: CollectionSummary;
isQuickLinkAlbum: boolean;
isDownloadInProgress: () => boolean;
+ onMapClick: () => void;
onEmptyTrashClick: () => void;
onDownloadClick: () => void;
onShareClick: () => void;
@@ -805,6 +817,7 @@ interface QuickOptionsProps {
}
const QuickOptions: React.FC<QuickOptionsProps> = ({
+ onMapClick,
onEmptyTrashClick,
onDownloadClick,
onShareClick,
@@ -833,6 +846,9 @@ const QuickOptions: React.FC<QuickOptionsProps> = ({
onClick={onCleanUncategorizedClick}
/>
)}
+ {showMapQuickOption(collectionSummary) && (
+ <MapQuickOption onClick={onMapClick} />
+ )}
{showShareQuickOption(collectionSummary) && (
<ShareQuickOption
collectionSummary={collectionSummary}
@@ -870,6 +886,24 @@ const CleanUncategorizedQuickOption: React.FC<OptionProps> = ({ onClick }) => (
</Tooltip>
);
+const MapQuickOption: React.FC<OptionProps> = ({ onClick }) => (
+ <Tooltip title={t("map")}>
+ <IconButton onClick={onClick}>
+ <Box
+ sx={{
+ width: 24,
+ height: 24,
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ }}
+ >
+ <PublicIcon />
+ </Box>
+ </IconButton>
+ </Tooltip>
+);
+
const showDownloadQuickOption = ({ type, attributes }: CollectionSummary) =>
type == "album" ||
type == "folder" ||
@@ -878,6 +912,10 @@ const showDownloadQuickOption = ({ type, attributes }: CollectionSummary) =>
attributes.has("favorites") ||
attributes.has("shared");
+const showMapQuickOption = (collectionSummary: CollectionSummary) =>
+ collectionSummary.type == "userFavorites" &&
+ shouldShowMapOption(collectionSummary);
+
const shouldShowMapOption = ({ type, fileCount }: CollectionSummary) =>
fileCount > 0 &&
type !== "all" &&