From 7b2e6deaf1af9a24041d751b97ec9f997c00adc7 Mon Sep 17 00:00:00 2001 From: Mary Hipp Date: Tue, 12 Sep 2023 16:33:46 -0400 Subject: [PATCH] add toggle for shouldDisableInformationalPopovers --- .../components/IAIInformationalPopover.tsx | 114 ++++++++++-------- .../SettingsModal/SettingsModal.tsx | 13 ++ .../src/features/system/store/systemSlice.ts | 9 ++ 3 files changed, 83 insertions(+), 53 deletions(-) diff --git a/invokeai/frontend/web/src/common/components/IAIInformationalPopover.tsx b/invokeai/frontend/web/src/common/components/IAIInformationalPopover.tsx index 7e58e7e532..8f4e6428db 100644 --- a/invokeai/frontend/web/src/common/components/IAIInformationalPopover.tsx +++ b/invokeai/frontend/web/src/common/components/IAIInformationalPopover.tsx @@ -13,6 +13,8 @@ import { Image, } from '@chakra-ui/react'; import { ReactNode } from 'react'; +import { useAppSelector } from '../../app/store/storeHooks'; +import { systemSelector } from '../../features/system/store/systemSelectors'; interface Props extends PopoverProps { heading: string; @@ -31,68 +33,74 @@ function IAIInformationalPopover({ buttonHref, triggerComponent, }: Props) { - return ( - - -
{triggerComponent}
-
- - - + const { shouldDisableInformationalPopovers } = useAppSelector(systemSelector); - - - {image && ( - Optional Image - )} + if (shouldDisableInformationalPopovers) { + return triggerComponent; + } else { + return ( + + +
{triggerComponent}
+
+ + + + + - {heading} - {paragraph} - {buttonLabel && ( - - - + {image && ( + Optional Image )} + + {heading} + {paragraph} + {buttonLabel && ( + + + + )} + -
-
-
-
- ); + + + + ); + } } export default IAIInformationalPopover; 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 c1d02aed50..2c96df0f1b 100644 --- a/invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsModal.tsx +++ b/invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsModal.tsx @@ -24,6 +24,7 @@ import { consoleLogLevelChanged, setEnableImageDebugging, setShouldConfirmOnDelete, + setShouldDisableInformationalPopovers, shouldAntialiasProgressImageChanged, shouldLogToConsoleChanged, shouldUseNSFWCheckerChanged, @@ -67,6 +68,7 @@ const selector = createSelector( shouldAntialiasProgressImage, shouldUseNSFWChecker, shouldUseWatermarker, + shouldDisableInformationalPopovers, } = system; const { @@ -89,6 +91,7 @@ const selector = createSelector( shouldUseNSFWChecker, shouldUseWatermarker, shouldAutoChangeDimensions, + shouldDisableInformationalPopovers, }; }, { @@ -165,6 +168,7 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => { shouldUseNSFWChecker, shouldUseWatermarker, shouldAutoChangeDimensions, + shouldDisableInformationalPopovers, } = useAppSelector(selector); const handleClickResetWebUI = useCallback(() => { @@ -323,6 +327,15 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => { onChange={handleLanguageChanged} /> )} + ) => + dispatch( + setShouldDisableInformationalPopovers(e.target.checked) + ) + } + /> {shouldShowDeveloperSettings && ( diff --git a/invokeai/frontend/web/src/features/system/store/systemSlice.ts b/invokeai/frontend/web/src/features/system/store/systemSlice.ts index 022762bc78..0e1be08feb 100644 --- a/invokeai/frontend/web/src/features/system/store/systemSlice.ts +++ b/invokeai/frontend/web/src/features/system/store/systemSlice.ts @@ -84,6 +84,7 @@ export interface SystemState { isUploading: boolean; shouldUseNSFWChecker: boolean; shouldUseWatermarker: boolean; + shouldDisableInformationalPopovers: boolean; } export const initialSystemState: SystemState = { @@ -116,6 +117,7 @@ export const initialSystemState: SystemState = { isUploading: false, shouldUseNSFWChecker: false, shouldUseWatermarker: false, + shouldDisableInformationalPopovers: false, }; export const systemSlice = createSlice({ @@ -194,6 +196,12 @@ export const systemSlice = createSlice({ shouldUseWatermarkerChanged(state, action: PayloadAction) { state.shouldUseWatermarker = action.payload; }, + setShouldDisableInformationalPopovers( + state, + action: PayloadAction + ) { + state.shouldDisableInformationalPopovers = action.payload; + }, }, extraReducers(builder) { /** @@ -432,6 +440,7 @@ export const { progressImageSet, shouldUseNSFWCheckerChanged, shouldUseWatermarkerChanged, + setShouldDisableInformationalPopovers, } = systemSlice.actions; export default systemSlice.reducer;