2023-11-05 18:24:43 +01:00
|
|
|
<script lang="ts">
|
2024-07-29 16:38:27 +02:00
|
|
|
import { locale } from '$lib/stores/preferences.store';
|
2024-02-14 06:38:57 -08:00
|
|
|
import type { ActivityResponseDto } from '@immich/sdk';
|
2025-09-16 21:40:43 +02:00
|
|
|
import { Icon } from '@immich/ui';
|
2023-11-05 18:24:43 +01:00
|
|
|
import { mdiCommentOutline, mdiHeart, mdiHeartOutline } from '@mdi/js';
|
|
|
|
|
|
2024-11-14 08:43:25 -06:00
|
|
|
interface Props {
|
|
|
|
|
isLiked: ActivityResponseDto | null;
|
|
|
|
|
numberOfComments: number | undefined;
|
2025-06-04 19:41:50 +02:00
|
|
|
numberOfLikes: number | undefined;
|
2024-11-14 08:43:25 -06:00
|
|
|
disabled: boolean;
|
|
|
|
|
onOpenActivityTab: () => void;
|
|
|
|
|
onFavorite: () => void;
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-04 19:41:50 +02:00
|
|
|
let { isLiked, numberOfComments, numberOfLikes, disabled, onOpenActivityTab, onFavorite }: Props = $props();
|
2023-11-05 18:24:43 +01:00
|
|
|
</script>
|
|
|
|
|
|
2025-06-04 19:41:50 +02:00
|
|
|
<div class="w-full flex p-4 items-center justify-center rounded-full gap-5 bg-subtle border bg-opacity-60">
|
2024-11-14 08:43:25 -06:00
|
|
|
<button type="button" class={disabled ? 'cursor-not-allowed' : ''} onclick={onFavorite} {disabled}>
|
2025-06-04 19:41:50 +02:00
|
|
|
<div class="flex gap-2 items-center justify-center">
|
2025-09-16 21:40:43 +02:00
|
|
|
<Icon icon={isLiked ? mdiHeart : mdiHeartOutline} size="24" class={isLiked ? 'text-red-400' : 'text-fg'} />
|
2025-06-04 19:41:50 +02:00
|
|
|
{#if numberOfLikes}
|
|
|
|
|
<div class="text-l">{numberOfLikes.toLocaleString($locale)}</div>
|
|
|
|
|
{/if}
|
2023-11-05 18:24:43 +01:00
|
|
|
</div>
|
|
|
|
|
</button>
|
2024-11-14 08:43:25 -06:00
|
|
|
<button type="button" onclick={onOpenActivityTab}>
|
2023-11-05 18:24:43 +01:00
|
|
|
<div class="flex gap-2 items-center justify-center">
|
2025-09-16 21:40:43 +02:00
|
|
|
<Icon icon={mdiCommentOutline} class="scale-x-[-1]" size="24" />
|
2023-11-05 18:24:43 +01:00
|
|
|
{#if numberOfComments}
|
2025-06-04 19:41:50 +02:00
|
|
|
<div class="text-l">{numberOfComments.toLocaleString($locale)}</div>
|
2023-11-05 18:24:43 +01:00
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|