π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add send link action to file context menu
Anand Baburajan961ba0096524
diff --git a/web/apps/photos/src/components/FileList.tsx b/web/apps/photos/src/components/FileList.tsxindex 6e423d335f..859e99d1c1 100644--- a/web/apps/photos/src/components/FileList.tsx+++ b/web/apps/photos/src/components/FileList.tsx@@ -666,6 +666,7 @@ export const FileList: React.FC<FileListProps> = ({collectionSummary,showAddPerson: !!showAddPersonAction,showEditLocation: !!showEditLocationAction && selected.ownCount > 0,+ showSendLink: selected.ownCount > 0,});if (!actions.includes("favorite")) return actions;if (diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex d145cd3bae..f2262610b0 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -1345,6 +1345,9 @@ const Page: React.FC = () => {// The selection should already be set by FileList's handleContextMenu// We just need to invoke the appropriate action handlerswitch (action) {+ case "sendLink":+ createFileOpHandler("sendLink")();+ break;case "download":createFileOpHandler("download")();break;diff --git a/web/packages/new/photos/components/FileContextMenu.tsx b/web/packages/new/photos/components/FileContextMenu.tsxindex da3c90a855..f46ecae0d8 100644--- a/web/packages/new/photos/components/FileContextMenu.tsx+++ b/web/packages/new/photos/components/FileContextMenu.tsx@@ -6,6 +6,7 @@ import {Download01Icon,Download05Icon,Location01Icon,+ Navigation03Icon,RemoveCircleIcon,StarOffIcon,Time04Icon,@@ -60,6 +61,7 @@ const hugeIcon = (icon: IconSvgElement, size = 20) => ();const actionConfigs: Record<FileContextAction, ActionConfig> = {+ sendLink: { label: "Send link", Icon: hugeIcon(Navigation03Icon) },download: { label: "download", Icon: hugeIcon(Download01Icon) },fixTime: { label: "fix_creation_time", Icon: hugeIcon(Time04Icon) },editLocation: { label: "edit_location", Icon: hugeIcon(Location01Icon) },diff --git a/web/packages/new/photos/utils/file-actions.ts b/web/packages/new/photos/utils/file-actions.tsindex 0ec92bc3a3..b070360c9d 100644--- a/web/packages/new/photos/utils/file-actions.ts+++ b/web/packages/new/photos/utils/file-actions.ts@@ -10,6 +10,7 @@ import {* These correspond to the same operations available in SelectedFileOptions.*/export type FileContextAction =+ | "sendLink"| "download"| "fixTime"| "editLocation"@@ -53,6 +54,12 @@ export interface FileActionContext {* This depends on the selection containing owned files.*/showEditLocation: boolean;+ /**+ * Whether to show the "Send link" action.+ *+ * This depends on the selection containing owned files.+ */+ showSendLink: boolean;}/**@@ -70,6 +77,7 @@ export function getAvailableFileActions(collectionSummary,showAddPerson,showEditLocation,+ showSendLink,} = context;const actions = getBaseActions(@@ -79,6 +87,10 @@ export function getAvailableFileActions(showEditLocation,);+ if (showSendLink && collectionSummary?.id !== PseudoCollectionID.trash) {+ insertSendLinkBeforeDownload(actions);+ }+// Insert "addPerson" before modification actions if enabled// (not applicable for trash since you can't add people to trashed files)if (showAddPerson && collectionSummary?.id !== PseudoCollectionID.trash) {@@ -173,6 +185,18 @@ function getBaseActions(return actions;}+/**+ * Inserts "sendLink" before "download" if present, else prepends it.+ */+function insertSendLinkBeforeDownload(actions: FileContextAction[]): void {+ const downloadIndex = actions.indexOf("download");+ if (downloadIndex !== -1) {+ actions.splice(downloadIndex, 0, "sendLink");+ } else {+ actions.unshift("sendLink");+ }+}+/*** Actions that modify file visibility or collection membership.* "addPerson" is inserted before the first of these actions.