Skip to content

High performance self-hosted photo and video management solution.

refactor(web): tag and create shared link actions (#31892)

Mees Frensel8e3267dc3b29
diff --git a/web/src/lib/components/timeline/actions/CreateSharedLinkAction.svelte b/web/src/lib/components/timeline/actions/CreateSharedLinkAction.svelte
deleted file mode 100644
index 318318c432..0000000000
--- a/web/src/lib/components/timeline/actions/CreateSharedLinkAction.svelte
+++ /dev/null
@@ -1,20 +0,0 @@
-<script lang="ts">
- import { assetMultiSelectManager } from '$lib/managers/asset-multi-select-manager.svelte';
- import SharedLinkCreateModal from '$lib/modals/SharedLinkCreateModal.svelte';
- import { IconButton, modalManager } from '@immich/ui';
- import { mdiShareVariantOutline } from '@mdi/js';
- import { t } from 'svelte-i18n';
-
- const handleClick = async () => {
- await modalManager.show(SharedLinkCreateModal, { assetIds: assetMultiSelectManager.assets.map(({ id }) => id) });
- };
-</script>
-
-<IconButton
- shape="round"
- color="secondary"
- variant="ghost"
- aria-label={$t('share')}
- icon={mdiShareVariantOutline}
- onclick={handleClick}
-/>
diff --git a/web/src/lib/components/timeline/actions/TagAction.svelte b/web/src/lib/components/timeline/actions/TagAction.svelte
deleted file mode 100644
index e70f24b490..0000000000
--- a/web/src/lib/components/timeline/actions/TagAction.svelte
+++ /dev/null
@@ -1,36 +0,0 @@
-<script lang="ts">
- import { shortcut } from '$lib/actions/shortcut';
- import MenuOption from '$lib/components/shared-components/context-menu/MenuOption.svelte';
- import { assetMultiSelectManager } from '$lib/managers/asset-multi-select-manager.svelte';
- import AssetTagModal from '$lib/modals/AssetTagModal.svelte';
- import { IconButton, modalManager } from '@immich/ui';
- import { mdiTagMultipleOutline } from '@mdi/js';
- import { t } from 'svelte-i18n';
-
- interface Props {
- menuItem?: boolean;
- }
-
- let { menuItem = false }: Props = $props();
-
- const text = $t('tag');
- const icon = mdiTagMultipleOutline;
-
- const handleTagAssets = async () => {
- const assets = assetMultiSelectManager.ownedAssets;
- const didUpdate = await modalManager.show(AssetTagModal, { assetIds: assets.map(({ id }) => id) });
- if (didUpdate) {
- assetMultiSelectManager.clear();
- }
- };
-</script>
-
-<svelte:document use:shortcut={{ shortcut: { key: 't' }, onShortcut: handleTagAssets }} />
-
-{#if menuItem}
- <MenuOption {text} {icon} onClick={handleTagAssets} />
-{/if}
-
-{#if !menuItem}
- <IconButton shape="round" color="secondary" variant="ghost" aria-label={text} {icon} onclick={handleTagAssets} />
-{/if}
diff --git a/web/src/lib/modals/AssetTagModal.svelte b/web/src/lib/modals/AssetTagModal.svelte
index 67f855ac52..1a4dd35ad6 100644
--- a/web/src/lib/modals/AssetTagModal.svelte
+++ b/web/src/lib/modals/AssetTagModal.svelte
@@ -1,6 +1,5 @@
<script lang="ts">
- import { eventManager } from '$lib/managers/event-manager.svelte';
- import { tagAssets } from '$lib/utils/asset-utils';
+ import { handleTagAssets } from '$lib/services/asset.service';
import { getAllTags, upsertTags, type TagResponseDto } from '@immich/sdk';
import { FormModal } from '@immich/ui';
import { mdiTag } from '@mdi/js';
@@ -32,9 +31,9 @@
return;
}
- const updatedIds = await tagAssets({ tagIds: [...selectedIds], assetIds, showNotification: false });
- eventManager.emit('AssetsTag', updatedIds);
- onClose(true);
+ if (await handleTagAssets(assetIds, [...selectedIds])) {
+ onClose(true);
+ }
};
const handleSelect = async (option?: ComboBoxOption) => {
diff --git a/web/src/lib/services/asset.service.ts b/web/src/lib/services/asset.service.ts
index fc52b18e24..b53967b23a 100644
--- a/web/src/lib/services/asset.service.ts
+++ b/web/src/lib/services/asset.service.ts
@@ -3,6 +3,7 @@ import {
AssetMediaSize,
AssetTypeEnum,
AssetVisibility,
+ bulkTagAssets,
getAssetInfo,
removeAssetFromAlbum,
runAssetJobs,
@@ -36,6 +37,7 @@ import {
mdiPlus,
mdiPresentationPlay,
mdiShareVariantOutline,
+ mdiTagMultipleOutline,
mdiTagPlusOutline,
mdiTune,
} from '@mdi/js';
@@ -59,6 +61,7 @@ import { handleError } from '$lib/utils/handle-error';
import { getFormatter } from '$lib/utils/i18n';
export const getAssetBulkActions = ($t: MessageFormatter, album?: AlbumResponseDto) => {
+ const assetIds = assetMultiSelectManager.assets.map((asset) => asset.id);
const ownedAssets = assetMultiSelectManager.ownedAssets;
const isAlbumOwner = album?.albumUsers[0].user.id === authManager.user.id;
@@ -71,19 +74,32 @@ export const getAssetBulkActions = ($t: MessageFormatter, album?: AlbumResponseD
title: $t('add_to_album'),
icon: mdiPlus,
shortcuts: [{ key: 'l' }],
- onAction: () =>
- modalManager.show(AssetAddToAlbumModal, { assetIds: assetMultiSelectManager.assets.map((asset) => asset.id) }),
+ onAction: () => modalManager.show(AssetAddToAlbumModal, { assetIds }),
+ };
+
+ const CreateSharedLink: ActionItem = {
+ title: $t('share'),
+ icon: mdiShareVariantOutline,
+ onAction: () => modalManager.show(SharedLinkCreateModal, { assetIds }),
};
const RemoveFromAlbum: ActionItem = {
title: $t('remove_from_album'),
icon: mdiImageRemoveOutline,
$if: () => !!album && (isAlbumOwner || assetMultiSelectManager.isAllUserOwned),
- onAction: () =>
- handleBulkRemoveAssetsFromAlbum(
- assetMultiSelectManager.assets.map((asset) => asset.id),
- album!,
- ),
+ onAction: () => handleBulkRemoveAssetsFromAlbum(assetIds, album!),
+ };
+
+ const Tag: ActionItem = {
+ title: $t('tag'),
+ icon: mdiTagMultipleOutline,
+ $if: () => authManager.preferences.tags.enabled && assetMultiSelectManager.isAllUserOwned,
+ onAction: async () => {
+ if (await modalManager.show(AssetTagModal, { assetIds })) {
+ assetMultiSelectManager.clear();
+ }
+ },
+ shortcuts: { key: 't' },
};
const RefreshFacesJob: ActionItem = {
@@ -113,7 +129,9 @@ export const getAssetBulkActions = ($t: MessageFormatter, album?: AlbumResponseD
return {
AddToAlbum,
+ CreateSharedLink,
RemoveFromAlbum,
+ Tag,
RefreshFacesJob,
RefreshMetadataJob,
RegenerateThumbnailJob,
@@ -465,6 +483,20 @@ const handleRate = async (asset: AssetResponseDto, rating: number) => {
}
};
+export const handleTagAssets = async (assetIds: string[], tagIds: string[]) => {
+ const $t = await getFormatter();
+
+ try {
+ const response = await bulkTagAssets({ tagBulkAssetsDto: { assetIds, tagIds } });
+ toastManager.primary($t('tagged_assets', { values: { count: response.count } }));
+ eventManager.emit('AssetsTag', assetIds);
+ return true;
+ } catch (error) {
+ handleError(error, $t('errors.failed_to_tag_assets'));
+ return false;
+ }
+};
+
const handleBulkRemoveAssetsFromAlbum = async (assetIds: string[], album: AlbumResponseDto) => {
const $t = await getFormatter();
diff --git a/web/src/lib/utils/asset-utils.ts b/web/src/lib/utils/asset-utils.ts
index d29527fb2a..f4a4c6789a 100644
--- a/web/src/lib/utils/asset-utils.ts
+++ b/web/src/lib/utils/asset-utils.ts
@@ -1,6 +1,5 @@
import {
AssetVisibility,
- bulkTagAssets,
getBaseUrl,
getDownloadInfo,
untagAssets,
@@ -31,25 +30,6 @@ import { asQueryString } from '$lib/utils/shared-links';
import { toTimelineAsset } from '$lib/utils/timeline-util';
import { handleError } from './handle-error';
-export const tagAssets = async ({
- assetIds,
- tagIds,
- showNotification = true,
-}: {
- assetIds: string[];
- tagIds: string[];
- showNotification?: boolean;
-}) => {
- await bulkTagAssets({ tagBulkAssetsDto: { tagIds, assetIds } });
-
- if (showNotification) {
- const $t = await getFormatter();
- toastManager.primary($t('tagged_assets', { values: { count: assetIds.length } }));
- }
-
- return assetIds;
-};
-
export const removeTag = async ({
assetIds,
tagIds,
diff --git a/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte
index c2a0336c5a..220e9f98cf 100644
--- a/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte
+++ b/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte
@@ -16,13 +16,11 @@
import ChangeDate from '$lib/components/timeline/actions/ChangeDateAction.svelte';
import ChangeDescription from '$lib/components/timeline/actions/ChangeDescriptionAction.svelte';
import ChangeLocation from '$lib/components/timeline/actions/ChangeLocationAction.svelte';
- import CreateSharedLink from '$lib/components/timeline/actions/CreateSharedLinkAction.svelte';
import DeleteAssets from '$lib/components/timeline/actions/DeleteAssetsAction.svelte';
import DownloadAction from '$lib/components/timeline/actions/DownloadAction.svelte';
import FavoriteAction from '$lib/components/timeline/actions/FavoriteAction.svelte';
import SelectAllAssets from '$lib/components/timeline/actions/SelectAllAction.svelte';
import SetVisibilityAction from '$lib/components/timeline/actions/SetVisibilityAction.svelte';
- import TagAction from '$lib/components/timeline/actions/TagAction.svelte';
import AssetSelectControlBar from '$lib/components/timeline/AssetSelectControlBar.svelte';
import Timeline from '$lib/components/timeline/Timeline.svelte';
import { AlbumPageViewMode } from '$lib/constants';
@@ -453,7 +451,7 @@
<AssetSelectControlBar>
{@const Actions = getAssetBulkActions($t, album)}
<CommandPaletteDefaultProvider name={$t('assets')} actions={Object.values(Actions)} />
- <CreateSharedLink />
+ <ActionButton action={Actions.CreateSharedLink} />
<SelectAllAssets {timelineManager} assetInteraction={assetMultiSelectManager} />
<ActionButton action={Actions.AddToAlbum} />
{#if assetMultiSelectManager.isAllUserOwned}
@@ -483,10 +481,7 @@
/>
{/if}
- {#if authManager.preferences.tags.enabled && assetMultiSelectManager.isAllUserOwned}
- <TagAction menuItem />
- {/if}
-
+ <ActionMenuItem action={Actions.Tag} />
<ActionMenuItem action={Actions.RemoveFromAlbum} />
{#if assetMultiSelectManager.isAllUserOwned}
<DeleteAssets menuItem onAssetDelete={handleRemoveAssets} onUndoDelete={handleUndoRemoveAssets} />
diff --git a/web/src/routes/(user)/archive/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/archive/[[photos=photos]]/[[assetId=id]]/+page.svelte
index dd4e776d33..c6946b7673 100644
--- a/web/src/routes/(user)/archive/[[photos=photos]]/[[assetId=id]]/+page.svelte
+++ b/web/src/routes/(user)/archive/[[photos=photos]]/[[assetId=id]]/+page.svelte
@@ -3,7 +3,6 @@
import ButtonContextMenu from '$lib/components/shared-components/context-menu/ButtonContextMenu.svelte';
import EmptyPlaceholder from '$lib/components/shared-components/EmptyPlaceholder.svelte';
import ArchiveAction from '$lib/components/timeline/actions/ArchiveAction.svelte';
- import CreateSharedLink from '$lib/components/timeline/actions/CreateSharedLinkAction.svelte';
import DeleteAssets from '$lib/components/timeline/actions/DeleteAssetsAction.svelte';
import DownloadAction from '$lib/components/timeline/actions/DownloadAction.svelte';
import FavoriteAction from '$lib/components/timeline/actions/FavoriteAction.svelte';
@@ -68,7 +67,7 @@
unarchive
onArchive={(ids, visibility) => timelineManager.update(ids, (asset) => (asset.visibility = visibility))}
/>
- <CreateSharedLink />
+ <ActionButton action={Actions.CreateSharedLink} />
<SelectAllAssets {timelineManager} assetInteraction={assetMultiSelectManager} />
<ActionButton action={Actions.AddToAlbum} />
<FavoriteAction
diff --git a/web/src/routes/(user)/favorites/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/favorites/[[photos=photos]]/[[assetId=id]]/+page.svelte
index 597a1e43e1..8e36e76eb4 100644
--- a/web/src/routes/(user)/favorites/[[photos=photos]]/[[assetId=id]]/+page.svelte
+++ b/web/src/routes/(user)/favorites/[[photos=photos]]/[[assetId=id]]/+page.svelte
@@ -1,4 +1,5 @@
<script lang="ts">
+ import ActionMenuItem from '$lib/components/ActionMenuItem.svelte';
import UserPageLayout from '$lib/components/layouts/UserPageLayout.svelte';
import ButtonContextMenu from '$lib/components/shared-components/context-menu/ButtonContextMenu.svelte';
import EmptyPlaceholder from '$lib/components/shared-components/EmptyPlaceholder.svelte';
@@ -6,17 +7,14 @@
import ChangeDate from '$lib/components/timeline/actions/ChangeDateAction.svelte';
import ChangeDescription from '$lib/components/timeline/actions/ChangeDescriptionAction.svelte';
import ChangeLocation from '$lib/components/timeline/actions/ChangeLocationAction.svelte';
- import CreateSharedLink from '$lib/components/timeline/actions/CreateSharedLinkAction.svelte';
import DeleteAssets from '$lib/components/timeline/actions/DeleteAssetsAction.svelte';
import DownloadAction from '$lib/components/timeline/actions/DownloadAction.svelte';
import FavoriteAction from '$lib/components/timeline/actions/FavoriteAction.svelte';
import SelectAllAssets from '$lib/components/timeline/actions/SelectAllAction.svelte';
import SetVisibilityAction from '$lib/components/timeline/actions/SetVisibilityAction.svelte';
- import TagAction from '$lib/components/timeline/actions/TagAction.svelte';
import AssetSelectControlBar from '$lib/components/timeline/AssetSelectControlBar.svelte';
import Timeline from '$lib/components/timeline/Timeline.svelte';
import { assetMultiSelectManager } from '$lib/managers/asset-multi-select-manager.svelte';
- import { authManager } from '$lib/managers/auth-manager.svelte';
import { TimelineManager } from '$lib/managers/timeline-manager/timeline-manager.svelte';
import { getAssetBulkActions } from '$lib/services/asset.service';
import { ActionButton, CommandPaletteDefaultProvider } from '@immich/ui';
@@ -69,7 +67,7 @@
{@const Actions = getAssetBulkActions($t)}
<CommandPaletteDefaultProvider name={$t('assets')} actions={Object.values(Actions)} />
<FavoriteAction removeFavorite onFavorite={(assetIds) => timelineManager.removeAssets(assetIds)} />
- <CreateSharedLink />
+ <ActionButton action={Actions.CreateSharedLink} />
<SelectAllAssets {timelineManager} assetInteraction={assetMultiSelectManager} />
<ActionButton action={Actions.AddToAlbum} />
<ButtonContextMenu icon={mdiDotsVertical} title={$t('menu')}>
@@ -82,9 +80,7 @@
unarchive={assetMultiSelectManager.isAllArchived}
onArchive={(ids, visibility) => timelineManager.update(ids, (asset) => (asset.visibility = visibility))}
/>
- {#if authManager.preferences.tags.enabled}
- <TagAction menuItem />
- {/if}
+ <ActionMenuItem action={Actions.Tag} />
<SetVisibilityAction menuItem onVisibilitySet={handleSetVisibility} />
<DeleteAssets
menuItem
diff --git a/web/src/routes/(user)/folders/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/folders/[[photos=photos]]/[[assetId=id]]/+page.svelte
index b6744e98e9..7b82b5f34c 100644
--- a/web/src/routes/(user)/folders/[[photos=photos]]/[[assetId=id]]/+page.svelte
+++ b/web/src/routes/(user)/folders/[[photos=photos]]/[[assetId=id]]/+page.svelte
@@ -14,16 +14,13 @@
import ChangeDate from '$lib/components/timeline/actions/ChangeDateAction.svelte';
import ChangeDescription from '$lib/components/timeline/actions/ChangeDescriptionAction.svelte';
import ChangeLocation from '$lib/components/timeline/actions/ChangeLocationAction.svelte';
- import CreateSharedLink from '$lib/components/timeline/actions/CreateSharedLinkAction.svelte';
import DeleteAssets from '$lib/components/timeline/actions/DeleteAssetsAction.svelte';
import DownloadAction from '$lib/components/timeline/actions/DownloadAction.svelte';
import FavoriteAction from '$lib/components/timeline/actions/FavoriteAction.svelte';
import SetVisibilityAction from '$lib/components/timeline/actions/SetVisibilityAction.svelte';
- import TagAction from '$lib/components/timeline/actions/TagAction.svelte';
import AssetSelectControlBar from '$lib/components/timeline/AssetSelectControlBar.svelte';
import SkipLink from '$lib/elements/SkipLink.svelte';
import { assetMultiSelectManager } from '$lib/managers/asset-multi-select-manager.svelte';
- import { authManager } from '$lib/managers/auth-manager.svelte';
import type { Viewport } from '$lib/managers/timeline-manager/types';
import { Route } from '$lib/route';
import { getAssetBulkActions } from '$lib/services/asset.service';
@@ -134,7 +131,7 @@
<AssetSelectControlBar>
{@const Actions = getAssetBulkActions($t)}
<CommandPaletteDefaultProvider name={$t('assets')} actions={Object.values(Actions)} />
- <CreateSharedLink />
+ <ActionButton action={Actions.CreateSharedLink} />
<IconButton
shape="round"
color="secondary"
@@ -165,9 +162,7 @@
<ChangeLocation menuItem />
<ArchiveAction menuItem unarchive={assetMultiSelectManager.isAllArchived} onArchive={triggerAssetUpdate} />
<SetVisibilityAction menuItem onVisibilitySet={handleSetVisibility} />
- {#if authManager.preferences.tags.enabled && assetMultiSelectManager.isAllUserOwned}
- <TagAction menuItem />
- {/if}
+ <ActionMenuItem action={Actions.Tag} />
<DeleteAssets menuItem onAssetDelete={triggerAssetUpdate} onUndoDelete={triggerAssetUpdate} />
<hr />
diff --git a/web/src/routes/(user)/map/[[photos=photos]]/[[assetId=id]]/MapTimelinePanel.svelte b/web/src/routes/(user)/map/[[photos=photos]]/[[assetId=id]]/MapTimelinePanel.svelte
index 6b3760d8a4..aab23b1b19 100644
--- a/web/src/routes/(user)/map/[[photos=photos]]/[[assetId=id]]/MapTimelinePanel.svelte
+++ b/web/src/routes/(user)/map/[[photos=photos]]/[[assetId=id]]/MapTimelinePanel.svelte
@@ -6,19 +6,16 @@
import ChangeDate from '$lib/components/timeline/actions/ChangeDateAction.svelte';
import ChangeDescription from '$lib/components/timeline/actions/ChangeDescriptionAction.svelte';
import ChangeLocation from '$lib/components/timeline/actions/ChangeLocationAction.svelte';
- import CreateSharedLink from '$lib/components/timeline/actions/CreateSharedLinkAction.svelte';
import DeleteAssets from '$lib/components/timeline/actions/DeleteAssetsAction.svelte';
import DownloadAction from '$lib/components/timeline/actions/DownloadAction.svelte';
import FavoriteAction from '$lib/components/timeline/actions/FavoriteAction.svelte';
import LinkLivePhotoAction from '$lib/components/timeline/actions/LinkLivePhotoAction.svelte';
import SelectAllAssets from '$lib/components/timeline/actions/SelectAllAction.svelte';
import SetVisibilityAction from '$lib/components/timeline/actions/SetVisibilityAction.svelte';
- import TagAction from '$lib/components/timeline/actions/TagAction.svelte';
import AssetSelectControlBar from '$lib/components/timeline/AssetSelectControlBar.svelte';
import Timeline from '$lib/components/timeline/Timeline.svelte';
import Portal from '$lib/elements/Portal.svelte';
import { assetMultiSelectManager } from '$lib/managers/asset-multi-select-manager.svelte';
- import { authManager } from '$lib/managers/auth-manager.svelte';
import { TimelineManager } from '$lib/managers/timeline-manager/timeline-manager.svelte';
import { getAssetBulkActions } from '$lib/services/asset.service';
import { getStackBulkActions } from '$lib/services/stack.service';
@@ -124,7 +121,7 @@
<Portal target="body">
<AssetSelectControlBar>
- <CreateSharedLink />
+ <ActionButton action={Actions.CreateSharedLink} />
<SelectAllAssets {timelineManager} assetInteraction={assetMultiSelectManager} />
<ActionButton action={Actions.AddToAlbum} />
@@ -154,9 +151,7 @@
unarchive={assetMultiSelectManager.isAllArchived}
onArchive={(ids, visibility) => timelineManager.update(ids, (asset) => (asset.visibility = visibility))}
/>
- {#if authManager.preferences.tags.enabled}
- <TagAction menuItem />
- {/if}
+ <ActionMenuItem action={Actions.Tag} />
<DeleteAssets
menuItem
onAssetDelete={(assetIds) => timelineManager.removeAssets(assetIds)}
diff --git a/web/src/routes/(user)/memories/[id]/[[photos=photos]]/[[assetId=id]]/MemoryViewer.svelte b/web/src/routes/(user)/memories/[id]/[[photos=photos]]/[[assetId=id]]/MemoryViewer.svelte
index 3a5968ca08..2e981db261 100644
--- a/web/src/routes/(user)/memories/[id]/[[photos=photos]]/[[assetId=id]]/MemoryViewer.svelte
+++ b/web/src/routes/(user)/memories/[id]/[[photos=photos]]/[[assetId=id]]/MemoryViewer.svelte
@@ -2,6 +2,7 @@
import { goto } from '$app/navigation';
import { scrollMemoryClearer } from '$lib/actions/scroll-memory';
import { shortcuts } from '$lib/actions/shortcut';
+ import ActionMenuItem from '$lib/components/ActionMenuItem.svelte';
import BirthdayConfetti from '$lib/components/memories/BirthdayConfetti.svelte';
import ButtonContextMenu from '$lib/components/shared-components/context-menu/ButtonContextMenu.svelte';
import MenuOption from '$lib/components/shared-components/context-menu/MenuOption.svelte';
@@ -10,11 +11,9 @@
import ChangeDate from '$lib/components/timeline/actions/ChangeDateAction.svelte';
import ChangeDescription from '$lib/components/timeline/actions/ChangeDescriptionAction.svelte';
import ChangeLocation from '$lib/components/timeline/actions/ChangeLocationAction.svelte';
- import CreateSharedLink from '$lib/components/timeline/actions/CreateSharedLinkAction.svelte';
import DeleteAssets from '$lib/components/timeline/actions/DeleteAssetsAction.svelte';
import DownloadAction from '$lib/components/timeline/actions/DownloadAction.svelte';
import FavoriteAction from '$lib/components/timeline/actions/FavoriteAction.svelte';
- import TagAction from '$lib/components/timeline/actions/TagAction.svelte';
import AssetSelectControlBar from '$lib/components/timeline/AssetSelectControlBar.svelte';
import { assetMultiSelectManager } from '$lib/managers/asset-multi-select-manager.svelte';
import { assetViewerManager } from '$lib/managers/asset-viewer-manager.svelte';
@@ -27,7 +26,7 @@
import { getAssetMediaUrl, handlePromiseError, memoryLaneTitle } from '$lib/utils';
import { fromISODateTimeUTC, toTimelineAsset } from '$lib/utils/timeline-util';
import { AssetMediaSize, AssetTypeEnum, getAssetInfo, MemoryType } from '@immich/sdk';
- import { ActionButton, Icon, IconButton, Text } from '@immich/ui';
+ import { ActionButton, CommandPaletteDefaultProvider, Icon, IconButton, Text } from '@immich/ui';
import {
mdiCakeVariant,
mdiCardsOutline,
@@ -279,7 +278,9 @@
<div class="dark sticky top-0 z-1">
<AssetSelectControlBar>
{@const Actions = getAssetBulkActions($t)}
- <CreateSharedLink />
+ <CommandPaletteDefaultProvider name={$t('assets')} actions={Object.values(Actions)} />
+
+ <ActionButton action={Actions.CreateSharedLink} />
<IconButton
shape="round"
color="secondary"
@@ -299,9 +300,7 @@
<ChangeDescription menuItem />
<ChangeLocation menuItem />
<ArchiveAction menuItem unarchive={assetMultiSelectManager.isAllArchived} onArchive={handleHideAssets} />
- {#if authManager.preferences.tags.enabled && assetMultiSelectManager.isAllUserOwned}
- <TagAction menuItem />
- {/if}
+ <ActionMenuItem action={Actions.Tag} />
<DeleteAssets menuItem onAssetDelete={handleHideAssets} />
</ButtonContextMenu>
</AssetSelectControlBar>
diff --git a/web/src/routes/(user)/partners/[userId]/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/partners/[userId]/[[photos=photos]]/[[assetId=id]]/+page.svelte
index 7b1c4d97a7..b21373afa0 100644
--- a/web/src/routes/(user)/partners/[userId]/[[photos=photos]]/[[assetId=id]]/+page.svelte
+++ b/web/src/routes/(user)/partners/[userId]/[[photos=photos]]/[[assetId=id]]/+page.svelte
@@ -1,7 +1,6 @@
<script lang="ts">
import { goto } from '$app/navigation';
import ControlAppBar from '$lib/components/shared-components/ControlAppBar.svelte';
- import CreateSharedLink from '$lib/components/timeline/actions/CreateSharedLinkAction.svelte';
import DownloadAction from '$lib/components/timeline/actions/DownloadAction.svelte';
import AssetSelectControlBar from '$lib/components/timeline/AssetSelectControlBar.svelte';
import Timeline from '$lib/components/timeline/Timeline.svelte';
@@ -44,7 +43,8 @@
<AssetSelectControlBar>
{@const Actions = getAssetBulkActions($t)}
<CommandPaletteDefaultProvider name={$t('assets')} actions={Object.values(Actions)} />
- <CreateSharedLink />
+
+ <ActionButton action={Actions.CreateSharedLink} />
<ActionButton action={Actions.AddToAlbum} />
<DownloadAction />
</AssetSelectControlBar>
diff --git a/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.svelte
index dbe0fdf1e6..2ca5bab81e 100644
--- a/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.svelte
+++ b/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.svelte
@@ -4,6 +4,7 @@
import { clickOutside } from '$lib/actions/click-outside';
import { listNavigation } from '$lib/actions/list-navigation';
import { scrollMemoryClearer } from '$lib/actions/scroll-memory';
+ import ActionMenuItem from '$lib/components/ActionMenuItem.svelte';
import ImageThumbnail from '$lib/components/assets/thumbnail/ImageThumbnail.svelte';
import OnEvents from '$lib/components/OnEvents.svelte';
import ButtonContextMenu from '$lib/components/shared-components/context-menu/ButtonContextMenu.svelte';
@@ -13,18 +14,15 @@
import ChangeDate from '$lib/components/timeline/actions/ChangeDateAction.svelte';
import ChangeDescription from '$lib/components/timeline/actions/ChangeDescriptionAction.svelte';
import ChangeLocation from '$lib/components/timeline/actions/ChangeLocationAction.svelte';
- import CreateSharedLink from '$lib/components/timeline/actions/CreateSharedLinkAction.svelte';
import DeleteAssets from '$lib/components/timeline/actions/DeleteAssetsAction.svelte';
import DownloadAction from '$lib/components/timeline/actions/DownloadAction.svelte';
import FavoriteAction from '$lib/components/timeline/actions/FavoriteAction.svelte';
import SelectAllAssets from '$lib/components/timeline/actions/SelectAllAction.svelte';
import SetVisibilityAction from '$lib/components/timeline/actions/SetVisibilityAction.svelte';
- import TagAction from '$lib/components/timeline/actions/TagAction.svelte';
import AssetSelectControlBar from '$lib/components/timeline/AssetSelectControlBar.svelte';
import Timeline from '$lib/components/timeline/Timeline.svelte';
import { PersonPageViewMode, QueryParameter, SessionStorageKey } from '$lib/constants';
import { assetMultiSelectManager } from '$lib/managers/asset-multi-select-manager.svelte';
- import { authManager } from '$lib/managers/auth-manager.svelte';
import { TimelineManager } from '$lib/managers/timeline-manager/timeline-manager.svelte';
import type { TimelineAsset } from '$lib/managers/timeline-manager/types';
import PersonEditModal from '$lib/modals/PersonEditModal.svelte';
@@ -478,7 +476,7 @@
<AssetSelectControlBar>
{@const Actions = getAssetBulkActions($t)}
<CommandPaletteDefaultProvider name={$t('assets')} actions={Object.values(Actions)} />
- <CreateSharedLink />
+ <ActionButton action={Actions.CreateSharedLink} />
<SelectAllAssets {timelineManager} assetInteraction={assetMultiSelectManager} />
<ActionButton action={Actions.AddToAlbum} />
<FavoriteAction
@@ -503,9 +501,7 @@
asset.visibility = visibility;
})}
/>
- {#if authManager.preferences.tags.enabled && assetMultiSelectManager.isAllUserOwned}
- <TagAction menuItem />
- {/if}
+ <ActionMenuItem action={Actions.Tag} />
<SetVisibilityAction menuItem onVisibilitySet={handleSetVisibility} />
<DeleteAssets
menuItem
diff --git a/web/src/routes/(user)/photos/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/photos/[[assetId=id]]/+page.svelte
index f28918bbe5..ec895aaf74 100644
--- a/web/src/routes/(user)/photos/[[assetId=id]]/+page.svelte
+++ b/web/src/routes/(user)/photos/[[assetId=id]]/+page.svelte
@@ -7,14 +7,12 @@
import ChangeDate from '$lib/components/timeline/actions/ChangeDateAction.svelte';
import ChangeDescription from '$lib/components/timeline/actions/ChangeDescriptionAction.svelte';
import ChangeLocation from '$lib/components/timeline/actions/ChangeLocationAction.svelte';
- import CreateSharedLink from '$lib/components/timeline/actions/CreateSharedLinkAction.svelte';
import DeleteAssets from '$lib/components/timeline/actions/DeleteAssetsAction.svelte';
import DownloadAction from '$lib/components/timeline/actions/DownloadAction.svelte';
import FavoriteAction from '$lib/components/timeline/actions/FavoriteAction.svelte';
import LinkLivePhotoAction from '$lib/components/timeline/actions/LinkLivePhotoAction.svelte';
import SelectAllAssets from '$lib/components/timeline/actions/SelectAllAction.svelte';
import SetVisibilityAction from '$lib/components/timeline/actions/SetVisibilityAction.svelte';
- import TagAction from '$lib/components/timeline/actions/TagAction.svelte';
import AssetSelectControlBar from '$lib/components/timeline/AssetSelectControlBar.svelte';
import Timeline from '$lib/components/timeline/Timeline.svelte';
import { AssetAction } from '$lib/constants';
@@ -120,7 +118,7 @@
{@const StackActions = getStackBulkActions($t)}
<CommandPaletteDefaultProvider name={$t('assets')} actions={Object.values(Actions)} />
- <CreateSharedLink />
+ <ActionButton action={Actions.CreateSharedLink} />
<SelectAllAssets {timelineManager} assetInteraction={assetMultiSelectManager} />
<ActionButton action={Actions.AddToAlbum} />
@@ -149,9 +147,7 @@
menuItem
onArchive={(ids, visibility) => timelineManager.update(ids, (asset) => (asset.visibility = visibility))}
/>
- {#if authManager.preferences.tags.enabled}
- <TagAction menuItem />
- {/if}
+ <ActionMenuItem action={Actions.Tag} />
<DeleteAssets
menuItem
onAssetDelete={(assetIds) => timelineManager.removeAssets(assetIds)}
diff --git a/web/src/routes/(user)/recently-added/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/recently-added/[[photos=photos]]/[[assetId=id]]/+page.svelte
index feacbce9b3..24a8ffa588 100644
--- a/web/src/routes/(user)/recently-added/[[photos=photos]]/[[assetId=id]]/+page.svelte
+++ b/web/src/routes/(user)/recently-added/[[photos=photos]]/[[assetId=id]]/+page.svelte
@@ -7,20 +7,17 @@
import ChangeDate from '$lib/components/timeline/actions/ChangeDateAction.svelte';
import ChangeDescription from '$lib/components/timeline/actions/ChangeDescriptionAction.svelte';
import ChangeLocation from '$lib/components/timeline/actions/ChangeLocationAction.svelte';
- import CreateSharedLink from '$lib/components/timeline/actions/CreateSharedLinkAction.svelte';
import DeleteAssets from '$lib/components/timeline/actions/DeleteAssetsAction.svelte';
import DownloadAction from '$lib/components/timeline/actions/DownloadAction.svelte';
import FavoriteAction from '$lib/components/timeline/actions/FavoriteAction.svelte';
import LinkLivePhotoAction from '$lib/components/timeline/actions/LinkLivePhotoAction.svelte';
import SelectAllAssets from '$lib/components/timeline/actions/SelectAllAction.svelte';
import SetVisibilityAction from '$lib/components/timeline/actions/SetVisibilityAction.svelte';
- import TagAction from '$lib/components/timeline/actions/TagAction.svelte';
import AssetSelectControlBar from '$lib/components/timeline/AssetSelectControlBar.svelte';
import Timeline from '$lib/components/timeline/Timeline.svelte';
import { AssetAction } from '$lib/constants';
import { assetMultiSelectManager } from '$lib/managers/asset-multi-select-manager.svelte';
import { assetViewerManager } from '$lib/managers/asset-viewer-manager.svelte';
- import { authManager } from '$lib/managers/auth-manager.svelte';
import { TimelineManager } from '$lib/managers/timeline-manager/timeline-manager.svelte';
import { getAssetBulkActions } from '$lib/services/asset.service';
import { type OnLink, type OnUnlink } from '$lib/utils/actions';
@@ -105,7 +102,7 @@
{@const StackActions = getStackBulkActions($t)}
<CommandPaletteDefaultProvider name={$t('assets')} actions={Object.values(Actions)} />
- <CreateSharedLink />
+ <ActionButton action={Actions.CreateSharedLink} />
<SelectAllAssets {timelineManager} assetInteraction={assetMultiSelectManager} />
<ActionButton action={Actions.AddToAlbum} />
@@ -134,9 +131,7 @@
menuItem
onArchive={(ids, visibility) => timelineManager.update(ids, (asset) => (asset.visibility = visibility))}
/>
- {#if authManager.preferences.tags.enabled}
- <TagAction menuItem />
- {/if}
+ <ActionMenuItem action={Actions.Tag} />
<DeleteAssets
menuItem
onAssetDelete={(assetIds) => timelineManager.removeAssets(assetIds)}
diff --git a/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte
index 649527af9b..b4c6921826 100644
--- a/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte
+++ b/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte
@@ -11,16 +11,13 @@
import ChangeDate from '$lib/components/timeline/actions/ChangeDateAction.svelte';
import ChangeDescription from '$lib/components/timeline/actions/ChangeDescriptionAction.svelte';
import ChangeLocation from '$lib/components/timeline/actions/ChangeLocationAction.svelte';
- import CreateSharedLink from '$lib/components/timeline/actions/CreateSharedLinkAction.svelte';
import DeleteAssets from '$lib/components/timeline/actions/DeleteAssetsAction.svelte';
import DownloadAction from '$lib/components/timeline/actions/DownloadAction.svelte';
import FavoriteAction from '$lib/components/timeline/actions/FavoriteAction.svelte';
import SetVisibilityAction from '$lib/components/timeline/actions/SetVisibilityAction.svelte';
- import TagAction from '$lib/components/timeline/actions/TagAction.svelte';
import AssetSelectControlBar from '$lib/components/timeline/AssetSelectControlBar.svelte';
import { QueryParameter } from '$lib/constants';
import { assetMultiSelectManager } from '$lib/managers/asset-multi-select-manager.svelte';
- import { authManager } from '$lib/managers/auth-manager.svelte';
import { featureFlagsManager } from '$lib/managers/feature-flags-manager.svelte';
import { searchManager } from '$lib/managers/search-manager.svelte';
import type { Viewport } from '$lib/managers/timeline-manager/types';
@@ -347,7 +344,7 @@
{@const Actions = getAssetBulkActions($t)}
<CommandPaletteDefaultProvider name={$t('assets')} actions={Object.values(Actions)} />
- <CreateSharedLink />
+ <ActionButton action={Actions.CreateSharedLink} />
<IconButton
shape="round"
color="secondary"
@@ -378,9 +375,7 @@
<ChangeLocation menuItem />
<ArchiveAction menuItem unarchive={assetMultiSelectManager.isAllArchived} />
<SetVisibilityAction menuItem onVisibilitySet={handleSetVisibility} />
- {#if authManager.preferences.tags.enabled}
- <TagAction menuItem />
- {/if}
+ <ActionMenuItem action={Actions.Tag} />
<DeleteAssets menuItem {onAssetDelete} onUndoDelete={onSearchQueryUpdate} />
<hr />
<ActionMenuItem action={Actions.RegenerateThumbnailJob} />
diff --git a/web/src/routes/(user)/tags/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/tags/[[photos=photos]]/[[assetId=id]]/+page.svelte
index 59df0bf035..5578a372cd 100644
--- a/web/src/routes/(user)/tags/[[photos=photos]]/[[assetId=id]]/+page.svelte
+++ b/web/src/routes/(user)/tags/[[photos=photos]]/[[assetId=id]]/+page.svelte
@@ -1,5 +1,6 @@
<script lang="ts">
import { goto } from '$app/navigation';
+ import ActionMenuItem from '$lib/components/ActionMenuItem.svelte';
import OnEvents from '$lib/components/OnEvents.svelte';
import UserPageLayout, { headerId } from '$lib/components/layouts/UserPageLayout.svelte';
import ButtonContextMenu from '$lib/components/shared-components/context-menu/ButtonContextMenu.svelte';
@@ -13,17 +14,14 @@
import ChangeDate from '$lib/components/timeline/actions/ChangeDateAction.svelte';
import ChangeDescription from '$lib/components/timeline/actions/ChangeDescriptionAction.svelte';
import ChangeLocation from '$lib/components/timeline/actions/ChangeLocationAction.svelte';
- import CreateSharedLink from '$lib/components/timeline/actions/CreateSharedLinkAction.svelte';
import DeleteAssets from '$lib/components/timeline/actions/DeleteAssetsAction.svelte';
import DownloadAction from '$lib/components/timeline/actions/DownloadAction.svelte';
import FavoriteAction from '$lib/components/timeline/actions/FavoriteAction.svelte';
import SelectAllAssets from '$lib/components/timeline/actions/SelectAllAction.svelte';
import SetVisibilityAction from '$lib/components/timeline/actions/SetVisibilityAction.svelte';
- import TagAction from '$lib/components/timeline/actions/TagAction.svelte';
import { AssetAction } from '$lib/constants';
import SkipLink from '$lib/elements/SkipLink.svelte';
import { assetMultiSelectManager } from '$lib/managers/asset-multi-select-manager.svelte';
- import { authManager } from '$lib/managers/auth-manager.svelte';
import { TimelineManager } from '$lib/managers/timeline-manager/timeline-manager.svelte';
import { Route } from '$lib/route';
import { getAssetBulkActions } from '$lib/services/asset.service';
@@ -124,7 +122,7 @@
<AssetSelectControlBar>
{@const Actions = getAssetBulkActions($t)}
<CommandPaletteDefaultProvider name={$t('assets')} actions={Object.values(Actions)} />
- <CreateSharedLink />
+ <ActionButton action={Actions.CreateSharedLink} />
<SelectAllAssets {timelineManager} assetInteraction={assetMultiSelectManager} />
<ActionButton action={Actions.AddToAlbum} />
<FavoriteAction
@@ -140,9 +138,7 @@
menuItem
onArchive={(ids, visibility) => timelineManager.update(ids, (asset) => (asset.visibility = visibility))}
/>
- {#if authManager.preferences.tags.enabled}
- <TagAction menuItem />
- {/if}
+ <ActionMenuItem action={Actions.Tag} />
<DeleteAssets
menuItem
onAssetDelete={(assetIds) => timelineManager.removeAssets(assetIds)}