refactor: dialog controller (#18235)
This commit is contained in:
@@ -3,13 +3,13 @@
|
||||
import { page } from '$app/state';
|
||||
import GroupTab from '$lib/components/elements/group-tab.svelte';
|
||||
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
|
||||
import { dialogController } from '$lib/components/shared-components/dialog/dialog';
|
||||
import {
|
||||
notificationController,
|
||||
NotificationType,
|
||||
} from '$lib/components/shared-components/notification/notification';
|
||||
import SharedLinkCard from '$lib/components/sharedlinks-page/shared-link-card.svelte';
|
||||
import { AppRoute } from '$lib/constants';
|
||||
import { modalManager } from '$lib/managers/modal-manager.svelte';
|
||||
import SharedLinkCreateModal from '$lib/modals/SharedLinkCreateModal.svelte';
|
||||
import { handleError } from '$lib/utils/handle-error';
|
||||
import { getAllSharedLinks, removeSharedLink, SharedLinkType, type SharedLinkResponseDto } from '@immich/sdk';
|
||||
@@ -35,7 +35,7 @@
|
||||
});
|
||||
|
||||
const handleDeleteLink = async (id: string) => {
|
||||
const isConfirmed = await dialogController.show({
|
||||
const isConfirmed = await modalManager.showDialog({
|
||||
title: $t('delete_shared_link'),
|
||||
prompt: $t('confirm_delete_shared_link'),
|
||||
confirmText: $t('delete'),
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
import SkipLink from '$lib/components/elements/buttons/skip-link.svelte';
|
||||
import UserPageLayout, { headerId } from '$lib/components/layouts/user-page-layout.svelte';
|
||||
import AssetGrid from '$lib/components/photos-page/asset-grid.svelte';
|
||||
import { dialogController } from '$lib/components/shared-components/dialog/dialog';
|
||||
import FullScreenModal from '$lib/components/shared-components/full-screen-modal.svelte';
|
||||
import {
|
||||
notificationController,
|
||||
@@ -16,15 +15,16 @@
|
||||
import TreeItemThumbnails from '$lib/components/shared-components/tree/tree-item-thumbnails.svelte';
|
||||
import TreeItems from '$lib/components/shared-components/tree/tree-items.svelte';
|
||||
import { AppRoute, AssetAction, QueryParameter, SettingInputFieldType } from '$lib/constants';
|
||||
import { modalManager } from '$lib/managers/modal-manager.svelte';
|
||||
import { AssetInteraction } from '$lib/stores/asset-interaction.svelte';
|
||||
import { AssetStore } from '$lib/stores/assets-store.svelte';
|
||||
import { buildTree, normalizeTreePath } from '$lib/utils/tree-utils';
|
||||
import { deleteTag, getAllTags, updateTag, upsertTags, type TagResponseDto } from '@immich/sdk';
|
||||
import { Button, HStack, Text } from '@immich/ui';
|
||||
import { mdiPencil, mdiPlus, mdiTag, mdiTagMultiple, mdiTrashCanOutline } from '@mdi/js';
|
||||
import { onDestroy } from 'svelte';
|
||||
import { t } from 'svelte-i18n';
|
||||
import type { PageData } from './$types';
|
||||
import { onDestroy } from 'svelte';
|
||||
|
||||
interface Props {
|
||||
data: PageData;
|
||||
@@ -116,7 +116,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
const isConfirm = await dialogController.show({
|
||||
const isConfirm = await modalManager.showDialog({
|
||||
title: $t('delete_tag'),
|
||||
prompt: $t('delete_tag_confirmation_prompt', { values: { tagName: tag.value } }),
|
||||
confirmText: $t('delete'),
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
import SelectAllAssets from '$lib/components/photos-page/actions/select-all-assets.svelte';
|
||||
import AssetGrid from '$lib/components/photos-page/asset-grid.svelte';
|
||||
import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte';
|
||||
import { dialogController } from '$lib/components/shared-components/dialog/dialog';
|
||||
import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte';
|
||||
import {
|
||||
NotificationType,
|
||||
notificationController,
|
||||
} from '$lib/components/shared-components/notification/notification';
|
||||
import { AppRoute } from '$lib/constants';
|
||||
import { modalManager } from '$lib/managers/modal-manager.svelte';
|
||||
import { AssetInteraction } from '$lib/stores/asset-interaction.svelte';
|
||||
import { AssetStore } from '$lib/stores/assets-store.svelte';
|
||||
import { featureFlags, serverConfig } from '$lib/stores/server-config.store';
|
||||
@@ -43,10 +43,7 @@
|
||||
const assetInteraction = new AssetInteraction();
|
||||
|
||||
const handleEmptyTrash = async () => {
|
||||
const isConfirmed = await dialogController.show({
|
||||
prompt: $t('empty_trash_confirmation'),
|
||||
});
|
||||
|
||||
const isConfirmed = await modalManager.showDialog({ prompt: $t('empty_trash_confirmation') });
|
||||
if (!isConfirmed) {
|
||||
return;
|
||||
}
|
||||
@@ -64,10 +61,7 @@
|
||||
};
|
||||
|
||||
const handleRestoreTrash = async () => {
|
||||
const isConfirmed = await dialogController.show({
|
||||
prompt: $t('assets_restore_confirmation'),
|
||||
});
|
||||
|
||||
const isConfirmed = await modalManager.showDialog({ prompt: $t('assets_restore_confirmation') });
|
||||
if (!isConfirmed) {
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
<script lang="ts">
|
||||
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
||||
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
|
||||
import { dialogController } from '$lib/components/shared-components/dialog/dialog';
|
||||
import DuplicatesModal from '$lib/components/shared-components/duplicates-modal.svelte';
|
||||
import {
|
||||
NotificationType,
|
||||
@@ -55,7 +54,7 @@
|
||||
let hasDuplicates = $derived(duplicates.length > 0);
|
||||
const withConfirmation = async (callback: () => Promise<void>, prompt?: string, confirmText?: string) => {
|
||||
if (prompt && confirmText) {
|
||||
const isConfirmed = await dialogController.show({ prompt, confirmText });
|
||||
const isConfirmed = await modalManager.showDialog({ prompt, confirmText });
|
||||
if (!isConfirmed) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user