mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
refactor(web): prefer modal manager (#22152)
This commit is contained in:
parent
eee94207ce
commit
2d816e89ad
1 changed files with 106 additions and 108 deletions
|
|
@ -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}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue