Skip to content

Commit e3e50ab

Browse files
psychedelicioushipsterusername
authored andcommitted
fix(ui): do not show count on layers tab when no layers
1 parent 061bff2 commit e3e50ab

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

invokeai/frontend/web/src/features/controlLayers/components/CanvasRightPanel.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { CanvasSendToToggle } from 'features/controlLayers/components/CanvasSend
77
import { selectSendToCanvas } from 'features/controlLayers/store/canvasSettingsSlice';
88
import { selectEntityCount } from 'features/controlLayers/store/selectors';
99
import GalleryPanelContent from 'features/gallery/components/GalleryPanelContent';
10-
import { memo, useCallback, useRef, useState } from 'react';
10+
import { memo, useCallback, useMemo, useRef, useState } from 'react';
1111
import { useTranslation } from 'react-i18next';
1212

1313
export const CanvasRightPanelContent = memo(() => {
@@ -64,11 +64,19 @@ const PanelTabs = memo(({ setTab }: { setTab: (val: number) => void }) => {
6464
clearTimeout(tabTimeout.current);
6565
}
6666
}, []);
67+
68+
const layersTabLabel = useMemo(() => {
69+
if (entityCount === 0) {
70+
return t('controlLayers.layer_other');
71+
}
72+
return `${t('controlLayers.layer_other')} (${entityCount})`;
73+
}, [entityCount, t]);
74+
6775
return (
6876
<>
6977
<Tab position="relative" onMouseOver={onOnMouseOverLayersTab} onMouseOut={onMouseOut} w={32}>
7078
<Box as="span" w="full">
71-
{t('controlLayers.layer_withCount', { count: entityCount })}
79+
{layersTabLabel}
7280
</Box>
7381
{sendToCanvas && (
7482
<Box position="absolute" top={2} right={2} h={2} w={2} bg="invokeYellow.300" borderRadius="full" />

0 commit comments

Comments
 (0)