diff --git a/invokeai/frontend/web/public/locales/en.json b/invokeai/frontend/web/public/locales/en.json index 2dcd94211f..f932e2f8a7 100644 --- a/invokeai/frontend/web/public/locales/en.json +++ b/invokeai/frontend/web/public/locales/en.json @@ -2035,6 +2035,7 @@ "events": "Events", "queue": "Queue", "metadata": "Metadata" - } + }, + "showSendingToAlerts": "Alert When Sending to Different View" } } diff --git a/invokeai/frontend/web/src/features/controlLayers/components/HUD/CanvasSendingToGalleryAlert.tsx b/invokeai/frontend/web/src/features/controlLayers/components/HUD/CanvasSendingToGalleryAlert.tsx index d614904994..d38b60c49e 100644 --- a/invokeai/frontend/web/src/features/controlLayers/components/HUD/CanvasSendingToGalleryAlert.tsx +++ b/invokeai/frontend/web/src/features/controlLayers/components/HUD/CanvasSendingToGalleryAlert.tsx @@ -17,7 +17,7 @@ import { } from 'features/controlLayers/components/CanvasRightPanel'; import { useImageViewer } from 'features/gallery/components/ImageViewer/useImageViewer'; import { useCurrentDestination } from 'features/queue/hooks/useCurrentDestination'; -import { selectShowSendToAlerts, showSendToAlertsChanged } from 'features/system/store/systemSlice'; +import { selectShowSendingToAlerts, showSendingToAlertsChanged } from 'features/system/store/systemSlice'; import { setActiveTab } from 'features/ui/store/uiSlice'; import { AnimatePresence, motion } from 'framer-motion'; import type { PropsWithChildren, ReactNode } from 'react'; @@ -116,10 +116,10 @@ const AlertWrapper = ({ }) => { const { t } = useTranslation(); const dispatch = useAppDispatch(); - const showSendToAlerts = useAppSelector(selectShowSendToAlerts); + const showSendToAlerts = useAppSelector(selectShowSendingToAlerts); const isHovered = useBoolean(false); const onClickDontShowMeThese = useCallback(() => { - dispatch(showSendToAlertsChanged(false)); + dispatch(showSendingToAlertsChanged(false)); isHovered.setFalse(); }, [dispatch, isHovered]); diff --git a/invokeai/frontend/web/src/features/gallery/components/ImageViewer/useImageViewer.ts b/invokeai/frontend/web/src/features/gallery/components/ImageViewer/useImageViewer.ts index f4aa3be068..732a156e97 100644 --- a/invokeai/frontend/web/src/features/gallery/components/ImageViewer/useImageViewer.ts +++ b/invokeai/frontend/web/src/features/gallery/components/ImageViewer/useImageViewer.ts @@ -1,10 +1,7 @@ import { buildUseBoolean } from 'common/hooks/useBoolean'; import { useMemo } from 'react'; -const hook = buildUseBoolean(true); -const useImageViewerState = hook[0]; - -export const $imageViewerState = hook[1]; +const [useImageViewerState, $imageViewerState] = buildUseBoolean(true); export const useImageViewer = () => { const imageViewerState = useImageViewerState(); diff --git a/invokeai/frontend/web/src/features/queue/hooks/useCurrentDestination.ts b/invokeai/frontend/web/src/features/queue/hooks/useCurrentDestination.ts index 33b37e0577..773d966634 100644 --- a/invokeai/frontend/web/src/features/queue/hooks/useCurrentDestination.ts +++ b/invokeai/frontend/web/src/features/queue/hooks/useCurrentDestination.ts @@ -1,5 +1,4 @@ -import { useGetCurrentQueueItemQuery } from "services/api/endpoints/queue"; - +import { useGetCurrentQueueItemQuery } from 'services/api/endpoints/queue'; export const useCurrentDestination = () => { const { destination } = useGetCurrentQueueItemQuery(undefined, { diff --git a/invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsModal.tsx b/invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsModal.tsx index 4837c7ad6f..bfb02998c7 100644 --- a/invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsModal.tsx +++ b/invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsModal.tsx @@ -24,8 +24,7 @@ import { useRefreshAfterResetModal } from 'features/system/components/SettingsMo import { SettingsDeveloperLogIsEnabled } from 'features/system/components/SettingsModal/SettingsDeveloperLogIsEnabled'; import { SettingsDeveloperLogLevel } from 'features/system/components/SettingsModal/SettingsDeveloperLogLevel'; import { SettingsDeveloperLogNamespaces } from 'features/system/components/SettingsModal/SettingsDeveloperLogNamespaces'; -import { SettingsShowSendToToasts } from 'features/system/components/SettingsModal/SettingsShowSendToAlerts'; -import { SettingsShowSendToAlerts } from 'features/system/components/SettingsModal/SettingsShowSendToToasts'; +import { SettingsShowSendingToDifferentViewAlerts } from 'features/system/components/SettingsModal/SettingsShowSendingToDifferentViewAlerts'; import { useClearIntermediates } from 'features/system/components/SettingsModal/useClearIntermediates'; import { StickyScrollable } from 'features/system/components/StickyScrollable'; import { @@ -177,8 +176,7 @@ const SettingsModal = ({ config = defaultConfig }: SettingsModalProps) => { {t('settings.confirmOnDelete')} - - + diff --git a/invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsShowSendToToasts.tsx b/invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsShowSendToToasts.tsx deleted file mode 100644 index 42abc1cbab..0000000000 --- a/invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsShowSendToToasts.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { FormControl, FormLabel, Switch } from '@invoke-ai/ui-library'; -import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; -import { selectShowSendToAlerts, showSendToAlertsChanged } from 'features/system/store/systemSlice'; -import type { ChangeEvent } from 'react'; -import { memo, useCallback } from 'react'; -import { useTranslation } from 'react-i18next'; - -export const SettingsShowSendToAlerts = memo(() => { - const dispatch = useAppDispatch(); - const { t } = useTranslation(); - - const showSendToAlerts = useAppSelector(selectShowSendToAlerts); - const onChange = useCallback( - (e: ChangeEvent) => { - dispatch(showSendToAlertsChanged(e.target.checked)); - }, - [dispatch] - ); - - return ( - - {t('settings.showAlertsIfLost')} - - - ); -}); - -SettingsShowSendToAlerts.displayName = 'SettingsShowSendToAlerts'; diff --git a/invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsShowSendToAlerts.tsx b/invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsShowSendingToDifferentViewAlerts.tsx similarity index 55% rename from invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsShowSendToAlerts.tsx rename to invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsShowSendingToDifferentViewAlerts.tsx index c9f6f26dd2..36bb85aee8 100644 --- a/invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsShowSendToAlerts.tsx +++ b/invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsShowSendingToDifferentViewAlerts.tsx @@ -1,28 +1,28 @@ import { FormControl, FormLabel, Switch } from '@invoke-ai/ui-library'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; -import { selectShowSendToToasts, showSendToToastsChanged } from 'features/system/store/systemSlice'; +import { selectShowSendingToAlerts, showSendingToAlertsChanged } from 'features/system/store/systemSlice'; import type { ChangeEvent } from 'react'; import { memo, useCallback } from 'react'; import { useTranslation } from 'react-i18next'; -export const SettingsShowSendToToasts = memo(() => { +export const SettingsShowSendingToDifferentViewAlerts = memo(() => { const dispatch = useAppDispatch(); const { t } = useTranslation(); - const isChecked = useAppSelector(selectShowSendToToasts); + const isChecked = useAppSelector(selectShowSendingToAlerts); const onChange = useCallback( (e: ChangeEvent) => { - dispatch(showSendToToastsChanged(e.target.checked)); + dispatch(showSendingToAlertsChanged(e.target.checked)); }, [dispatch] ); return ( - {t('settings.showAlertsIfLost')} + {t('system.showSendingToAlerts')} ); }); -SettingsShowSendToToasts.displayName = 'SettingsShowSendToToasts'; +SettingsShowSendingToDifferentViewAlerts.displayName = 'SettingsShowSendingToDifferentViewAlerts'; diff --git a/invokeai/frontend/web/src/features/system/store/systemSlice.ts b/invokeai/frontend/web/src/features/system/store/systemSlice.ts index a31a84f3de..f229cd649e 100644 --- a/invokeai/frontend/web/src/features/system/store/systemSlice.ts +++ b/invokeai/frontend/web/src/features/system/store/systemSlice.ts @@ -19,8 +19,7 @@ const initialSystemState: SystemState = { logIsEnabled: true, logLevel: 'debug', logNamespaces: [...zLogNamespace.options], - showSendToAlerts: true, - showSendToToasts: true, + showSendingToDifferentViewAlerts: true, }; export const systemSlice = createSlice({ @@ -58,11 +57,8 @@ export const systemSlice = createSlice({ setShouldEnableInformationalPopovers(state, action: PayloadAction) { state.shouldEnableInformationalPopovers = action.payload; }, - showSendToAlertsChanged: (state, action: PayloadAction) => { - state.showSendToAlerts = action.payload; - }, - showSendToToastsChanged: (state, action: PayloadAction) => { - state.showSendToToasts = action.payload; + showSendingToAlertsChanged: (state, action: PayloadAction) => { + state.showSendingToDifferentViewAlerts = action.payload; }, }, }); @@ -77,8 +73,7 @@ export const { shouldUseNSFWCheckerChanged, shouldUseWatermarkerChanged, setShouldEnableInformationalPopovers, - showSendToAlertsChanged, - showSendToToastsChanged, + showSendingToAlertsChanged, } = systemSlice.actions; /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ @@ -113,5 +108,4 @@ export const selectSystemShouldAntialiasProgressImage = createSystemSelector( export const selectSystemShouldEnableInformationalPopovers = createSystemSelector( (system) => system.shouldEnableInformationalPopovers ); -export const selectShowSendToAlerts = createSystemSelector((s) => s.showSendToAlerts); -export const selectShowSendToToasts = createSystemSelector((s) => s.showSendToToasts); +export const selectShowSendingToAlerts = createSystemSelector((s) => s.showSendingToDifferentViewAlerts); diff --git a/invokeai/frontend/web/src/features/system/store/types.ts b/invokeai/frontend/web/src/features/system/store/types.ts index 5860a56770..d783643f56 100644 --- a/invokeai/frontend/web/src/features/system/store/types.ts +++ b/invokeai/frontend/web/src/features/system/store/types.ts @@ -39,6 +39,5 @@ export interface SystemState { logIsEnabled: boolean; logLevel: LogLevel; logNamespaces: LogNamespace[]; - showSendToAlerts: boolean; - showSendToToasts: boolean; + showSendingToDifferentViewAlerts: boolean; }