mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
feat: add preview button when selecting images (#27305)
* Add preview button when selecting images * Fix test helper * prettier * styling --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
@@ -62,7 +62,7 @@ export const thumbnailUtils = {
|
|||||||
return page.locator(`[data-thumbnail-focus-container][data-asset="${assetId}"]`);
|
return page.locator(`[data-thumbnail-focus-container][data-asset="${assetId}"]`);
|
||||||
},
|
},
|
||||||
selectButton(page: Page, assetId: string) {
|
selectButton(page: Page, assetId: string) {
|
||||||
return page.locator(`[data-thumbnail-focus-container][data-asset="${assetId}"] button`);
|
return page.locator(`[data-thumbnail-focus-container][data-asset="${assetId}"] button[role="checkbox"]`);
|
||||||
},
|
},
|
||||||
selectedAsset(page: Page) {
|
selectedAsset(page: Page) {
|
||||||
return page.locator('[data-thumbnail-focus-container][data-selected]');
|
return page.locator('[data-thumbnail-focus-container][data-selected]');
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
mdiCheckCircle,
|
mdiCheckCircle,
|
||||||
mdiFileGifBox,
|
mdiFileGifBox,
|
||||||
mdiHeart,
|
mdiHeart,
|
||||||
|
mdiMagnifyPlusOutline,
|
||||||
mdiMotionPauseOutline,
|
mdiMotionPauseOutline,
|
||||||
mdiMotionPlayOutline,
|
mdiMotionPlayOutline,
|
||||||
mdiRotate360,
|
mdiRotate360,
|
||||||
@@ -46,6 +47,7 @@
|
|||||||
dimmed?: boolean;
|
dimmed?: boolean;
|
||||||
albumUsers?: UserResponseDto[];
|
albumUsers?: UserResponseDto[];
|
||||||
onClick?: (asset: TimelineAsset) => void;
|
onClick?: (asset: TimelineAsset) => void;
|
||||||
|
onPreview?: (asset: TimelineAsset) => void;
|
||||||
onSelect?: (asset: TimelineAsset) => void;
|
onSelect?: (asset: TimelineAsset) => void;
|
||||||
onMouseEvent?: (event: { isMouseOver: boolean; selectedGroupIndex: number }) => void;
|
onMouseEvent?: (event: { isMouseOver: boolean; selectedGroupIndex: number }) => void;
|
||||||
}
|
}
|
||||||
@@ -65,6 +67,7 @@
|
|||||||
showStackedIcon = true,
|
showStackedIcon = true,
|
||||||
albumUsers = [],
|
albumUsers = [],
|
||||||
onClick = undefined,
|
onClick = undefined,
|
||||||
|
onPreview = undefined,
|
||||||
onSelect = undefined,
|
onSelect = undefined,
|
||||||
onMouseEvent = undefined,
|
onMouseEvent = undefined,
|
||||||
imageClass = '',
|
imageClass = '',
|
||||||
@@ -442,6 +445,24 @@
|
|||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
<!-- Preview asset button (visible on hover when any asset is selected) -->
|
||||||
|
{#if mouseOver && onPreview}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onclick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
e.preventDefault();
|
||||||
|
onPreview?.($state.snapshot(asset));
|
||||||
|
}}
|
||||||
|
class="absolute z-2 bottom-1 end-1 rounded-full bg-black/25 p-1.5 hover:bg-black/50 focus:outline-none transition-colors"
|
||||||
|
in:fade={{ duration: 100 }}
|
||||||
|
tabindex={-1}
|
||||||
|
aria-label="Preview asset"
|
||||||
|
>
|
||||||
|
<Icon icon={mdiMagnifyPlusOutline} size="20" class="text-white" />
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<!-- Outline on focus -->
|
<!-- Outline on focus -->
|
||||||
<div
|
<div
|
||||||
class={[
|
class={[
|
||||||
|
|||||||
@@ -376,6 +376,7 @@
|
|||||||
void navigateToAsset(asset);
|
void navigateToAsset(asset);
|
||||||
}}
|
}}
|
||||||
onSelect={() => handleSelectAssets(currentAsset)}
|
onSelect={() => handleSelectAssets(currentAsset)}
|
||||||
|
onPreview={assetInteraction.selectionActive ? () => void navigateToAsset(asset) : undefined}
|
||||||
onMouseEvent={() => assetMouseEventHandler(currentAsset)}
|
onMouseEvent={() => assetMouseEventHandler(currentAsset)}
|
||||||
{showArchiveIcon}
|
{showArchiveIcon}
|
||||||
asset={currentAsset}
|
asset={currentAsset}
|
||||||
|
|||||||
@@ -698,6 +698,9 @@
|
|||||||
void onSelectAssets(asset);
|
void onSelectAssets(asset);
|
||||||
}}
|
}}
|
||||||
onMouseEvent={() => handleSelectAssetCandidates(asset)}
|
onMouseEvent={() => handleSelectAssetCandidates(asset)}
|
||||||
|
onPreview={isSelectionMode || assetInteraction.selectionActive
|
||||||
|
? (asset) => void navigate({ targetRoute: 'current', assetId: asset.id })
|
||||||
|
: undefined}
|
||||||
selected={isAssetSelected}
|
selected={isAssetSelected}
|
||||||
selectionCandidate={isAssetSelectionCandidate}
|
selectionCandidate={isAssetSelectionCandidate}
|
||||||
disabled={isAssetDisabled}
|
disabled={isAssetDisabled}
|
||||||
|
|||||||
Reference in New Issue
Block a user