Skip to content

Commit a071f27

Browse files
Mary Hippmaryhipp
authored andcommitted
fix(ui): upload tooltip should only show plural if multiple upload is an option
1 parent d9a257e commit a071f27

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

invokeai/frontend/web/src/features/gallery/components/GalleryUploadButton.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
11
import { IconButton } from '@invoke-ai/ui-library';
2+
import { useAppSelector } from 'app/store/storeHooks';
23
import { useImageUploadButton } from 'common/hooks/useImageUploadButton';
4+
import { selectMaxImageUploadCount } from 'features/system/store/configSlice';
35
import { t } from 'i18next';
46
import { PiUploadBold } from 'react-icons/pi';
57

68
const options = { postUploadAction: { type: 'TOAST' }, allowMultiple: true } as const;
79

810
export const GalleryUploadButton = () => {
911
const uploadApi = useImageUploadButton(options);
12+
const maxImageUploadCount = useAppSelector(selectMaxImageUploadCount);
1013
return (
1114
<>
1215
<IconButton
1316
size="sm"
1417
alignSelf="stretch"
1518
variant="link"
16-
aria-label={t('accessibility.uploadImages')}
17-
tooltip={t('accessibility.uploadImages')}
19+
aria-label={
20+
maxImageUploadCount === undefined || maxImageUploadCount > 1
21+
? t('accessibility.uploadImages')
22+
: t('accessibility.uploadImage')
23+
}
24+
tooltip={
25+
maxImageUploadCount === undefined || maxImageUploadCount > 1
26+
? t('accessibility.uploadImages')
27+
: t('accessibility.uploadImage')
28+
}
1829
icon={<PiUploadBold />}
1930
{...uploadApi.getUploadButtonProps()}
2031
/>

0 commit comments

Comments
 (0)