From 9ee7cad613c8e5fd4982095b3ed5d1593fabf729 Mon Sep 17 00:00:00 2001
From: psychedelicious <4822129+psychedelicious@users.noreply.github.com>
Date: Tue, 30 Apr 2024 10:48:35 +1000
Subject: [PATCH] feat(ui): make control layer ui exclusive to txt2img tab
---
.../src/features/ui/components/InvokeTabs.tsx | 16 ++++-
.../ui/components/ParametersPanel.tsx | 35 ++--------
.../components/ParametersPanelTextToImage.tsx | 70 +++++++++++++++++++
.../ui/components/tabs/ImageToImageTab.tsx | 10 ++-
.../ui/components/tabs/TextToImageTab.tsx | 2 +-
5 files changed, 100 insertions(+), 33 deletions(-)
create mode 100644 invokeai/frontend/web/src/features/ui/components/ParametersPanelTextToImage.tsx
diff --git a/invokeai/frontend/web/src/features/ui/components/InvokeTabs.tsx b/invokeai/frontend/web/src/features/ui/components/InvokeTabs.tsx
index cb49696dbf..9ac5324d41 100644
--- a/invokeai/frontend/web/src/features/ui/components/InvokeTabs.tsx
+++ b/invokeai/frontend/web/src/features/ui/components/InvokeTabs.tsx
@@ -11,6 +11,7 @@ import StatusIndicator from 'features/system/components/StatusIndicator';
import { selectConfigSlice } from 'features/system/store/configSlice';
import FloatingGalleryButton from 'features/ui/components/FloatingGalleryButton';
import FloatingParametersPanelButtons from 'features/ui/components/FloatingParametersPanelButtons';
+import ParametersPanelTextToImage from 'features/ui/components/ParametersPanelTextToImage';
import type { UsePanelOptions } from 'features/ui/hooks/usePanel';
import { usePanel } from 'features/ui/hooks/usePanel';
import { usePanelStorage } from 'features/ui/hooks/usePanelStorage';
@@ -249,7 +250,7 @@ const InvokeTabs = () => {
onExpand={optionsPanel.onExpand}
collapsible
>
- {activeTabName === 'nodes' ? : }
+
{
};
export default memo(InvokeTabs);
+
+const ParametersPanelComponent = memo(() => {
+ const activeTabName = useAppSelector(activeTabNameSelector);
+
+ if (activeTabName === 'nodes') {
+ return ;
+ }
+ if (activeTabName === 'txt2img') {
+ return ;
+ }
+ return ;
+});
+ParametersPanelComponent.displayName = 'ParametersPanelComponent';
diff --git a/invokeai/frontend/web/src/features/ui/components/ParametersPanel.tsx b/invokeai/frontend/web/src/features/ui/components/ParametersPanel.tsx
index bd76f5c924..b8d35976e3 100644
--- a/invokeai/frontend/web/src/features/ui/components/ParametersPanel.tsx
+++ b/invokeai/frontend/web/src/features/ui/components/ParametersPanel.tsx
@@ -1,10 +1,8 @@
-import { Box, Flex, Tab, TabList, TabPanel, TabPanels, Tabs } from '@invoke-ai/ui-library';
+import { Box, Flex } from '@invoke-ai/ui-library';
import { useAppSelector } from 'app/store/storeHooks';
import { overlayScrollbarsParams } from 'common/components/OverlayScrollbars/constants';
import { Prompts } from 'features/parameters/components/Prompts/Prompts';
import QueueControls from 'features/queue/components/QueueControls';
-import { RegionalPromptsPanelContent } from 'features/regionalPrompts/components/RegionalPromptsPanelContent';
-import { useRegionalControlTitle } from 'features/regionalPrompts/hooks/useRegionalControlTitle';
import { SDXLPrompts } from 'features/sdxl/components/SDXLPrompts/SDXLPrompts';
import { AdvancedSettingsAccordion } from 'features/settingsAccordions/components/AdvancedSettingsAccordion/AdvancedSettingsAccordion';
import { CompositingSettingsAccordion } from 'features/settingsAccordions/components/CompositingSettingsAccordion/CompositingSettingsAccordion';
@@ -16,7 +14,6 @@ import { activeTabNameSelector } from 'features/ui/store/uiSelectors';
import { OverlayScrollbarsComponent } from 'overlayscrollbars-react';
import type { CSSProperties } from 'react';
import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
const overlayScrollbarsStyles: CSSProperties = {
height: '100%',
@@ -24,9 +21,7 @@ const overlayScrollbarsStyles: CSSProperties = {
};
const ParametersPanel = () => {
- const { t } = useTranslation();
const activeTabName = useAppSelector(activeTabNameSelector);
- const regionalControlTitle = useRegionalControlTitle();
const isSDXL = useAppSelector((s) => s.generation.model?.base === 'sdxl');
return (
@@ -37,28 +32,12 @@ const ParametersPanel = () => {
{isSDXL ? : }
-
-
- {t('parameters.globalSettings')}
- {regionalControlTitle}
-
-
-
-
-
-
-
- {activeTabName !== 'txt2img' && }
- {activeTabName === 'unifiedCanvas' && }
- {isSDXL && }
-
-
-
-
-
-
-
-
+
+
+ {activeTabName !== 'txt2img' && }
+ {activeTabName === 'unifiedCanvas' && }
+ {isSDXL && }
+
diff --git a/invokeai/frontend/web/src/features/ui/components/ParametersPanelTextToImage.tsx b/invokeai/frontend/web/src/features/ui/components/ParametersPanelTextToImage.tsx
new file mode 100644
index 0000000000..d8a4a6fec4
--- /dev/null
+++ b/invokeai/frontend/web/src/features/ui/components/ParametersPanelTextToImage.tsx
@@ -0,0 +1,70 @@
+import { Box, Flex, Tab, TabList, TabPanel, TabPanels, Tabs } from '@invoke-ai/ui-library';
+import { useAppSelector } from 'app/store/storeHooks';
+import { overlayScrollbarsParams } from 'common/components/OverlayScrollbars/constants';
+import { Prompts } from 'features/parameters/components/Prompts/Prompts';
+import QueueControls from 'features/queue/components/QueueControls';
+import { RegionalPromptsPanelContent } from 'features/regionalPrompts/components/RegionalPromptsPanelContent';
+import { useRegionalControlTitle } from 'features/regionalPrompts/hooks/useRegionalControlTitle';
+import { SDXLPrompts } from 'features/sdxl/components/SDXLPrompts/SDXLPrompts';
+import { AdvancedSettingsAccordion } from 'features/settingsAccordions/components/AdvancedSettingsAccordion/AdvancedSettingsAccordion';
+import { CompositingSettingsAccordion } from 'features/settingsAccordions/components/CompositingSettingsAccordion/CompositingSettingsAccordion';
+import { ControlSettingsAccordion } from 'features/settingsAccordions/components/ControlSettingsAccordion/ControlSettingsAccordion';
+import { GenerationSettingsAccordion } from 'features/settingsAccordions/components/GenerationSettingsAccordion/GenerationSettingsAccordion';
+import { ImageSettingsAccordion } from 'features/settingsAccordions/components/ImageSettingsAccordion/ImageSettingsAccordion';
+import { RefinerSettingsAccordion } from 'features/settingsAccordions/components/RefinerSettingsAccordion/RefinerSettingsAccordion';
+import { activeTabNameSelector } from 'features/ui/store/uiSelectors';
+import { OverlayScrollbarsComponent } from 'overlayscrollbars-react';
+import type { CSSProperties } from 'react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+const overlayScrollbarsStyles: CSSProperties = {
+ height: '100%',
+ width: '100%',
+};
+
+const ParametersPanelTextToImage = () => {
+ const { t } = useTranslation();
+ const activeTabName = useAppSelector(activeTabNameSelector);
+ const regionalControlTitle = useRegionalControlTitle();
+ const isSDXL = useAppSelector((s) => s.generation.model?.base === 'sdxl');
+
+ return (
+
+
+
+
+
+
+ {isSDXL ? : }
+
+
+ {t('parameters.globalSettings')}
+ {regionalControlTitle}
+
+
+
+
+
+
+
+ {activeTabName !== 'txt2img' && }
+ {activeTabName === 'unifiedCanvas' && }
+ {isSDXL && }
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default memo(ParametersPanelTextToImage);
diff --git a/invokeai/frontend/web/src/features/ui/components/tabs/ImageToImageTab.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/ImageToImageTab.tsx
index dcacdbdff4..07e87d202c 100644
--- a/invokeai/frontend/web/src/features/ui/components/tabs/ImageToImageTab.tsx
+++ b/invokeai/frontend/web/src/features/ui/components/tabs/ImageToImageTab.tsx
@@ -1,7 +1,7 @@
-import { Box } from '@invoke-ai/ui-library';
+import { Box, Flex } from '@invoke-ai/ui-library';
+import CurrentImageDisplay from 'features/gallery/components/CurrentImage/CurrentImageDisplay';
import InitialImageDisplay from 'features/parameters/components/ImageToImage/InitialImageDisplay';
import ResizeHandle from 'features/ui/components/tabs/ResizeHandle';
-import TextToImageTabMain from 'features/ui/components/tabs/TextToImageTab';
import { usePanelStorage } from 'features/ui/hooks/usePanelStorage';
import type { CSSProperties } from 'react';
import { memo, useCallback, useRef } from 'react';
@@ -42,7 +42,11 @@ const ImageToImageTab = () => {
-
+
+
+
+
+
diff --git a/invokeai/frontend/web/src/features/ui/components/tabs/TextToImageTab.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/TextToImageTab.tsx
index 2a79c9b9d1..082445fbb3 100644
--- a/invokeai/frontend/web/src/features/ui/components/tabs/TextToImageTab.tsx
+++ b/invokeai/frontend/web/src/features/ui/components/tabs/TextToImageTab.tsx
@@ -10,7 +10,7 @@ const TextToImageTab = () => {
const regionalControlTitle = useRegionalControlTitle();
return (
-
+
{t('common.viewer')}