mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
25 lines
857 B
Svelte
25 lines
857 B
Svelte
<script lang="ts">
|
|
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
|
import MenuOption from '$lib/components/shared-components/context-menu/menu-option.svelte';
|
|
import { copyToClipboard, makeSharedLinkUrl } from '$lib/utils';
|
|
import type { SharedLinkResponseDto } from '@immich/sdk';
|
|
import { mdiContentCopy } from '@mdi/js';
|
|
import { t } from 'svelte-i18n';
|
|
|
|
interface Props {
|
|
link: SharedLinkResponseDto;
|
|
menuItem?: boolean;
|
|
}
|
|
|
|
let { link, menuItem = false }: Props = $props();
|
|
|
|
const handleCopy = async () => {
|
|
await copyToClipboard(makeSharedLinkUrl(link.key));
|
|
};
|
|
</script>
|
|
|
|
{#if menuItem}
|
|
<MenuOption text={$t('copy_link')} icon={mdiContentCopy} onClick={handleCopy} />
|
|
{:else}
|
|
<CircleIconButton title={$t('copy_link')} icon={mdiContentCopy} onclick={handleCopy} />
|
|
{/if}
|