Skip to content

Commit 373b654

Browse files
chore: migrate profile picture cropper modal (#19378)
1 parent a5d84ba commit 373b654

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed
Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import MenuOption from '$lib/components/shared-components/context-menu/menu-option.svelte';
3-
import Portal from '$lib/components/shared-components/portal/portal.svelte';
4-
import ProfileImageCropper from '$lib/components/shared-components/profile-image-cropper.svelte';
3+
import { modalManager } from '$lib/managers/modal-manager.svelte';
4+
import ProfileImageCropperModal from '$lib/modals/ProfileImageCropperModal.svelte';
55
import type { AssetResponseDto } from '@immich/sdk';
66
import { mdiAccountCircleOutline } from '@mdi/js';
77
import { t } from 'svelte-i18n';
@@ -11,18 +11,10 @@
1111
}
1212
1313
let { asset }: Props = $props();
14-
15-
let showProfileImageCrop = $state(false);
1614
</script>
1715

1816
<MenuOption
1917
icon={mdiAccountCircleOutline}
20-
onClick={() => (showProfileImageCrop = true)}
18+
onClick={() => modalManager.show(ProfileImageCropperModal, { asset })}
2119
text={$t('set_as_profile_picture')}
2220
/>
23-
24-
{#if showProfileImageCrop}
25-
<Portal target="body">
26-
<ProfileImageCropper {asset} onClose={() => (showProfileImageCrop = false)} />
27-
</Portal>
28-
{/if}

web/src/lib/components/shared-components/profile-image-cropper.svelte renamed to web/src/lib/modals/ProfileImageCropperModal.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import domtoimage from 'dom-to-image';
77
import { onMount } from 'svelte';
88
import { t } from 'svelte-i18n';
9-
import PhotoViewer from '../asset-viewer/photo-viewer.svelte';
10-
import { NotificationType, notificationController } from './notification/notification';
9+
import PhotoViewer from '../components/asset-viewer/photo-viewer.svelte';
10+
import { NotificationType, notificationController } from '../components/shared-components/notification/notification';
1111
1212
interface Props {
1313
asset: AssetResponseDto;

0 commit comments

Comments
 (0)