mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
fix(ui): do not show count on layers tab when no layers
This commit is contained in:
committed by
Kent Keirsey
parent
061bff2814
commit
e3e50abc5a
@@ -7,7 +7,7 @@ import { CanvasSendToToggle } from 'features/controlLayers/components/CanvasSend
|
||||
import { selectSendToCanvas } from 'features/controlLayers/store/canvasSettingsSlice';
|
||||
import { selectEntityCount } from 'features/controlLayers/store/selectors';
|
||||
import GalleryPanelContent from 'features/gallery/components/GalleryPanelContent';
|
||||
import { memo, useCallback, useRef, useState } from 'react';
|
||||
import { memo, useCallback, useMemo, useRef, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
export const CanvasRightPanelContent = memo(() => {
|
||||
@@ -64,11 +64,19 @@ const PanelTabs = memo(({ setTab }: { setTab: (val: number) => void }) => {
|
||||
clearTimeout(tabTimeout.current);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const layersTabLabel = useMemo(() => {
|
||||
if (entityCount === 0) {
|
||||
return t('controlLayers.layer_other');
|
||||
}
|
||||
return `${t('controlLayers.layer_other')} (${entityCount})`;
|
||||
}, [entityCount, t]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Tab position="relative" onMouseOver={onOnMouseOverLayersTab} onMouseOut={onMouseOut} w={32}>
|
||||
<Box as="span" w="full">
|
||||
{t('controlLayers.layer_withCount', { count: entityCount })}
|
||||
{layersTabLabel}
|
||||
</Box>
|
||||
{sendToCanvas && (
|
||||
<Box position="absolute" top={2} right={2} h={2} w={2} bg="invokeYellow.300" borderRadius="full" />
|
||||
|
||||
Reference in New Issue
Block a user