disable hotkey for lightbox if lightbox is disabled (#3725)

This commit is contained in:
blessedcoolant 2023-07-11 11:51:54 +12:00 committed by GitHub
commit e06a6bb077
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,6 +38,7 @@ import NodesTab from './tabs/Nodes/NodesTab';
import ResizeHandle from './tabs/ResizeHandle';
import TextToImageTab from './tabs/TextToImage/TextToImageTab';
import UnifiedCanvasTab from './tabs/UnifiedCanvas/UnifiedCanvasTab';
import { useFeatureStatus } from '../../system/hooks/useFeatureStatus';
export interface InvokeTabInfo {
id: InvokeTabName;
@ -107,6 +108,7 @@ const InvokeTabs = () => {
const isLightBoxOpen = useAppSelector(
(state: RootState) => state.lightbox.isLightboxOpen
);
const isLightboxEnabled = useFeatureStatus('lightbox').isFeatureEnabled;
const { shouldPinGallery, shouldPinParametersPanel, shouldShowGallery } =
useAppSelector((state: RootState) => state.ui);
@ -119,7 +121,9 @@ const InvokeTabs = () => {
useHotkeys(
'z',
() => {
dispatch(setIsLightboxOpen(!isLightBoxOpen));
if (isLightboxEnabled) {
dispatch(setIsLightboxOpen(!isLightBoxOpen));
}
},
[isLightBoxOpen]
);