feat: Make new tab for Model Manager

This commit is contained in:
blessedcoolant 2023-06-26 21:56:18 +12:00 committed by psychedelicious
parent 0bb668b8a8
commit 9e35643911
4 changed files with 54 additions and 36 deletions

View File

@ -53,6 +53,7 @@
"linear": "Linear", "linear": "Linear",
"nodes": "Node Editor", "nodes": "Node Editor",
"batch": "Batch Manager", "batch": "Batch Manager",
"modelmanager": "Model Manager",
"postprocessing": "Post Processing", "postprocessing": "Post Processing",
"nodesDesc": "A node based system for the generation of images is under development currently. Stay tuned for updates about this amazing feature.", "nodesDesc": "A node based system for the generation of images is under development currently. Stay tuned for updates about this amazing feature.",
"postProcessing": "Post Processing", "postProcessing": "Post Processing",

View File

@ -9,35 +9,35 @@ import {
Tooltip, Tooltip,
VisuallyHidden, VisuallyHidden,
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import { createSelector } from '@reduxjs/toolkit';
import AuxiliaryProgressIndicator from 'app/components/AuxiliaryProgressIndicator';
import { RootState } from 'app/store/store'; import { RootState } from 'app/store/store';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvasScale';
import ImageGalleryContent from 'features/gallery/components/ImageGalleryContent';
import { setIsLightboxOpen } from 'features/lightbox/store/lightboxSlice'; import { setIsLightboxOpen } from 'features/lightbox/store/lightboxSlice';
import { configSelector } from 'features/system/store/configSelectors';
import { InvokeTabName } from 'features/ui/store/tabMap'; import { InvokeTabName } from 'features/ui/store/tabMap';
import { setActiveTab, togglePanels } from 'features/ui/store/uiSlice'; import { setActiveTab, togglePanels } from 'features/ui/store/uiSlice';
import { memo, MouseEvent, ReactNode, useCallback, useMemo } from 'react'; import { ResourceKey } from 'i18next';
import { isEqual } from 'lodash-es';
import { MouseEvent, ReactNode, memo, useCallback, useMemo } from 'react';
import { useHotkeys } from 'react-hotkeys-hook'; import { useHotkeys } from 'react-hotkeys-hook';
import { useTranslation } from 'react-i18next';
import { FaCube, FaFont, FaImage } from 'react-icons/fa';
import { MdDeviceHub, MdGridOn } from 'react-icons/md'; import { MdDeviceHub, MdGridOn } from 'react-icons/md';
import { Panel, PanelGroup } from 'react-resizable-panels';
import { useMinimumPanelSize } from '../hooks/useMinimumPanelSize';
import { import {
activeTabIndexSelector, activeTabIndexSelector,
activeTabNameSelector, activeTabNameSelector,
} from '../store/uiSelectors'; } from '../store/uiSelectors';
import { useTranslation } from 'react-i18next'; import ImageTab from './tabs/ImageToImage/ImageToImageTab';
import { ResourceKey } from 'i18next'; import ModelManagerTab from './tabs/ModelManager/ModelManagerTab';
import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvasScale'; import NodesTab from './tabs/Nodes/NodesTab';
import { createSelector } from '@reduxjs/toolkit'; import ResizeHandle from './tabs/ResizeHandle';
import { configSelector } from 'features/system/store/configSelectors';
import { isEqual } from 'lodash-es';
import { Panel, PanelGroup } from 'react-resizable-panels';
import ImageGalleryContent from 'features/gallery/components/ImageGalleryContent';
import TextToImageTab from './tabs/TextToImage/TextToImageTab'; import TextToImageTab from './tabs/TextToImage/TextToImageTab';
import UnifiedCanvasTab from './tabs/UnifiedCanvas/UnifiedCanvasTab'; import UnifiedCanvasTab from './tabs/UnifiedCanvas/UnifiedCanvasTab';
import NodesTab from './tabs/Nodes/NodesTab';
import { FaFont, FaImage, FaLayerGroup } from 'react-icons/fa';
import ResizeHandle from './tabs/ResizeHandle';
import ImageTab from './tabs/ImageToImage/ImageToImageTab';
import AuxiliaryProgressIndicator from 'app/components/AuxiliaryProgressIndicator';
import { useMinimumPanelSize } from '../hooks/useMinimumPanelSize';
import BatchTab from './tabs/Batch/BatchTab';
export interface InvokeTabInfo { export interface InvokeTabInfo {
id: InvokeTabName; id: InvokeTabName;
@ -71,6 +71,11 @@ const tabs: InvokeTabInfo[] = [
// icon: <Icon as={FaLayerGroup} sx={{ boxSize: 6, pointerEvents: 'none' }} />, // icon: <Icon as={FaLayerGroup} sx={{ boxSize: 6, pointerEvents: 'none' }} />,
// content: <BatchTab />, // content: <BatchTab />,
// }, // },
{
id: 'modelmanager',
icon: <Icon as={FaCube} sx={{ boxSize: 6, pointerEvents: 'none' }} />,
content: <ModelManagerTab />,
},
]; ];
const enabledTabsSelector = createSelector( const enabledTabsSelector = createSelector(
@ -96,6 +101,8 @@ const InvokeTabs = () => {
(state: RootState) => state.lightbox.isLightboxOpen (state: RootState) => state.lightbox.isLightboxOpen
); );
const noGalleryTabs: InvokeTabName[] = ['modelmanager'];
const { shouldPinGallery, shouldPinParametersPanel, shouldShowGallery } = const { shouldPinGallery, shouldPinParametersPanel, shouldShowGallery } =
useAppSelector((state: RootState) => state.ui); useAppSelector((state: RootState) => state.ui);
@ -198,7 +205,9 @@ const InvokeTabs = () => {
{tabPanels} {tabPanels}
</TabPanels> </TabPanels>
</Panel> </Panel>
{shouldPinGallery && shouldShowGallery && ( {shouldPinGallery &&
shouldShowGallery &&
!noGalleryTabs.includes(activeTabName) && (
<> <>
<ResizeHandle /> <ResizeHandle />
<Panel <Panel

View File

@ -0,0 +1,7 @@
import { memo } from 'react';
const ModelManagerTab = () => {
return 'Model Manager';
};
export default memo(ModelManagerTab);

View File

@ -7,6 +7,7 @@ export const tabMap = [
'batch', 'batch',
// 'postprocessing', // 'postprocessing',
// 'training', // 'training',
'modelmanager',
] as const; ] as const;
export type InvokeTabName = (typeof tabMap)[number]; export type InvokeTabName = (typeof tabMap)[number];