mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
- cleanup combobox thumbnails, use component prop to enable
This commit is contained in:
@@ -46,6 +46,7 @@
|
|||||||
* select first matching option on enter key.
|
* select first matching option on enter key.
|
||||||
*/
|
*/
|
||||||
defaultFirstOption?: boolean;
|
defaultFirstOption?: boolean;
|
||||||
|
hasThumbnails?: boolean;
|
||||||
onSelect?: (option: ComboBoxOption | undefined) => void;
|
onSelect?: (option: ComboBoxOption | undefined) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,6 +58,7 @@
|
|||||||
placeholder = '',
|
placeholder = '',
|
||||||
allowCreate = false,
|
allowCreate = false,
|
||||||
defaultFirstOption = false,
|
defaultFirstOption = false,
|
||||||
|
hasThumbnails = false,
|
||||||
onSelect = () => {},
|
onSelect = () => {},
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
|
|
||||||
@@ -385,13 +387,11 @@
|
|||||||
onclick={() => handleSelect(option)}
|
onclick={() => handleSelect(option)}
|
||||||
role="option"
|
role="option"
|
||||||
>
|
>
|
||||||
{#if option.thumbnail}
|
{#if hasThumbnails}
|
||||||
<div
|
<div
|
||||||
class="text-start flex w-full place-items-center gap-4 rounded-e-full py-3 transition-[padding] delay-100 duration-100 hover:cursor-pointer hover:bg-subtle hover:text-immich-primary dark:text-immich-dark-fg dark:hover:bg-immich-dark-gray dark:hover:text-immich-dark-primary px-4"
|
class="text-start flex w-full place-items-center gap-4 rounded-e-full py-3 transition-[padding] delay-100 duration-100 hover:cursor-pointer hover:bg-subtle hover:text-immich-primary dark:text-immich-dark-fg dark:hover:bg-immich-dark-gray dark:hover:text-immich-dark-primary px-4"
|
||||||
>
|
>
|
||||||
{#if option.thumbnail === 'no-thumbnail'}
|
{#if option.thumbnail}
|
||||||
<div class="h-6 w-6 bg-cover rounded hover:shadow-lg"></div>
|
|
||||||
{:else}
|
|
||||||
<img
|
<img
|
||||||
src={option.thumbnail}
|
src={option.thumbnail}
|
||||||
alt={option.label}
|
alt={option.label}
|
||||||
@@ -399,6 +399,8 @@
|
|||||||
data-testid="album-image"
|
data-testid="album-image"
|
||||||
draggable="false"
|
draggable="false"
|
||||||
/>
|
/>
|
||||||
|
{:else}
|
||||||
|
<div class="h-6 w-6 bg-cover rounded hover:shadow-lg"></div>
|
||||||
{/if}
|
{/if}
|
||||||
{option.label}
|
{option.label}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -43,13 +43,14 @@
|
|||||||
<div class="my-4 flex flex-col gap-2">
|
<div class="my-4 flex flex-col gap-2">
|
||||||
<Combobox
|
<Combobox
|
||||||
onSelect={handleSelect}
|
onSelect={handleSelect}
|
||||||
|
hasThumbnails
|
||||||
label={$t('albums').toUpperCase()}
|
label={$t('albums').toUpperCase()}
|
||||||
defaultFirstOption
|
defaultFirstOption
|
||||||
options={allAlbums.map((album) => ({
|
options={allAlbums.map((album) => ({
|
||||||
id: album.id,
|
id: album.id,
|
||||||
label: album.albumName,
|
label: album.albumName,
|
||||||
value: album.id,
|
value: album.id,
|
||||||
thumbnail: album.albumThumbnailAssetId ? getAssetThumbnailUrl(album.albumThumbnailAssetId) : 'no-thumbnail',
|
thumbnail: album.albumThumbnailAssetId ? getAssetThumbnailUrl(album.albumThumbnailAssetId) : undefined,
|
||||||
}))}
|
}))}
|
||||||
bind:selectedOption
|
bind:selectedOption
|
||||||
placeholder={$t('search_albums')}
|
placeholder={$t('search_albums')}
|
||||||
|
|||||||
Reference in New Issue
Block a user