Skip to content

Commit a826f8f

Browse files
psychedelicioushipsterusername
authored andcommitted
fix(ui): show total layer count in control layers tab
1 parent b6c19a8 commit a826f8f

File tree

2 files changed

+8
-54
lines changed

2 files changed

+8
-54
lines changed

invokeai/frontend/web/src/features/controlLayers/hooks/useControlLayersTitle.ts

Lines changed: 0 additions & 51 deletions
This file was deleted.

invokeai/frontend/web/src/features/ui/components/ParametersPanelTextToImage.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Box, Flex, Tab, TabList, TabPanel, TabPanels, Tabs } from '@invoke-ai/u
33
import { useAppSelector } from 'app/store/storeHooks';
44
import { overlayScrollbarsParams } from 'common/components/OverlayScrollbars/constants';
55
import { ControlLayersPanelContent } from 'features/controlLayers/components/ControlLayersPanelContent';
6-
import { useControlLayersTitle } from 'features/controlLayers/hooks/useControlLayersTitle';
76
import { Prompts } from 'features/parameters/components/Prompts/Prompts';
87
import QueueControls from 'features/queue/components/QueueControls';
98
import { SDXLPrompts } from 'features/sdxl/components/SDXLPrompts/SDXLPrompts';
@@ -16,7 +15,7 @@ import { RefinerSettingsAccordion } from 'features/settingsAccordions/components
1615
import { activeTabNameSelector } from 'features/ui/store/uiSelectors';
1716
import { OverlayScrollbarsComponent } from 'overlayscrollbars-react';
1817
import type { CSSProperties } from 'react';
19-
import { memo } from 'react';
18+
import { memo, useMemo } from 'react';
2019
import { useTranslation } from 'react-i18next';
2120

2221
const overlayScrollbarsStyles: CSSProperties = {
@@ -39,7 +38,13 @@ const selectedStyles: ChakraProps['sx'] = {
3938
const ParametersPanelTextToImage = () => {
4039
const { t } = useTranslation();
4140
const activeTabName = useAppSelector(activeTabNameSelector);
42-
const controlLayersTitle = useControlLayersTitle();
41+
const controlLayersCount = useAppSelector((s) => s.controlLayers.present.layers.length);
42+
const controlLayersTitle = useMemo(() => {
43+
if (controlLayersCount === 0) {
44+
return t('controlLayers.controlLayers');
45+
}
46+
return `${t('controlLayers.controlLayers')} (${controlLayersCount})`;
47+
}, [controlLayersCount, t]);
4348
const isSDXL = useAppSelector((s) => s.generation.model?.base === 'sdxl');
4449

4550
return (

0 commit comments

Comments
 (0)