mirror of
https://github.com/immich-app/immich.git
synced 2025-12-23 01:11:36 +03:00
* feat: custom url for shared links * feat: use a separate route and query param --------- Co-authored-by: Jason Rasmussen <jason@rasm.me>
33 lines
939 B
Svelte
33 lines
939 B
Svelte
<script lang="ts">
|
|
import QrCodeModal from '$lib/modals/QrCodeModal.svelte';
|
|
import SharedLinkCreateModal from '$lib/modals/SharedLinkCreateModal.svelte';
|
|
import { makeSharedLinkUrl } from '$lib/utils';
|
|
import type { AssetResponseDto } from '@immich/sdk';
|
|
import { IconButton, modalManager } from '@immich/ui';
|
|
import { mdiShareVariantOutline } from '@mdi/js';
|
|
import { t } from 'svelte-i18n';
|
|
|
|
interface Props {
|
|
asset: AssetResponseDto;
|
|
}
|
|
|
|
let { asset }: Props = $props();
|
|
|
|
const handleClick = async () => {
|
|
const sharedLink = await modalManager.show(SharedLinkCreateModal, { assetIds: [asset.id] });
|
|
|
|
if (sharedLink) {
|
|
await modalManager.show(QrCodeModal, { title: $t('view_link'), value: makeSharedLinkUrl(sharedLink) });
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<IconButton
|
|
color="secondary"
|
|
shape="round"
|
|
variant="ghost"
|
|
icon={mdiShareVariantOutline}
|
|
onclick={handleClick}
|
|
aria-label={$t('share')}
|
|
/>
|