refactor(web): prefer modal manager (#22152)

This commit is contained in:
Jason Rasmussen 2025-09-17 17:23:42 -04:00 committed by GitHub
parent eee94207ce
commit 2d816e89ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,7 +13,7 @@
type SharedLinkResponseDto,
type UserResponseDto,
} from '@immich/sdk';
import { Button, Icon, Link, Modal, ModalBody, Stack, Text } from '@immich/ui';
import { Button, Icon, Link, Modal, ModalBody, modalManager, Stack, Text } from '@immich/ui';
import { mdiCheck, mdiEye, mdiLink, mdiPencil } from '@mdi/js';
import { onMount } from 'svelte';
import { t } from 'svelte-i18n';
@ -29,9 +29,11 @@
let users: UserResponseDto[] = $state([]);
let selectedUsers: Record<string, { user: UserResponseDto; role: AlbumUserRole }> = $state({});
let sharedLinkUrl = $state('');
const handleViewQrCode = (sharedLink: SharedLinkResponseDto) => {
sharedLinkUrl = makeSharedLinkUrl(sharedLink);
const handleViewQrCode = async (sharedLink: SharedLinkResponseDto) => {
await modalManager.show(QrCodeModal, {
title: $t('view_link'),
value: makeSharedLinkUrl(sharedLink),
});
};
const roleOptions: Array<{ title: string; value: AlbumUserRole | 'none'; icon?: string }> = [
@ -71,10 +73,7 @@
};
</script>
{#if sharedLinkUrl}
<QrCodeModal title={$t('view_link')} onClose={() => (sharedLinkUrl = '')} value={sharedLinkUrl} />
{:else}
<Modal size="small" title={$t('share')} {onClose}>
<Modal size="small" title={$t('share')} {onClose}>
<ModalBody>
{#if Object.keys(selectedUsers).length > 0}
<div class="mb-2 py-2 sticky">
@ -189,5 +188,4 @@
>
</Stack>
</ModalBody>
</Modal>
{/if}
</Modal>