mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Add dynamic label to delete button located at the top toolbar
This commit is contained in:
parent
7899149144
commit
982e255878
@ -13,13 +13,17 @@ export const DeleteImageButton = memo((props: DeleteImageButtonProps) => {
|
|||||||
const { onClick, isDisabled } = props;
|
const { onClick, isDisabled } = props;
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const isConnected = useAppSelector((s) => s.system.isConnected);
|
const isConnected = useAppSelector((s) => s.system.isConnected);
|
||||||
|
const imageSelectionLength: number = (useAppSelector((s) => s.gallery.selection) || []).length;
|
||||||
|
const labelMessage: string = imageSelectionLength > 1 ?
|
||||||
|
t('gallery.deleteImage_plural', { 'count': imageSelectionLength }) :
|
||||||
|
t('gallery.deleteImage');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
icon={<PiTrashSimpleBold />}
|
icon={<PiTrashSimpleBold />}
|
||||||
tooltip={`${t('gallery.deleteImage')} (Del)`}
|
tooltip={labelMessage}
|
||||||
aria-label={`${t('gallery.deleteImage')} (Del)`}
|
aria-label={labelMessage}
|
||||||
isDisabled={isDisabled || !isConnected}
|
isDisabled={isDisabled || !isConnected}
|
||||||
colorScheme="error"
|
colorScheme="error"
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user