Skip to content

Commit 070218a

Browse files
psychedelicioushipsterusername
authored andcommitted
feat(ui): add progress image toggle to current image buttons
1 parent f1c226b commit 070218a

File tree

2 files changed

+27
-29
lines changed

2 files changed

+27
-29
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@
526526
},
527527
"settings": {
528528
"models": "Models",
529-
"displayInProgress": "Display In-Progress Images",
529+
"displayInProgress": "Display Progress Images",
530530
"saveSteps": "Save images every n steps",
531531
"confirmOnDelete": "Confirm On Delete",
532532
"displayHelpIcons": "Display Help Icons",

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

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createSelector } from '@reduxjs/toolkit';
2-
import { isEqual, isString } from 'lodash-es';
2+
import { isEqual } from 'lodash-es';
33

44
import {
55
ButtonGroup,
@@ -25,8 +25,8 @@ import {
2525
} from 'features/ui/store/uiSelectors';
2626
import {
2727
setActiveTab,
28-
setShouldHidePreview,
2928
setShouldShowImageDetails,
29+
setShouldShowProgressInViewer,
3030
} from 'features/ui/store/uiSlice';
3131
import { useHotkeys } from 'react-hotkeys-hook';
3232
import { useTranslation } from 'react-i18next';
@@ -37,18 +37,14 @@ import {
3737
FaDownload,
3838
FaExpand,
3939
FaExpandArrowsAlt,
40-
FaEye,
41-
FaEyeSlash,
4240
FaGrinStars,
41+
FaHourglassHalf,
4342
FaQuoteRight,
4443
FaSeedling,
4544
FaShare,
4645
FaShareAlt,
47-
FaTrash,
48-
FaWrench,
4946
} from 'react-icons/fa';
5047
import { gallerySelector } from '../store/gallerySelectors';
51-
import DeleteImageModal from './DeleteImageModal';
5248
import { useCallback } from 'react';
5349
import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvasScale';
5450
import { useGetUrl } from 'common/util/getUrl';
@@ -90,7 +86,11 @@ const currentImageButtonsSelector = createSelector(
9086

9187
const { isLightboxOpen } = lightbox;
9288

93-
const { shouldShowImageDetails, shouldHidePreview } = ui;
89+
const {
90+
shouldShowImageDetails,
91+
shouldHidePreview,
92+
shouldShowProgressInViewer,
93+
} = ui;
9494

9595
const { selectedImage } = gallery;
9696

@@ -112,6 +112,7 @@ const currentImageButtonsSelector = createSelector(
112112
seed: selectedImage?.metadata?.seed,
113113
prompt: selectedImage?.metadata?.positive_conditioning,
114114
negativePrompt: selectedImage?.metadata?.negative_conditioning,
115+
shouldShowProgressInViewer,
115116
};
116117
},
117118
{
@@ -145,6 +146,7 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => {
145146
image,
146147
canDeleteImage,
147148
shouldConfirmOnDelete,
149+
shouldShowProgressInViewer,
148150
} = useAppSelector(currentImageButtonsSelector);
149151

150152
const isLightboxEnabled = useFeatureStatus('lightbox').isFeatureEnabled;
@@ -229,10 +231,6 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => {
229231
});
230232
}, [toaster, shouldTransformUrls, getUrl, t, image]);
231233

232-
const handlePreviewVisibility = useCallback(() => {
233-
dispatch(setShouldHidePreview(!shouldHidePreview));
234-
}, [dispatch, shouldHidePreview]);
235-
236234
const handleClickUseAllParameters = useCallback(() => {
237235
recallAllParameters(image);
238236
}, [image, recallAllParameters]);
@@ -386,6 +384,10 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => {
386384
}
387385
}, [shouldConfirmOnDelete, onDeleteDialogOpen, handleDelete]);
388386

387+
const handleClickProgressImagesToggle = useCallback(() => {
388+
dispatch(setShouldShowProgressInViewer(!shouldShowProgressInViewer));
389+
}, [dispatch, shouldShowProgressInViewer]);
390+
389391
useHotkeys('delete', handleInitiateDelete, [
390392
image,
391393
shouldConfirmOnDelete,
@@ -412,8 +414,9 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => {
412414
<IAIPopover
413415
triggerComponent={
414416
<IAIIconButton
415-
isDisabled={!image}
416417
aria-label={`${t('parameters.sendTo')}...`}
418+
tooltip={`${t('parameters.sendTo')}...`}
419+
isDisabled={!image}
417420
icon={<FaShareAlt />}
418421
/>
419422
}
@@ -465,21 +468,6 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => {
465468
</Link>
466469
</Flex>
467470
</IAIPopover>
468-
{/* <IAIIconButton
469-
icon={shouldHidePreview ? <FaEyeSlash /> : <FaEye />}
470-
tooltip={
471-
!shouldHidePreview
472-
? t('parameters.hidePreview')
473-
: t('parameters.showPreview')
474-
}
475-
aria-label={
476-
!shouldHidePreview
477-
? t('parameters.hidePreview')
478-
: t('parameters.showPreview')
479-
}
480-
isChecked={shouldHidePreview}
481-
onClick={handlePreviewVisibility}
482-
/> */}
483471
{isLightboxEnabled && (
484472
<IAIIconButton
485473
icon={<FaExpand />}
@@ -604,6 +592,16 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => {
604592
/>
605593
</ButtonGroup>
606594

595+
<ButtonGroup isAttached={true}>
596+
<IAIIconButton
597+
aria-label={t('settings.displayInProgress')}
598+
tooltip={t('settings.displayInProgress')}
599+
icon={<FaHourglassHalf />}
600+
isChecked={shouldShowProgressInViewer}
601+
onClick={handleClickProgressImagesToggle}
602+
/>
603+
</ButtonGroup>
604+
607605
<ButtonGroup isAttached={true}>
608606
<DeleteImageButton image={image} />
609607
</ButtonGroup>

0 commit comments

Comments
 (0)