mirror of
https://github.com/immich-app/immich.git
synced 2025-12-22 01:11:20 +03:00
@@ -16,48 +16,37 @@ import {
|
||||
type SharedLinkEditDto,
|
||||
type SharedLinkResponseDto,
|
||||
} from '@immich/sdk';
|
||||
import { MenuItemType, menuManager, modalManager, toastManager, type MenuItem } from '@immich/ui';
|
||||
import { mdiCircleEditOutline, mdiContentCopy, mdiDelete, mdiDotsVertical, mdiQrcode } from '@mdi/js';
|
||||
import { modalManager, toastManager, type ActionItem } from '@immich/ui';
|
||||
import { mdiCircleEditOutline, mdiContentCopy, mdiDelete, mdiQrcode } from '@mdi/js';
|
||||
import type { MessageFormatter } from 'svelte-i18n';
|
||||
|
||||
export const getSharedLinkActions = ($t: MessageFormatter, sharedLink: SharedLinkResponseDto) => {
|
||||
const Edit: MenuItem = {
|
||||
const Edit: ActionItem = {
|
||||
title: $t('edit_link'),
|
||||
icon: mdiCircleEditOutline,
|
||||
onSelect: () => void goto(`${AppRoute.SHARED_LINKS}/${sharedLink.id}`),
|
||||
onAction: () => void goto(`${AppRoute.SHARED_LINKS}/${sharedLink.id}`),
|
||||
};
|
||||
|
||||
const Delete: MenuItem = {
|
||||
const Delete: ActionItem = {
|
||||
title: $t('delete_link'),
|
||||
icon: mdiDelete,
|
||||
color: 'danger',
|
||||
onSelect: () => void handleDeleteSharedLink(sharedLink),
|
||||
onAction: () => void handleDeleteSharedLink(sharedLink),
|
||||
};
|
||||
|
||||
const Copy: MenuItem = {
|
||||
const Copy: ActionItem = {
|
||||
title: $t('copy_link'),
|
||||
icon: mdiContentCopy,
|
||||
onSelect: () => void copyToClipboard(asUrl(sharedLink)),
|
||||
onAction: () => void copyToClipboard(asUrl(sharedLink)),
|
||||
};
|
||||
|
||||
const ViewQrCode: MenuItem = {
|
||||
const ViewQrCode: ActionItem = {
|
||||
title: $t('view_qr_code'),
|
||||
icon: mdiQrcode,
|
||||
onSelect: () => void handleShowSharedLinkQrCode(sharedLink),
|
||||
onAction: () => void handleShowSharedLinkQrCode(sharedLink),
|
||||
};
|
||||
|
||||
const ContextMenu: MenuItem = {
|
||||
title: $t('shared_link_options'),
|
||||
icon: mdiDotsVertical,
|
||||
onSelect: ({ event }) =>
|
||||
void menuManager.show({
|
||||
target: event.currentTarget as HTMLElement,
|
||||
position: 'top-right',
|
||||
items: [Edit, Copy, MenuItemType.Divider, Delete],
|
||||
}),
|
||||
};
|
||||
|
||||
return { Edit, Delete, Copy, ViewQrCode, ContextMenu };
|
||||
return { Edit, Delete, Copy, ViewQrCode };
|
||||
};
|
||||
|
||||
const asUrl = (sharedLink: SharedLinkResponseDto) => {
|
||||
|
||||
Reference in New Issue
Block a user