a02e1f5e7c
* remove import and referenced file * first pass at replacing all CircleIconButtons * fix linting issues * fix combobox formatting issues * fix button context menu coloring * remove circle icon button from search history box * use theme switcher from UI lib * dark mode force the asset viewer icons * fix forced dark mode icons * dark mode memory viewer icons * fix: back button in memory viewer --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
35 lines
1.1 KiB
Svelte
35 lines
1.1 KiB
Svelte
<script lang="ts">
|
|
import { shortcut } from '$lib/actions/shortcut';
|
|
import MenuOption from '$lib/components/shared-components/context-menu/menu-option.svelte';
|
|
import { authManager } from '$lib/managers/auth-manager.svelte';
|
|
import type { TimelineAsset } from '$lib/stores/assets-store.svelte';
|
|
import { downloadFile } from '$lib/utils/asset-utils';
|
|
import { getAssetInfo } from '@immich/sdk';
|
|
import { IconButton } from '@immich/ui';
|
|
import { mdiFolderDownloadOutline } from '@mdi/js';
|
|
import { t } from 'svelte-i18n';
|
|
|
|
interface Props {
|
|
asset: TimelineAsset;
|
|
menuItem?: boolean;
|
|
}
|
|
|
|
let { asset, menuItem = false }: Props = $props();
|
|
|
|
const onDownloadFile = async () => downloadFile(await getAssetInfo({ id: asset.id, key: authManager.key }));
|
|
</script>
|
|
|
|
<svelte:document use:shortcut={{ shortcut: { key: 'd', shift: true }, onShortcut: onDownloadFile }} />
|
|
|
|
{#if !menuItem}
|
|
<IconButton
|
|
color="primary"
|
|
shape="round"
|
|
icon={mdiFolderDownloadOutline}
|
|
aria-label={$t('download')}
|
|
onclick={onDownloadFile}
|
|
/>
|
|
{:else}
|
|
<MenuOption icon={mdiFolderDownloadOutline} text={$t('download')} onClick={onDownloadFile} />
|
|
{/if}
|