π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix(ContextMenu):fix-default-selected-option
Aswin Asokd1e1cb69774f
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsxindex bdbe456b8b..525ea76663 100644--- a/web/apps/photos/src/pages/shared-albums.tsx+++ b/web/apps/photos/src/pages/shared-albums.tsx@@ -1,8 +1,9 @@// TODO: Audit this file (too many null assertions + other issues)/* eslint-disable @typescript-eslint/no-floating-promises */+import { Download01Icon } from "@hugeicons/core-free-icons";+import { HugeiconsIcon } from "@hugeicons/react";import AddPhotoAlternateOutlinedIcon from "@mui/icons-material/AddPhotoAlternateOutlined";import CloseIcon from "@mui/icons-material/Close";-import DownloadIcon from "@mui/icons-material/Download";import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";import {@@ -83,6 +84,8 @@ import { updateShouldDisableCFUploadProxy } from "ente-gallery/services/upload";import { sortFiles } from "ente-gallery/utils/file";import type { Collection } from "ente-media/collection";import { type EnteFile } from "ente-media/file";+import { fileFileName } from "ente-media/file-metadata";+import { FileType } from "ente-media/file-type";import {removePublicCollectionAccessTokenJWT,removePublicCollectionByKey,@@ -469,9 +472,15 @@ export default function PublicCollectionGallery() {const downloadFilesHelper = async () => {try {const selectedFiles = getSelectedFiles(selected, publicFiles!);+ const singleFile =+ selectedFiles.length === 1 ? selectedFiles[0] : undefined;+ const title =+ singleFile?.metadata.fileType === FileType.livePhoto+ ? fileFileName(singleFile)+ : t("files_count", { count: selectedFiles.length });await downloadAndSaveFiles(selectedFiles,- t("files_count", { count: selectedFiles.length }),+ title,onAddSaveGroup,);clearSelection();@@ -819,7 +828,7 @@ const SelectedFileOptions: React.FC<SelectedFileOptionsProps> = ({</Typography><Tooltip title={t("download")}><IconButton onClick={downloadFilesHelper}>- <DownloadIcon />+ <HugeiconsIcon icon={Download01Icon} size={22} /></IconButton></Tooltip></Stack>diff --git a/web/apps/photos/src/utils/file/index.ts b/web/apps/photos/src/utils/file/index.tsindex aa8f5035c4..98bf361e56 100644--- a/web/apps/photos/src/utils/file/index.ts+++ b/web/apps/photos/src/utils/file/index.ts@@ -1,7 +1,8 @@import type { AddSaveGroup } from "ente-gallery/components/utils/save-groups";import { downloadAndSaveFiles } from "ente-gallery/services/save";import type { EnteFile } from "ente-media/file";-import { ItemVisibility } from "ente-media/file-metadata";+import { fileFileName, ItemVisibility } from "ente-media/file-metadata";+import { FileType } from "ente-media/file-type";import { type SelectionContext } from "ente-new/photos/components/gallery";import { type FileOp } from "ente-new/photos/components/SelectedFileOptions";import {@@ -56,9 +57,14 @@ export const performFileOp = async () => {switch (op) {case "download": {+ const singleFile = files.length === 1 ? files[0] : undefined;+ const title =+ singleFile?.metadata.fileType === FileType.livePhoto+ ? fileFileName(singleFile)+ : t("files_count", { count: files.length });await downloadAndSaveFiles(files,- t("files_count", { count: files.length }),+ title,onAddSaveGroup,);break;diff --git a/web/packages/gallery/services/save.ts b/web/packages/gallery/services/save.tsindex 1314973d76..502bf647a1 100644--- a/web/packages/gallery/services/save.ts+++ b/web/packages/gallery/services/save.ts@@ -420,9 +420,14 @@ class ZipBatcher {this.currentFileCount === 1? "1 file": `${this.currentFileCount} files`;- const zipName = this.includePartNumber- ? `${this.baseName} Part ${this.batchIndex} - ${fileLabel}.zip`- : `${this.baseName} - ${fileLabel}.zip`;+ const baseName = this.baseName.trim();+ const nameBase = this.includePartNumber+ ? `${baseName} Part ${this.batchIndex}`+ : baseName;+ const zipName =+ baseName.toLowerCase() === fileLabel.toLowerCase()+ ? `${nameBase}.zip`+ : `${nameBase} - ${fileLabel}.zip`;const url = URL.createObjectURL(zipBlob);saveAsFileAndRevokeObjectURL(url, zipName);diff --git a/web/packages/new/photos/components/FileContextMenu.tsx b/web/packages/new/photos/components/FileContextMenu.tsxindex 9d42935a00..da3c90a855 100644--- a/web/packages/new/photos/components/FileContextMenu.tsx+++ b/web/packages/new/photos/components/FileContextMenu.tsx@@ -96,15 +96,6 @@ const actionConfigs: Record<FileContextAction, ActionConfig> = {*/export const FileContextMenu: React.FC<FileContextMenuProps> = memo(({ open, anchorPosition, onClose, actions, onAction }) => {- const adjustedAnchorPosition = useMemo(() => {- if (!anchorPosition) return undefined;- const offset = 8;- return {- top: anchorPosition.top + offset,- left: anchorPosition.left + offset,- };- }, [anchorPosition]);-const handleActionClick = useCallback((action: FileContextAction) => {onClose();@@ -131,8 +122,9 @@ export const FileContextMenu: React.FC<FileContextMenuProps> = memo(<StyledMenuopen={open}onClose={onClose}+ disableAutoFocusItemanchorReference="anchorPosition"- anchorPosition={adjustedAnchorPosition}+ anchorPosition={anchorPosition}slotProps={{root: {onContextMenu: (e: React.MouseEvent) =>diff --git a/web/packages/new/photos/components/SelectedFileOptions.tsx b/web/packages/new/photos/components/SelectedFileOptions.tsxindex 17a2fc0df4..c402b72a4e 100644--- a/web/packages/new/photos/components/SelectedFileOptions.tsx+++ b/web/packages/new/photos/components/SelectedFileOptions.tsx@@ -437,9 +437,8 @@ export const SelectedFileOptions: React.FC<SelectedFileOptionsProps> = ({</>) : (<>- {!isUserFavorites &&- collectionSummary?.id !=- PseudoCollectionID.archiveItems &&+ {collectionSummary?.id !=+ PseudoCollectionID.archiveItems &&favoriteActionButton}<FixTimeButton onClick={handleFixTime} />{onEditLocation && selectedOwnFileCount > 0 && (