diff --git a/web/src/lib/components/utilities-page/duplicates/duplicate-asset-selection.svelte b/web/src/lib/components/utilities-page/duplicates/duplicate-asset-selection.svelte new file mode 100644 index 0000000000..348f0a8e53 --- /dev/null +++ b/web/src/lib/components/utilities-page/duplicates/duplicate-asset-selection.svelte @@ -0,0 +1,48 @@ + + + + {@render children?.()} + diff --git a/web/src/lib/components/utilities-page/duplicates/duplicate-asset.svelte b/web/src/lib/components/utilities-page/duplicates/duplicate-asset.svelte index ab3124a167..6b24e3fb11 100644 --- a/web/src/lib/components/utilities-page/duplicates/duplicate-asset.svelte +++ b/web/src/lib/components/utilities-page/duplicates/duplicate-asset.svelte @@ -11,6 +11,7 @@ import { locale } from '$lib/stores/preferences.store'; import type { SelectedSyncData } from '$lib/components/utilities-page/duplicates/duplicates-compare-control.svelte'; import { DateTime } from 'luxon'; + import DuplicateAssetSelection from '$lib/components/utilities-page/duplicates/duplicate-asset-selection.svelte'; interface Props { asset: AssetResponseDto; @@ -56,31 +57,16 @@ selectedSyncData.isFavorite = selectedSyncData.isFavorite || asset.isFavorite; selectedSyncData.isArchived = selectedSyncData.isArchived || asset.isArchived; - let descriptionItem = $state(); - let locationItem = $state(); + let descriptionItem = $state(); + let locationItem = $state(); let albums: AlbumResponseDto[] = $state([]); onMount(async () => { - setDescriptionHeight(descriptionItem.getBoundingClientRect().height); - setLocationHeight(locationItem.getBoundingClientRect().height); + setDescriptionHeight(descriptionItem.getHeight()); + setLocationHeight(locationItem.getHeight()); albums = await getAllAlbums({ assetId: asset.id }); setAlbums(albums); }); - const getBackgroundColor = (isSelected: boolean, syncDataExist: boolean, syncIsAssetData: boolean) => { - let color = 'rounded-xl dark:hover:bg-gray-300'; - color += isSelected ? ' hover:bg-gray-300' : ' hover:bg-gray-500'; - if (isSelected) { - if (syncDataExist && !syncIsAssetData) { - color += ' bg-red-300/90'; - } - } else { - if (syncIsAssetData) { - color += ' bg-green-400/90'; - } - } - return color; - }; - let timeZone = $derived(asset.exifInfo?.timeZone); let dateTime = $derived( timeZone && asset.exifInfo?.dateTimeOriginal @@ -217,11 +203,12 @@ {$t('in_albums', { values: { count: displayedAlbums.length } })} {/if} - onSelectDate(displayedDateTime)} + onSelectDate(displayedDateTime)} > {displayedDateTime.toLocaleString( { @@ -240,18 +227,16 @@ }, { locale: $locale }, )} - - + onSelectLocation(displayedLocation)} + {isSelected} + slotHeight={locationHeight} + selectedData={selectedSyncData?.location} + displayedData={displayedLocation?.city && displayedLocation?.state && displayedLocation?.country} + isSelectedEqualOriginal={selectedSyncData?.location?.latitude === location.latitude && + selectedSyncData?.location?.longitude === location.longitude} + onClick={() => onSelectLocation(displayedLocation)} > {#if displayedLocation?.city} @@ -264,19 +249,17 @@ {#if displayedLocation?.country} {displayedLocation.country} {/if} - - + onSelectDescription(displayedDescription)} + {isSelected} + slotHeight={descriptionHeight} + selectedData={selectedSyncData.description} + displayedData={displayedDescription} + isSelectedEqualOriginal={selectedSyncData?.description === description} + onClick={() => onSelectDescription(displayedDescription)} > {displayedDescription} - +
{displayedLocation.country}