From d2ab668fa04105fc2995ca2a6284abaa00595d9a Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu, 12 Sep 2024 23:18:26 +1000 Subject: [PATCH] revert(ui): remove post-generation toasts --- .../services/events/onInvocationComplete.tsx | 54 ------------------- 1 file changed, 54 deletions(-) diff --git a/invokeai/frontend/web/src/services/events/onInvocationComplete.tsx b/invokeai/frontend/web/src/services/events/onInvocationComplete.tsx index e554c96616..32720911d5 100644 --- a/invokeai/frontend/web/src/services/events/onInvocationComplete.tsx +++ b/invokeai/frontend/web/src/services/events/onInvocationComplete.tsx @@ -1,19 +1,11 @@ -import { Button } from '@invoke-ai/ui-library'; import { logger } from 'app/logging/logger'; import type { AppDispatch, RootState } from 'app/store/store'; -import { useAppDispatch } from 'app/store/storeHooks'; import type { SerializableObject } from 'common/types'; import { deepClone } from 'common/util/deepClone'; import { stagingAreaImageStaged } from 'features/controlLayers/store/canvasStagingAreaSlice'; -import { $imageViewerState } from 'features/gallery/components/ImageViewer/useImageViewer'; import { boardIdSelected, galleryViewChanged, imageSelected, offsetChanged } from 'features/gallery/store/gallerySlice'; import { $nodeExecutionStates, upsertExecutionState } from 'features/nodes/hooks/useExecutionState'; import { zNodeStatus } from 'features/nodes/types/invocation'; -import { selectShowSendToToasts, showSendToToastsChanged } from 'features/system/store/systemSlice'; -import { toast } from 'features/toast/toast'; -import { selectActiveTab } from 'features/ui/store/uiSelectors'; -import { useCallback } from 'react'; -import { useTranslation } from 'react-i18next'; import { boardsApi } from 'services/api/endpoints/boards'; import { getImageDTO, imagesApi } from 'services/api/endpoints/images'; import type { ImageDTO, S } from 'services/api/types'; @@ -25,22 +17,6 @@ const isCanvasOutputNode = (data: S['InvocationCompleteEvent']) => { return data.invocation_source_id.split(':')[0] === 'canvas_output'; }; -const SEND_TO_TOAST_ID = 'send-to-toast'; - -const DontShowMeTheseToastDescription = () => { - const { t } = useTranslation(); - const dispatch = useAppDispatch(); - const onClick = useCallback(() => { - dispatch(showSendToToastsChanged(false)); - }, [dispatch]); - - return ( - - ); -}; - export const buildOnInvocationComplete = ( getState: () => RootState, dispatch: AppDispatch, @@ -48,32 +24,6 @@ export const buildOnInvocationComplete = ( setLastProgressEvent: (event: S['InvocationDenoiseProgressEvent'] | null) => void, setLastCanvasProgressEvent: (event: S['InvocationDenoiseProgressEvent'] | null) => void ) => { - const toastIfUserIsLost = (destination: string | null) => { - const state = getState(); - const showToasts = selectShowSendToToasts(state); - if (!showToasts) { - return; - } - const tab = selectActiveTab(state); - if (destination === 'canvas' && ($imageViewerState.get() || tab !== 'generation')) { - toast({ - id: SEND_TO_TOAST_ID, - title: 'Image sent to Canvas', - updateDescription: true, - withCount: false, - description: , - }); - } else if (destination !== 'canvas' && !$imageViewerState.get() && tab === 'generation') { - toast({ - id: SEND_TO_TOAST_ID, - title: 'Image sent to Gallery', - updateDescription: true, - withCount: false, - description: , - }); - } - }; - const addImageToGallery = (imageDTO: ImageDTO) => { if (imageDTO.is_intermediate) { return; @@ -160,7 +110,6 @@ export const buildOnInvocationComplete = ( if (imageDTO && !imageDTO.is_intermediate) { addImageToGallery(imageDTO); - toastIfUserIsLost(data.destination); } }; @@ -180,13 +129,11 @@ export const buildOnInvocationComplete = ( dispatch(stagingAreaImageStaged({ stagingAreaImage: { imageDTO, offsetX: 0, offsetY: 0 } })); } addImageToGallery(imageDTO); - toastIfUserIsLost(data.destination); } } else if (!imageDTO.is_intermediate) { // session.mode === 'generate' setLastCanvasProgressEvent(null); addImageToGallery(imageDTO); - toastIfUserIsLost(data.destination); } }; @@ -195,7 +142,6 @@ export const buildOnInvocationComplete = ( if (imageDTO && !imageDTO.is_intermediate) { addImageToGallery(imageDTO); - toastIfUserIsLost(data.destination); } };