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