Skip to content

Commit 6f4850f

Browse files
tidy(ui): launchpad tab with icon cleanup
1 parent 072cd9d commit 6f4850f

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

invokeai/frontend/web/src/features/ui/layouts/TabWithLaunchpadIcon.tsx

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { Flex, Text } from '@invoke-ai/ui-library';
1+
import { Flex, Icon, Text } from '@invoke-ai/ui-library';
22
import { useAppSelector } from 'app/store/storeHooks';
33
import { useCallbackOnDragEnter } from 'common/hooks/useCallbackOnDragEnter';
44
import type { IDockviewPanelHeaderProps } from 'dockview';
55
import { selectActiveTab } from 'features/ui/store/uiSelectors';
66
import type { TabName } from 'features/ui/store/uiTypes';
77
import { memo, useCallback, useRef } from 'react';
8+
import type { IconType } from 'react-icons';
89
import {
910
PiBoundingBoxBold,
1011
PiCubeBold,
@@ -14,13 +15,13 @@ import {
1415
PiTextAaBold,
1516
} from 'react-icons/pi';
1617

17-
const TAB_ICONS: Record<TabName, React.ReactElement> = {
18-
generate: <PiTextAaBold />,
19-
canvas: <PiBoundingBoxBold />,
20-
upscaling: <PiFrameCornersBold />,
21-
workflows: <PiFlowArrowBold />,
22-
models: <PiCubeBold />,
23-
queue: <PiQueueBold />,
18+
const TAB_ICONS: Record<TabName, IconType> = {
19+
generate: PiTextAaBold,
20+
canvas: PiBoundingBoxBold,
21+
upscaling: PiFrameCornersBold,
22+
workflows: PiFlowArrowBold,
23+
models: PiCubeBold,
24+
queue: PiQueueBold,
2425
};
2526

2627
export const TabWithLaunchpadIcon = memo((props: IDockviewPanelHeaderProps) => {
@@ -35,20 +36,10 @@ export const TabWithLaunchpadIcon = memo((props: IDockviewPanelHeaderProps) => {
3536

3637
useCallbackOnDragEnter(setActive, ref, 300);
3738

38-
// Show icon only for Launchpad panel
39-
const isLaunchpadPanel = props.api.id === 'launchpad';
40-
const currentTabIcon = TAB_ICONS[activeTab];
41-
4239
return (
43-
<Flex ref={ref} alignItems="center" h="full">
44-
{isLaunchpadPanel && currentTabIcon && (
45-
<Flex alignItems="center" pl={5} pr={2}>
46-
{currentTabIcon}
47-
</Flex>
48-
)}
49-
<Text userSelect="none" px={isLaunchpadPanel ? 3 : 4}>
50-
{props.api.title ?? props.api.id}
51-
</Text>
40+
<Flex ref={ref} alignItems="center" h="full" px={4} gap={3}>
41+
<Icon as={TAB_ICONS[activeTab]} color="invokeYellow.300" boxSize={5} />
42+
<Text userSelect="none">{props.api.title ?? props.api.id}</Text>
5243
</Flex>
5344
);
5445
});

0 commit comments

Comments
 (0)