Skip to content

Commit e490176

Browse files
feat(ui): less confusing empty state for rg ref images
It was easy to misunderstand the empty state for a regional guidance reference image. There was no label, so it seemed like it was the whole region that was empty. This small change adds the "Reference Image" heading to the empty state, so it's clear that the empty state messaging refers to this reference image, not the whole regional guidance layer.
1 parent 159b00a commit e490176

File tree

1 file changed

+39
-22
lines changed

1 file changed

+39
-22
lines changed

invokeai/frontend/web/src/features/controlLayers/components/RegionalGuidance/RegionalGuidanceIPAdapterSettingsEmptyState.tsx

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { Button, Flex, Text } from '@invoke-ai/ui-library';
1+
import { Button, Flex, IconButton, Spacer, Text } from '@invoke-ai/ui-library';
22
import { useAppDispatch } from 'app/store/storeHooks';
33
import { useImageUploadButton } from 'common/hooks/useImageUploadButton';
4-
import { RegionalGuidanceDeletePromptButton } from 'features/controlLayers/components/RegionalGuidance/RegionalGuidanceDeletePromptButton';
54
import { useEntityIdentifierContext } from 'features/controlLayers/contexts/EntityIdentifierContext';
65
import { useCanvasIsBusy } from 'features/controlLayers/hooks/useCanvasIsBusy';
76
import { rgIPAdapterDeleted } from 'features/controlLayers/store/canvasSlice';
@@ -12,6 +11,7 @@ import { setRegionalGuidanceReferenceImage } from 'features/imageActions/actions
1211
import { activeTabCanvasRightPanelChanged } from 'features/ui/store/uiSlice';
1312
import { memo, useCallback, useMemo } from 'react';
1413
import { Trans, useTranslation } from 'react-i18next';
14+
import { PiXBold } from 'react-icons/pi';
1515
import type { ImageDTO } from 'services/api/types';
1616

1717
type Props = {
@@ -47,27 +47,44 @@ export const RegionalGuidanceIPAdapterSettingsEmptyState = memo(({ referenceImag
4747
);
4848

4949
return (
50-
<Flex flexDir="column" gap={3} position="relative" w="full" p={4}>
51-
<RegionalGuidanceDeletePromptButton onDelete={onDeleteIPAdapter} position="absolute" top={0} insetInlineEnd={0} />
52-
<Text textAlign="center" color="base.300">
53-
<Trans
54-
i18nKey="controlLayers.referenceImageEmptyState"
55-
components={{
56-
UploadButton: (
57-
<Button
58-
isDisabled={isBusy}
59-
size="sm"
60-
variant="link"
61-
color="base.300"
62-
{...uploadApi.getUploadButtonProps()}
63-
/>
64-
),
65-
GalleryButton: (
66-
<Button onClick={onClickGalleryButton} isDisabled={isBusy} size="sm" variant="link" color="base.300" />
67-
),
68-
}}
50+
<Flex flexDir="column" gap={2} position="relative" w="full">
51+
<Flex alignItems="center" gap={2}>
52+
<Text fontWeight="semibold" color="base.400">
53+
{t('controlLayers.referenceImage')}
54+
</Text>
55+
<Spacer />
56+
<IconButton
57+
size="sm"
58+
variant="link"
59+
alignSelf="stretch"
60+
icon={<PiXBold />}
61+
tooltip={t('controlLayers.deleteReferenceImage')}
62+
aria-label={t('controlLayers.deleteReferenceImage')}
63+
onClick={onDeleteIPAdapter}
64+
colorScheme="error"
6965
/>
70-
</Text>
66+
</Flex>
67+
<Flex alignItems="center" gap={2} p={4}>
68+
<Text textAlign="center" color="base.300">
69+
<Trans
70+
i18nKey="controlLayers.referenceImageEmptyState"
71+
components={{
72+
UploadButton: (
73+
<Button
74+
isDisabled={isBusy}
75+
size="sm"
76+
variant="link"
77+
color="base.300"
78+
{...uploadApi.getUploadButtonProps()}
79+
/>
80+
),
81+
GalleryButton: (
82+
<Button onClick={onClickGalleryButton} isDisabled={isBusy} size="sm" variant="link" color="base.300" />
83+
),
84+
}}
85+
/>
86+
</Text>
87+
</Flex>
7188
<input {...uploadApi.getUploadInputProps()} />
7289
<DndDropTarget
7390
dndTarget={setRegionalGuidanceReferenceImageDndTarget}

0 commit comments

Comments
 (0)