2024-07-31 18:25:38 +02:00
|
|
|
<script lang="ts">
|
2025-05-09 18:59:29 +02:00
|
|
|
import QrCodeModal from '$lib/modals/QrCodeModal.svelte';
|
|
|
|
|
import SharedLinkCreateModal from '$lib/modals/SharedLinkCreateModal.svelte';
|
|
|
|
|
import { makeSharedLinkUrl } from '$lib/utils';
|
2024-07-31 18:25:38 +02:00
|
|
|
import type { AssetResponseDto } from '@immich/sdk';
|
2025-07-23 23:27:09 +02:00
|
|
|
import { IconButton, modalManager } from '@immich/ui';
|
2024-07-31 18:25:38 +02:00
|
|
|
import { mdiShareVariantOutline } from '@mdi/js';
|
|
|
|
|
import { t } from 'svelte-i18n';
|
|
|
|
|
|
2024-11-14 08:43:25 -06:00
|
|
|
interface Props {
|
|
|
|
|
asset: AssetResponseDto;
|
|
|
|
|
}
|
2024-07-31 18:25:38 +02:00
|
|
|
|
2024-11-14 08:43:25 -06:00
|
|
|
let { asset }: Props = $props();
|
|
|
|
|
|
2025-05-09 18:59:29 +02:00
|
|
|
const handleClick = async () => {
|
|
|
|
|
const sharedLink = await modalManager.show(SharedLinkCreateModal, { assetIds: [asset.id] });
|
2024-07-31 18:25:38 +02:00
|
|
|
|
2025-05-09 18:59:29 +02:00
|
|
|
if (sharedLink) {
|
2025-07-28 14:16:55 -04:00
|
|
|
await modalManager.show(QrCodeModal, { title: $t('view_link'), value: makeSharedLinkUrl(sharedLink) });
|
2025-05-09 18:59:29 +02:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
2024-07-31 18:25:38 +02:00
|
|
|
|
2025-06-02 09:47:23 -05:00
|
|
|
<IconButton
|
|
|
|
|
color="secondary"
|
|
|
|
|
shape="round"
|
|
|
|
|
variant="ghost"
|
|
|
|
|
icon={mdiShareVariantOutline}
|
|
|
|
|
onclick={handleClick}
|
|
|
|
|
aria-label={$t('share')}
|
|
|
|
|
/>
|