Skip to content

armgit / ente

Public Imported from GitHub
0

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

Merge branch 'main' into right-click-menu

Aswin Asoka07843998699
diff --cc web/apps/photos/src/pages/gallery.tsx
index a26743560e,46798dad27..4e6a8485c4
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@@ -104,11 -104,11 +106,15 @@@ import
PseudoCollectionID,
} from "ente-new/photos/services/collection-summary";
import exportService from "ente-new/photos/services/export";
- import { updateFilesVisibility } from "ente-new/photos/services/file";
+import {
+ addManualFileAssignmentsToPerson,
+ isMLEnabled,
+} from "ente-new/photos/services/ml";
+ import {
+ updateFilesLocation,
+ updateFilesVisibility,
+ } from "ente-new/photos/services/file";
-import { addManualFileAssignmentsToPerson } from "ente-new/photos/services/ml";
++
import {
savedCollectionFiles,
savedCollections,
@@@ -955,33 -967,28 +997,51 @@@ const Page: React.FC = () =>
selectedFiles.map((f) => f.id),
);
clearSelection();
+ const personName = namedPeople.find((p) => p.id === personID)?.name;
+ showNotification({
+ color: "secondary",
+ startIcon: <CheckCircleIcon />,
+ title: t("added_to_person"),
+ caption: personName,
+ autoHideDuration: 3000,
+ });
+ },
+ [
+ selected,
+ filteredFiles,
+ clearSelection,
+ showNotification,
+ namedPeople,
+ ],
+ );
+
+ // Handler for selecting a person from the context menu assign person dialog
+ const handleContextMenuSelectPerson = useCallback(
+ (personID: string) => {
+ contextMenuAssignPersonProps.onClose();
+ void handleAddPersonToSelectedFiles(personID);
},
- [selected, filteredFiles, clearSelection],
+ [contextMenuAssignPersonProps, handleAddPersonToSelectedFiles],
);
+ const handleEditLocationConfirm = useCallback(
+ async (location: Location) => {
+ // Only update files owned by the user
+ const userFiles = selectedFilesInView.filter(
+ (f) => f.ownerID == user!.id,
+ );
+ if (userFiles.length > 0) {
+ await updateFilesLocation(
+ userFiles,
+ location.latitude,
+ location.longitude,
+ );
+ }
+ void remotePull({ silent: true });
+ },
+ [selectedFilesInView, user, remotePull],
+ );
+
const handleSelectSearchOption = (
searchOption: SearchOption | undefined,
options?: { shouldExitSearchMode?: boolean },
@@@ -1458,10 -1355,10 +1520,11 @@@
createOnCreateForCollectionOp,
createOnSelectForCollectionOp,
createFileOpHandler,
- onAddPersonToSelectedFiles:
- handleAddPersonToSelectedFiles,
+ onShowAssignPersonDialog: showAddPersonAction
+ ? showContextMenuAssignPerson
+ : undefined,
}}
+ onEditLocation={showEditLocation}
/>
) : barMode == "hidden-albums" ? (
<HiddenSectionNavbarContents
diff --cc web/packages/new/photos/components/SelectedFileOptions.tsx
index 4c880e38e7,fa49e3305c..21576e5685
--- a/web/packages/new/photos/components/SelectedFileOptions.tsx
+++ b/web/packages/new/photos/components/SelectedFileOptions.tsx
@@@ -11,11 -14,13 +14,11 @@@ import RestoreIcon from "@mui/icons-mat
import UnArchiveIcon from "@mui/icons-material/Unarchive";
import VisibilityOffOutlinedIcon from "@mui/icons-material/VisibilityOffOutlined";
import VisibilityOutlinedIcon from "@mui/icons-material/VisibilityOutlined";
- import { IconButton, Tooltip, Typography } from "@mui/material";
+ import { Box, Button, IconButton, Tooltip, Typography } from "@mui/material";
import { SpacedRow } from "ente-base/components/containers";
import type { ButtonishProps } from "ente-base/components/mui";
-import { useModalVisibility } from "ente-base/components/utils/modal";
import { useBaseContext } from "ente-base/context";
import type { Collection } from "ente-media/collection";
-import { AssignPersonDialog } from "ente-new/photos/components/AssignPersonDialog";
import type { CollectionSelectorAttributes } from "ente-new/photos/components/CollectionSelector";
import type { GalleryBarMode } from "ente-new/photos/components/gallery/reducer";
import { StarBorderIcon } from "ente-new/photos/components/icons/StarIcon";
@@@ -135,15 -144,24 +138,31 @@@ interface SelectedFileOptionsProps
*/
createFileOpHandler: (op: FileOp) => () => void;
/**
- * If set, then an option to manually associate the selected file(s) with a
- * person will be shown (when ML is enabled and there are named people).
+ * Callback to show the assign person dialog.
+ *
+ * Similar to {@link onOpenCollectionSelector}, this opens a shared dialog
+ * defined in the parent component where the user can select a person to
+ * associate with the selected files.
+ *
+ * If not set, the "Add Person" option will not be shown.
*/
+ onShowAssignPersonDialog?: () => void;
++
+ onAddPersonToSelectedFiles?: (personID: string) => Promise<void>;
+ /**
+ * Called when the user wants to edit the location of the selected files.
+ *
+ * Only shown when at least one owned file is selected.
+ */
+ onEditLocation?: () => void;
+ /**
+ * Called when the user wants to select all files.
+ */
+ onSelectAll: () => void;
+ /**
+ * If true, all files in the current view are selected.
+ */
+ isAllSelected: boolean;
}
/**
@@@ -163,7 -181,10 +182,11 @@@ export const SelectedFileOptions: React
createOnCreateForCollectionOp,
createOnSelectForCollectionOp,
createFileOpHandler,
+ onShowAssignPersonDialog,
+ onAddPersonToSelectedFiles,
+ onEditLocation,
+ onSelectAll,
+ isAllSelected,
}) => {
const { showMiniDialog } = useBaseContext();