diff --git a/web/src/lib/components/album-page/albums-table.svelte b/web/src/lib/components/album-page/albums-table.svelte index 467d8d2c56..e77dc93d88 100644 --- a/web/src/lib/components/album-page/albums-table.svelte +++ b/web/src/lib/components/album-page/albums-table.svelte @@ -35,8 +35,6 @@ goto(`${AppRoute.ALBUMS}/${album.id}`)} - on:keydown={(event) => event.key === 'Enter' && goto(`${AppRoute.ALBUMS}/${album.id}`)} - tabindex="0" >
{#each album.assets as asset (asset.id)} - (selectedThumbnail = asset)} selected={isSelected(asset.id)} /> + (selectedThumbnail = asset)} selected={isSelected(asset.id)} /> {/each}
diff --git a/web/src/lib/components/asset-viewer/asset-viewer.svelte b/web/src/lib/components/asset-viewer/asset-viewer.svelte index 2ddd7ada4f..f9d2f787bb 100644 --- a/web/src/lib/components/asset-viewer/asset-viewer.svelte +++ b/web/src/lib/components/asset-viewer/asset-viewer.svelte @@ -646,7 +646,7 @@ ? 'bg-transparent border-2 border-white' : 'bg-gray-700/40'} inline-block hover:bg-transparent" asset={stackedAsset} - on:click={() => { + onClick={() => { asset = stackedAsset; preloadAssets = index + 1 >= $stackAssetsStore.length ? [] : [$stackAssetsStore[index + 1]]; }} diff --git a/web/src/lib/components/assets/thumbnail/thumbnail.svelte b/web/src/lib/components/assets/thumbnail/thumbnail.svelte index 796be13be7..efbe384244 100644 --- a/web/src/lib/components/assets/thumbnail/thumbnail.svelte +++ b/web/src/lib/components/assets/thumbnail/thumbnail.svelte @@ -21,9 +21,9 @@ import { fade } from 'svelte/transition'; import ImageThumbnail from './image-thumbnail.svelte'; import VideoThumbnail from './video-thumbnail.svelte'; + import { shortcut } from '$lib/utils/shortcut'; const dispatch = createEventDispatcher<{ - click: { asset: AssetResponseDto }; select: { asset: AssetResponseDto }; 'mouse-event': { isMouseOver: boolean; selectedGroupIndex: number }; }>(); @@ -40,12 +40,13 @@ export let readonly = false; export let showArchiveIcon = false; export let showStackedIcon = true; - export let intersecting = false; + export let onClick: ((asset: AssetResponseDto) => void) | undefined = undefined; let className = ''; export { className as class }; let mouseOver = false; + $: clickable = !disabled && onClick; $: dispatch('mouse-event', { isMouseOver: mouseOver, selectedGroupIndex: groupIndex }); @@ -62,14 +63,8 @@ })(); const thumbnailClickedHandler = () => { - if (!disabled) { - dispatch('click', { asset }); - } - }; - - const thumbnailKeyDownHandler = (e: KeyboardEvent) => { - if (e.key === 'Enter') { - thumbnailClickedHandler(); + if (clickable) { + onClick?.(asset); } }; @@ -89,20 +84,22 @@ }; - - + +
{#if intersecting}
@@ -140,6 +137,11 @@ class:rounded-xl={selected} /> + +
+ {#if !isSharedLink() && asset.isFavorite}
diff --git a/web/src/lib/components/photos-page/asset-date-group.svelte b/web/src/lib/components/photos-page/asset-date-group.svelte index 6f7af44efa..e3af259843 100644 --- a/web/src/lib/components/photos-page/asset-date-group.svelte +++ b/web/src/lib/components/photos-page/asset-date-group.svelte @@ -178,7 +178,7 @@ {showArchiveIcon} {asset} {groupIndex} - on:click={() => assetClickHandler(asset, groupAssets, groupTitle)} + onClick={() => assetClickHandler(asset, groupAssets, groupTitle)} on:select={() => assetSelectHandler(asset, groupAssets, groupTitle)} on:mouse-event={() => assetMouseEventHandler(groupTitle, asset)} selected={$selectedAssets.has(asset) || $assetStore.albumAssets.has(asset.id)} diff --git a/web/src/lib/components/photos-page/asset-grid.svelte b/web/src/lib/components/photos-page/asset-grid.svelte index cf2619026e..82224babea 100644 --- a/web/src/lib/components/photos-page/asset-grid.svelte +++ b/web/src/lib/components/photos-page/asset-grid.svelte @@ -8,7 +8,7 @@ import { isSearchEnabled } from '$lib/stores/search.store'; import { featureFlags } from '$lib/stores/server-config.store'; import { deleteAssets } from '$lib/utils/actions'; - import { shortcuts, type ShortcutOptions } from '$lib/utils/shortcut'; + import { shortcuts, type ShortcutOptions, matchesShortcut } from '$lib/utils/shortcut'; import { formatGroupTitle, splitBucketIntoDateGroups } from '$lib/utils/timeline-util'; import type { AlbumResponseDto, AssetResponseDto } from '@immich/sdk'; import { DateTime } from 'luxon'; @@ -202,24 +202,24 @@ let shiftKeyIsDown = false; - const onKeyDown = (e: KeyboardEvent) => { + const onKeyDown = (event: KeyboardEvent) => { if ($isSearchEnabled) { return; } - if (e.key == 'Shift') { - e.preventDefault(); + if (matchesShortcut(event, { key: 'Shift' })) { + event.preventDefault(); shiftKeyIsDown = true; } }; - const onKeyUp = (e: KeyboardEvent) => { + const onKeyUp = (event: KeyboardEvent) => { if ($isSearchEnabled) { return; } - if (e.key == 'Shift') { - e.preventDefault(); + if (matchesShortcut(event, { key: 'Shift' })) { + event.preventDefault(); shiftKeyIsDown = false; } }; diff --git a/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte b/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte index 04345c4c55..9219227d0e 100644 --- a/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte +++ b/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte @@ -26,17 +26,14 @@ let currentViewAssetIndex = 0; $: isMultiSelectionMode = selectedAssets.size > 0; - const viewAssetHandler = (event: CustomEvent) => { - const { asset }: { asset: AssetResponseDto } = event.detail; - + const viewAssetHandler = (asset: AssetResponseDto) => { currentViewAssetIndex = assets.findIndex((a) => a.id == asset.id); selectedAsset = assets[currentViewAssetIndex]; $showAssetViewer = true; updateAssetState(selectedAsset.id, false); }; - const selectAssetHandler = (event: CustomEvent) => { - const { asset }: { asset: AssetResponseDto } = event.detail; + const selectAssetHandler = (asset: AssetResponseDto) => { let temporary = new Set(selectedAssets); if (selectedAssets.has(asset)) { @@ -123,8 +120,8 @@ (isMultiSelectionMode ? selectAssetHandler(e) : viewAssetHandler(e))} - on:select={selectAssetHandler} + onClick={(e) => (isMultiSelectionMode ? selectAssetHandler(e) : viewAssetHandler(e))} + on:select={(e) => selectAssetHandler(e.detail.asset)} on:intersected={(event) => i === Math.max(1, assets.length - 7) ? dispatch('intersected', event.detail) : undefined} selected={selectedAssets.has(asset)}