mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): add progress image toggle to current image buttons
This commit is contained in:
parent
f1c226b171
commit
070218aba7
@ -526,7 +526,7 @@
|
|||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"models": "Models",
|
"models": "Models",
|
||||||
"displayInProgress": "Display In-Progress Images",
|
"displayInProgress": "Display Progress Images",
|
||||||
"saveSteps": "Save images every n steps",
|
"saveSteps": "Save images every n steps",
|
||||||
"confirmOnDelete": "Confirm On Delete",
|
"confirmOnDelete": "Confirm On Delete",
|
||||||
"displayHelpIcons": "Display Help Icons",
|
"displayHelpIcons": "Display Help Icons",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createSelector } from '@reduxjs/toolkit';
|
import { createSelector } from '@reduxjs/toolkit';
|
||||||
import { isEqual, isString } from 'lodash-es';
|
import { isEqual } from 'lodash-es';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ButtonGroup,
|
ButtonGroup,
|
||||||
@ -25,8 +25,8 @@ import {
|
|||||||
} from 'features/ui/store/uiSelectors';
|
} from 'features/ui/store/uiSelectors';
|
||||||
import {
|
import {
|
||||||
setActiveTab,
|
setActiveTab,
|
||||||
setShouldHidePreview,
|
|
||||||
setShouldShowImageDetails,
|
setShouldShowImageDetails,
|
||||||
|
setShouldShowProgressInViewer,
|
||||||
} from 'features/ui/store/uiSlice';
|
} from 'features/ui/store/uiSlice';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@ -37,18 +37,14 @@ import {
|
|||||||
FaDownload,
|
FaDownload,
|
||||||
FaExpand,
|
FaExpand,
|
||||||
FaExpandArrowsAlt,
|
FaExpandArrowsAlt,
|
||||||
FaEye,
|
|
||||||
FaEyeSlash,
|
|
||||||
FaGrinStars,
|
FaGrinStars,
|
||||||
|
FaHourglassHalf,
|
||||||
FaQuoteRight,
|
FaQuoteRight,
|
||||||
FaSeedling,
|
FaSeedling,
|
||||||
FaShare,
|
FaShare,
|
||||||
FaShareAlt,
|
FaShareAlt,
|
||||||
FaTrash,
|
|
||||||
FaWrench,
|
|
||||||
} from 'react-icons/fa';
|
} from 'react-icons/fa';
|
||||||
import { gallerySelector } from '../store/gallerySelectors';
|
import { gallerySelector } from '../store/gallerySelectors';
|
||||||
import DeleteImageModal from './DeleteImageModal';
|
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvasScale';
|
import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvasScale';
|
||||||
import { useGetUrl } from 'common/util/getUrl';
|
import { useGetUrl } from 'common/util/getUrl';
|
||||||
@ -90,7 +86,11 @@ const currentImageButtonsSelector = createSelector(
|
|||||||
|
|
||||||
const { isLightboxOpen } = lightbox;
|
const { isLightboxOpen } = lightbox;
|
||||||
|
|
||||||
const { shouldShowImageDetails, shouldHidePreview } = ui;
|
const {
|
||||||
|
shouldShowImageDetails,
|
||||||
|
shouldHidePreview,
|
||||||
|
shouldShowProgressInViewer,
|
||||||
|
} = ui;
|
||||||
|
|
||||||
const { selectedImage } = gallery;
|
const { selectedImage } = gallery;
|
||||||
|
|
||||||
@ -112,6 +112,7 @@ const currentImageButtonsSelector = createSelector(
|
|||||||
seed: selectedImage?.metadata?.seed,
|
seed: selectedImage?.metadata?.seed,
|
||||||
prompt: selectedImage?.metadata?.positive_conditioning,
|
prompt: selectedImage?.metadata?.positive_conditioning,
|
||||||
negativePrompt: selectedImage?.metadata?.negative_conditioning,
|
negativePrompt: selectedImage?.metadata?.negative_conditioning,
|
||||||
|
shouldShowProgressInViewer,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -145,6 +146,7 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => {
|
|||||||
image,
|
image,
|
||||||
canDeleteImage,
|
canDeleteImage,
|
||||||
shouldConfirmOnDelete,
|
shouldConfirmOnDelete,
|
||||||
|
shouldShowProgressInViewer,
|
||||||
} = useAppSelector(currentImageButtonsSelector);
|
} = useAppSelector(currentImageButtonsSelector);
|
||||||
|
|
||||||
const isLightboxEnabled = useFeatureStatus('lightbox').isFeatureEnabled;
|
const isLightboxEnabled = useFeatureStatus('lightbox').isFeatureEnabled;
|
||||||
@ -229,10 +231,6 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => {
|
|||||||
});
|
});
|
||||||
}, [toaster, shouldTransformUrls, getUrl, t, image]);
|
}, [toaster, shouldTransformUrls, getUrl, t, image]);
|
||||||
|
|
||||||
const handlePreviewVisibility = useCallback(() => {
|
|
||||||
dispatch(setShouldHidePreview(!shouldHidePreview));
|
|
||||||
}, [dispatch, shouldHidePreview]);
|
|
||||||
|
|
||||||
const handleClickUseAllParameters = useCallback(() => {
|
const handleClickUseAllParameters = useCallback(() => {
|
||||||
recallAllParameters(image);
|
recallAllParameters(image);
|
||||||
}, [image, recallAllParameters]);
|
}, [image, recallAllParameters]);
|
||||||
@ -386,6 +384,10 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => {
|
|||||||
}
|
}
|
||||||
}, [shouldConfirmOnDelete, onDeleteDialogOpen, handleDelete]);
|
}, [shouldConfirmOnDelete, onDeleteDialogOpen, handleDelete]);
|
||||||
|
|
||||||
|
const handleClickProgressImagesToggle = useCallback(() => {
|
||||||
|
dispatch(setShouldShowProgressInViewer(!shouldShowProgressInViewer));
|
||||||
|
}, [dispatch, shouldShowProgressInViewer]);
|
||||||
|
|
||||||
useHotkeys('delete', handleInitiateDelete, [
|
useHotkeys('delete', handleInitiateDelete, [
|
||||||
image,
|
image,
|
||||||
shouldConfirmOnDelete,
|
shouldConfirmOnDelete,
|
||||||
@ -412,8 +414,9 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => {
|
|||||||
<IAIPopover
|
<IAIPopover
|
||||||
triggerComponent={
|
triggerComponent={
|
||||||
<IAIIconButton
|
<IAIIconButton
|
||||||
isDisabled={!image}
|
|
||||||
aria-label={`${t('parameters.sendTo')}...`}
|
aria-label={`${t('parameters.sendTo')}...`}
|
||||||
|
tooltip={`${t('parameters.sendTo')}...`}
|
||||||
|
isDisabled={!image}
|
||||||
icon={<FaShareAlt />}
|
icon={<FaShareAlt />}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
@ -465,21 +468,6 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => {
|
|||||||
</Link>
|
</Link>
|
||||||
</Flex>
|
</Flex>
|
||||||
</IAIPopover>
|
</IAIPopover>
|
||||||
{/* <IAIIconButton
|
|
||||||
icon={shouldHidePreview ? <FaEyeSlash /> : <FaEye />}
|
|
||||||
tooltip={
|
|
||||||
!shouldHidePreview
|
|
||||||
? t('parameters.hidePreview')
|
|
||||||
: t('parameters.showPreview')
|
|
||||||
}
|
|
||||||
aria-label={
|
|
||||||
!shouldHidePreview
|
|
||||||
? t('parameters.hidePreview')
|
|
||||||
: t('parameters.showPreview')
|
|
||||||
}
|
|
||||||
isChecked={shouldHidePreview}
|
|
||||||
onClick={handlePreviewVisibility}
|
|
||||||
/> */}
|
|
||||||
{isLightboxEnabled && (
|
{isLightboxEnabled && (
|
||||||
<IAIIconButton
|
<IAIIconButton
|
||||||
icon={<FaExpand />}
|
icon={<FaExpand />}
|
||||||
@ -604,6 +592,16 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => {
|
|||||||
/>
|
/>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
|
|
||||||
|
<ButtonGroup isAttached={true}>
|
||||||
|
<IAIIconButton
|
||||||
|
aria-label={t('settings.displayInProgress')}
|
||||||
|
tooltip={t('settings.displayInProgress')}
|
||||||
|
icon={<FaHourglassHalf />}
|
||||||
|
isChecked={shouldShowProgressInViewer}
|
||||||
|
onClick={handleClickProgressImagesToggle}
|
||||||
|
/>
|
||||||
|
</ButtonGroup>
|
||||||
|
|
||||||
<ButtonGroup isAttached={true}>
|
<ButtonGroup isAttached={true}>
|
||||||
<DeleteImageButton image={image} />
|
<DeleteImageButton image={image} />
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user