mirror of
https://github.com/immich-app/immich.git
synced 2025-01-06 03:46:47 +01:00
fix(web): correctly use button and link elements (#7907)
This commit is contained in:
parent
67b209808f
commit
b07ed3f615
2 changed files with 64 additions and 81 deletions
|
@ -258,62 +258,58 @@
|
||||||
<div class="mt-2 flex flex-wrap gap-2">
|
<div class="mt-2 flex flex-wrap gap-2">
|
||||||
{#each people as person, index (person.id)}
|
{#each people as person, index (person.id)}
|
||||||
{#if showingHiddenPeople || !person.isHidden}
|
{#if showingHiddenPeople || !person.isHidden}
|
||||||
<div
|
<a
|
||||||
class="w-[90px]"
|
class="w-[90px]"
|
||||||
role="button"
|
href="{AppRoute.PEOPLE}/{person.id}?{QueryParameter.PREVIOUS_ROUTE}={currentAlbum?.id
|
||||||
tabindex={index}
|
? `${AppRoute.ALBUMS}/${currentAlbum?.id}`
|
||||||
|
: AppRoute.PHOTOS}"
|
||||||
on:focus={() => ($boundingBoxesArray = people[index].faces)}
|
on:focus={() => ($boundingBoxesArray = people[index].faces)}
|
||||||
|
on:blur={() => ($boundingBoxesArray = [])}
|
||||||
on:mouseover={() => ($boundingBoxesArray = people[index].faces)}
|
on:mouseover={() => ($boundingBoxesArray = people[index].faces)}
|
||||||
on:mouseleave={() => ($boundingBoxesArray = [])}
|
on:mouseleave={() => ($boundingBoxesArray = [])}
|
||||||
|
on:click={() => dispatch('closeViewer')}
|
||||||
>
|
>
|
||||||
<a
|
<div class="relative">
|
||||||
href="{AppRoute.PEOPLE}/{person.id}?{QueryParameter.PREVIOUS_ROUTE}={currentAlbum?.id
|
<ImageThumbnail
|
||||||
? `${AppRoute.ALBUMS}/${currentAlbum?.id}`
|
curve
|
||||||
: AppRoute.PHOTOS}"
|
shadow
|
||||||
on:click={() => dispatch('closeViewer')}
|
url={getPeopleThumbnailUrl(person.id)}
|
||||||
>
|
altText={person.name}
|
||||||
<div class="relative">
|
title={person.name}
|
||||||
<ImageThumbnail
|
widthStyle="90px"
|
||||||
curve
|
heightStyle="90px"
|
||||||
shadow
|
thumbhash={null}
|
||||||
url={getPeopleThumbnailUrl(person.id)}
|
hidden={person.isHidden}
|
||||||
altText={person.name}
|
/>
|
||||||
title={person.name}
|
</div>
|
||||||
widthStyle="90px"
|
<p class="mt-1 truncate font-medium" title={person.name}>{person.name}</p>
|
||||||
heightStyle="90px"
|
{#if person.birthDate}
|
||||||
thumbhash={null}
|
{@const personBirthDate = DateTime.fromISO(person.birthDate)}
|
||||||
hidden={person.isHidden}
|
{@const age = Math.floor(DateTime.fromISO(asset.fileCreatedAt).diff(personBirthDate, 'years').years)}
|
||||||
/>
|
{@const ageInMonths = Math.floor(
|
||||||
</div>
|
DateTime.fromISO(asset.fileCreatedAt).diff(personBirthDate, 'months').months,
|
||||||
<p class="mt-1 truncate font-medium" title={person.name}>{person.name}</p>
|
)}
|
||||||
{#if person.birthDate}
|
{#if age >= 0}
|
||||||
{@const personBirthDate = DateTime.fromISO(person.birthDate)}
|
<p
|
||||||
{@const age = Math.floor(DateTime.fromISO(asset.fileCreatedAt).diff(personBirthDate, 'years').years)}
|
class="font-light"
|
||||||
{@const ageInMonths = Math.floor(
|
title={personBirthDate.toLocaleString(
|
||||||
DateTime.fromISO(asset.fileCreatedAt).diff(personBirthDate, 'months').months,
|
{
|
||||||
)}
|
month: 'long',
|
||||||
{#if age >= 0}
|
day: 'numeric',
|
||||||
<p
|
year: 'numeric',
|
||||||
class="font-light"
|
},
|
||||||
title={personBirthDate.toLocaleString(
|
{ locale: $locale },
|
||||||
{
|
)}
|
||||||
month: 'long',
|
>
|
||||||
day: 'numeric',
|
{#if ageInMonths <= 11}
|
||||||
year: 'numeric',
|
Age {ageInMonths} months
|
||||||
},
|
{:else}
|
||||||
{ locale: $locale },
|
Age {age}
|
||||||
)}
|
{/if}
|
||||||
>
|
</p>
|
||||||
{#if ageInMonths <= 11}
|
|
||||||
Age {ageInMonths} months
|
|
||||||
{:else}
|
|
||||||
Age {age}
|
|
||||||
{/if}
|
|
||||||
</p>
|
|
||||||
{/if}
|
|
||||||
{/if}
|
{/if}
|
||||||
</a>
|
{/if}
|
||||||
</div>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
@ -341,12 +337,10 @@
|
||||||
{@const assetDateTimeOriginal = DateTime.fromISO(asset.exifInfo.dateTimeOriginal, {
|
{@const assetDateTimeOriginal = DateTime.fromISO(asset.exifInfo.dateTimeOriginal, {
|
||||||
zone: asset.exifInfo.timeZone ?? undefined,
|
zone: asset.exifInfo.timeZone ?? undefined,
|
||||||
})}
|
})}
|
||||||
<div
|
<button
|
||||||
class="flex justify-between place-items-start gap-4 py-4"
|
type="button"
|
||||||
tabindex="0"
|
class="flex w-full text-left justify-between place-items-start gap-4 py-4"
|
||||||
role="button"
|
|
||||||
on:click={() => (isOwner ? (isShowChangeDate = true) : null)}
|
on:click={() => (isOwner ? (isShowChangeDate = true) : null)}
|
||||||
on:keydown={(event) => (isOwner ? event.key === 'Enter' && (isShowChangeDate = true) : null)}
|
|
||||||
title={isOwner ? 'Edit date' : ''}
|
title={isOwner ? 'Edit date' : ''}
|
||||||
class:hover:dark:text-immich-dark-primary={isOwner}
|
class:hover:dark:text-immich-dark-primary={isOwner}
|
||||||
class:hover:text-immich-primary={isOwner}
|
class:hover:text-immich-primary={isOwner}
|
||||||
|
@ -384,11 +378,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if isOwner}
|
{#if isOwner}
|
||||||
<button class="focus:outline-none p-1">
|
<div class="p-1">
|
||||||
<Icon path={mdiPencil} size="20" />
|
<Icon path={mdiPencil} size="20" />
|
||||||
</button>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</button>
|
||||||
{:else if !asset.exifInfo?.dateTimeOriginal && !asset.isReadOnly && isOwner}
|
{:else if !asset.exifInfo?.dateTimeOriginal && !asset.isReadOnly && isOwner}
|
||||||
<div class="flex justify-between place-items-start gap-4 py-4">
|
<div class="flex justify-between place-items-start gap-4 py-4">
|
||||||
<div class="flex gap-4">
|
<div class="flex gap-4">
|
||||||
|
@ -396,9 +390,9 @@
|
||||||
<Icon path={mdiCalendar} size="24" />
|
<Icon path={mdiCalendar} size="24" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="focus:outline-none p-1">
|
<div class="p-1">
|
||||||
<Icon path={mdiPencil} size="20" />
|
<Icon path={mdiPencil} size="20" />
|
||||||
</button>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{:else if asset.exifInfo?.dateTimeOriginal && asset.isReadOnly}
|
{:else if asset.exifInfo?.dateTimeOriginal && asset.isReadOnly}
|
||||||
{@const assetDateTimeOriginal = DateTime.fromISO(asset.exifInfo.dateTimeOriginal, {
|
{@const assetDateTimeOriginal = DateTime.fromISO(asset.exifInfo.dateTimeOriginal, {
|
||||||
|
@ -517,13 +511,11 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if asset.exifInfo?.city && !asset.isReadOnly}
|
{#if asset.exifInfo?.city && !asset.isReadOnly}
|
||||||
<div
|
<button
|
||||||
class="flex justify-between place-items-start gap-4 py-4"
|
type="button"
|
||||||
|
class="flex w-full text-left justify-between place-items-start gap-4 py-4"
|
||||||
on:click={() => (isOwner ? (isShowChangeLocation = true) : null)}
|
on:click={() => (isOwner ? (isShowChangeLocation = true) : null)}
|
||||||
on:keydown={(event) => (isOwner ? event.key === 'Enter' && (isShowChangeLocation = true) : null)}
|
|
||||||
tabindex="0"
|
|
||||||
title={isOwner ? 'Edit location' : ''}
|
title={isOwner ? 'Edit location' : ''}
|
||||||
role="button"
|
|
||||||
class:hover:dark:text-immich-dark-primary={isOwner}
|
class:hover:dark:text-immich-dark-primary={isOwner}
|
||||||
class:hover:text-immich-primary={isOwner}
|
class:hover:text-immich-primary={isOwner}
|
||||||
>
|
>
|
||||||
|
@ -550,14 +542,12 @@
|
||||||
<Icon path={mdiPencil} size="20" />
|
<Icon path={mdiPencil} size="20" />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</button>
|
||||||
{:else if !asset.exifInfo?.city && !asset.isReadOnly && isOwner}
|
{:else if !asset.exifInfo?.city && !asset.isReadOnly && isOwner}
|
||||||
<div
|
<button
|
||||||
class="flex justify-between place-items-start gap-4 py-4 rounded-lg hover:dark:text-immich-dark-primary hover:text-immich-primary"
|
type="button"
|
||||||
|
class="flex w-full text-left justify-between place-items-start gap-4 py-4 rounded-lg hover:dark:text-immich-dark-primary hover:text-immich-primary"
|
||||||
on:click={() => (isShowChangeLocation = true)}
|
on:click={() => (isShowChangeLocation = true)}
|
||||||
on:keydown={(event) => event.key === 'Enter' && (isShowChangeLocation = true)}
|
|
||||||
tabindex="0"
|
|
||||||
role="button"
|
|
||||||
title="Add location"
|
title="Add location"
|
||||||
>
|
>
|
||||||
<div class="flex gap-4">
|
<div class="flex gap-4">
|
||||||
|
@ -570,7 +560,7 @@
|
||||||
<div class="focus:outline-none p-1">
|
<div class="focus:outline-none p-1">
|
||||||
<Icon path={mdiPencil} size="20" />
|
<Icon path={mdiPencil} size="20" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</button>
|
||||||
{:else if asset.exifInfo?.city && asset.isReadOnly}
|
{:else if asset.exifInfo?.city && asset.isReadOnly}
|
||||||
<div class="flex justify-between place-items-start gap-4 py-4">
|
<div class="flex justify-between place-items-start gap-4 py-4">
|
||||||
<div class="flex gap-4">
|
<div class="flex gap-4">
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { goto } from '$app/navigation';
|
|
||||||
import Icon from '$lib/components/elements/icon.svelte';
|
import Icon from '$lib/components/elements/icon.svelte';
|
||||||
import { AppRoute } from '$lib/constants';
|
import { AppRoute } from '$lib/constants';
|
||||||
import { getAssetThumbnailUrl } from '$lib/utils';
|
import { getAssetThumbnailUrl } from '$lib/utils';
|
||||||
|
@ -122,15 +121,9 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if !link.expiresAt || !isExpired(link.expiresAt)}
|
{#if !link.expiresAt || !isExpired(link.expiresAt)}
|
||||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
<a href="{AppRoute.SHARE}/{link.key}" title="Go to share page">
|
||||||
<div
|
|
||||||
class="hover:cursor-pointer"
|
|
||||||
title="Go to share page"
|
|
||||||
on:click={() => goto(`${AppRoute.SHARE}/${link.key}`)}
|
|
||||||
on:keydown={() => goto(`${AppRoute.SHARE}/${link.key}`)}
|
|
||||||
>
|
|
||||||
<Icon path={mdiOpenInNew} />
|
<Icon path={mdiOpenInNew} />
|
||||||
</div>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue