Skip to content

Commit 6b24424

Browse files
feat(ui): add help icon to compare toolbar
1 parent 7153d84 commit 6b24424

File tree

2 files changed

+43
-5
lines changed

2 files changed

+43
-5
lines changed

invokeai/frontend/web/public/locales/en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,11 @@
389389
"swapImages": "Swap Images",
390390
"compareOptions": "Comparison Options",
391391
"stretchToFit": "Stretch to Fit",
392-
"exitCompare": "Exit Compare"
392+
"exitCompare": "Exit Compare",
393+
"compareHelp1": "Hold <Kbd>Alt</Kbd> while clicking a gallery image or using the arrow keys to change the compare image.",
394+
"compareHelp2": "Press <Kbd>M</Kbd> to cycle through comparison modes.",
395+
"compareHelp3": "Press <Kbd>C</Kbd> to swap the compared images.",
396+
"compareHelp4": "Press <Kbd>Z</Kbd> or <Kbd>Esc</Kbd> to exit."
393397
},
394398
"hotkeys": {
395399
"searchHotkeys": "Search Hotkeys",

invokeai/frontend/web/src/features/gallery/components/ImageViewer/CompareToolbar.tsx

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
import { Button, ButtonGroup, Flex, IconButton } from '@invoke-ai/ui-library';
1+
import {
2+
Button,
3+
ButtonGroup,
4+
Flex,
5+
Icon,
6+
IconButton,
7+
Kbd,
8+
ListItem,
9+
Tooltip,
10+
UnorderedList,
11+
} from '@invoke-ai/ui-library';
212
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
313
import {
414
comparedImagesSwapped,
@@ -9,8 +19,8 @@ import {
919
} from 'features/gallery/store/gallerySlice';
1020
import { memo, useCallback } from 'react';
1121
import { useHotkeys } from 'react-hotkeys-hook';
12-
import { useTranslation } from 'react-i18next';
13-
import { PiArrowsOutBold, PiSwapBold, PiXBold } from 'react-icons/pi';
22+
import { Trans, useTranslation } from 'react-i18next';
23+
import { PiArrowsOutBold, PiQuestion, PiSwapBold, PiXBold } from 'react-icons/pi';
1424

1525
export const CompareToolbar = memo(() => {
1626
const { t } = useTranslation();
@@ -90,7 +100,12 @@ export const CompareToolbar = memo(() => {
90100
</ButtonGroup>
91101
</Flex>
92102
<Flex flex={1} justifyContent="center">
93-
<Flex gap={2} marginInlineStart="auto">
103+
<Flex gap={2} marginInlineStart="auto" alignItems="center">
104+
<Tooltip label={<CompareHelp />}>
105+
<Flex alignItems="center">
106+
<Icon boxSize={8} color="base.500" as={PiQuestion} lineHeight={0} />
107+
</Flex>
108+
</Tooltip>
94109
<IconButton
95110
icon={<PiXBold />}
96111
aria-label={`${t('gallery.exitCompare')} (Esc)`}
@@ -104,3 +119,22 @@ export const CompareToolbar = memo(() => {
104119
});
105120

106121
CompareToolbar.displayName = 'CompareToolbar';
122+
123+
const CompareHelp = () => {
124+
return (
125+
<UnorderedList>
126+
<ListItem>
127+
<Trans i18nKey="gallery.compareHelp1" components={{ Kbd: <Kbd /> }}></Trans>
128+
</ListItem>
129+
<ListItem>
130+
<Trans i18nKey="gallery.compareHelp2" components={{ Kbd: <Kbd /> }}></Trans>
131+
</ListItem>
132+
<ListItem>
133+
<Trans i18nKey="gallery.compareHelp3" components={{ Kbd: <Kbd /> }}></Trans>
134+
</ListItem>
135+
<ListItem>
136+
<Trans i18nKey="gallery.compareHelp4" components={{ Kbd: <Kbd /> }}></Trans>
137+
</ListItem>
138+
</UnorderedList>
139+
);
140+
};

0 commit comments

Comments
 (0)