mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
rename hidden variable to something more descriptive
This commit is contained in:
parent
e4e48ff995
commit
0d051aaae2
@ -82,7 +82,7 @@ const currentImageButtonsSelector = createSelector(
|
|||||||
|
|
||||||
const { shouldShowImageDetails } = ui;
|
const { shouldShowImageDetails } = ui;
|
||||||
|
|
||||||
const { intermediateImage, currentImage, hidden } = gallery;
|
const { intermediateImage, currentImage, shouldHidePreview } = gallery;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isProcessing,
|
isProcessing,
|
||||||
@ -96,7 +96,7 @@ const currentImageButtonsSelector = createSelector(
|
|||||||
shouldShowImageDetails,
|
shouldShowImageDetails,
|
||||||
activeTabName,
|
activeTabName,
|
||||||
isLightboxOpen,
|
isLightboxOpen,
|
||||||
hidden,
|
shouldHidePreview,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -126,7 +126,7 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => {
|
|||||||
currentImage,
|
currentImage,
|
||||||
isLightboxOpen,
|
isLightboxOpen,
|
||||||
activeTabName,
|
activeTabName,
|
||||||
hidden,
|
shouldHidePreview,
|
||||||
} = useAppSelector(currentImageButtonsSelector);
|
} = useAppSelector(currentImageButtonsSelector);
|
||||||
|
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
@ -196,7 +196,7 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleHiddenChange = () => {
|
const handleHiddenChange = () => {
|
||||||
dispatch(setHiddenState(!hidden));
|
dispatch(setHiddenState(!shouldHidePreview));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClickUseAllParameters = () => {
|
const handleClickUseAllParameters = () => {
|
||||||
@ -467,14 +467,18 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => {
|
|||||||
</Flex>
|
</Flex>
|
||||||
</IAIPopover>
|
</IAIPopover>
|
||||||
<IAIIconButton
|
<IAIIconButton
|
||||||
icon={hidden ? <FaEyeSlash /> : <FaEye />}
|
icon={shouldHidePreview ? <FaEyeSlash /> : <FaEye />}
|
||||||
tooltip={
|
tooltip={
|
||||||
!hidden ? t('parameters.hidePreview') : t('parameters.showPreview')
|
!shouldHidePreview
|
||||||
|
? t('parameters.hidePreview')
|
||||||
|
: t('parameters.showPreview')
|
||||||
}
|
}
|
||||||
aria-label={
|
aria-label={
|
||||||
!hidden ? t('parameters.hidePreview') : t('parameters.showPreview')
|
!shouldHidePreview
|
||||||
|
? t('parameters.hidePreview')
|
||||||
|
: t('parameters.showPreview')
|
||||||
}
|
}
|
||||||
isChecked={hidden}
|
isChecked={shouldHidePreview}
|
||||||
onClick={handleHiddenChange}
|
onClick={handleHiddenChange}
|
||||||
/>
|
/>
|
||||||
<IAIIconButton
|
<IAIIconButton
|
||||||
|
@ -15,14 +15,14 @@ import CurrentImageHidden from './CurrentImageHidden';
|
|||||||
export const imagesSelector = createSelector(
|
export const imagesSelector = createSelector(
|
||||||
[gallerySelector, uiSelector],
|
[gallerySelector, uiSelector],
|
||||||
(gallery: GalleryState, ui) => {
|
(gallery: GalleryState, ui) => {
|
||||||
const { currentImage, intermediateImage, hidden } = gallery;
|
const { currentImage, intermediateImage, shouldHidePreview } = gallery;
|
||||||
const { shouldShowImageDetails } = ui;
|
const { shouldShowImageDetails } = ui;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
imageToDisplay: intermediateImage ? intermediateImage : currentImage,
|
imageToDisplay: intermediateImage ? intermediateImage : currentImage,
|
||||||
isIntermediate: Boolean(intermediateImage),
|
isIntermediate: Boolean(intermediateImage),
|
||||||
shouldShowImageDetails,
|
shouldShowImageDetails,
|
||||||
hidden,
|
shouldHidePreview,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -33,8 +33,12 @@ export const imagesSelector = createSelector(
|
|||||||
);
|
);
|
||||||
|
|
||||||
export default function CurrentImagePreview() {
|
export default function CurrentImagePreview() {
|
||||||
const { shouldShowImageDetails, imageToDisplay, isIntermediate, hidden } =
|
const {
|
||||||
useAppSelector(imagesSelector);
|
shouldShowImageDetails,
|
||||||
|
imageToDisplay,
|
||||||
|
isIntermediate,
|
||||||
|
shouldHidePreview,
|
||||||
|
} = useAppSelector(imagesSelector);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
@ -48,11 +52,11 @@ export default function CurrentImagePreview() {
|
|||||||
>
|
>
|
||||||
{imageToDisplay && (
|
{imageToDisplay && (
|
||||||
<Image
|
<Image
|
||||||
src={hidden ? undefined : imageToDisplay.url}
|
src={shouldHidePreview ? undefined : imageToDisplay.url}
|
||||||
width={imageToDisplay.width}
|
width={imageToDisplay.width}
|
||||||
height={imageToDisplay.height}
|
height={imageToDisplay.height}
|
||||||
fallback={
|
fallback={
|
||||||
hidden ? (
|
shouldHidePreview ? (
|
||||||
<CurrentImageHidden />
|
<CurrentImageHidden />
|
||||||
) : !isIntermediate ? (
|
) : !isIntermediate ? (
|
||||||
<CurrentImageFallback />
|
<CurrentImageFallback />
|
||||||
|
@ -39,7 +39,7 @@ export interface GalleryState {
|
|||||||
currentCategory: GalleryCategory;
|
currentCategory: GalleryCategory;
|
||||||
galleryWidth: number;
|
galleryWidth: number;
|
||||||
shouldUseSingleGalleryColumn: boolean;
|
shouldUseSingleGalleryColumn: boolean;
|
||||||
hidden: boolean;
|
shouldHidePreview: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const initialState: GalleryState = {
|
const initialState: GalleryState = {
|
||||||
@ -64,7 +64,7 @@ const initialState: GalleryState = {
|
|||||||
},
|
},
|
||||||
galleryWidth: 300,
|
galleryWidth: 300,
|
||||||
shouldUseSingleGalleryColumn: false,
|
shouldUseSingleGalleryColumn: false,
|
||||||
hidden: false,
|
shouldHidePreview: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const gallerySlice = createSlice({
|
export const gallerySlice = createSlice({
|
||||||
@ -254,7 +254,7 @@ export const gallerySlice = createSlice({
|
|||||||
state.shouldUseSingleGalleryColumn = action.payload;
|
state.shouldUseSingleGalleryColumn = action.payload;
|
||||||
},
|
},
|
||||||
setHiddenState: (state, action: PayloadAction<boolean>) => {
|
setHiddenState: (state, action: PayloadAction<boolean>) => {
|
||||||
state.hidden = action.payload;
|
state.shouldHidePreview = action.payload;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -11,7 +11,9 @@ export default function InitImagePreview() {
|
|||||||
(state: RootState) => state.generation.initialImage
|
(state: RootState) => state.generation.initialImage
|
||||||
);
|
);
|
||||||
|
|
||||||
const { hidden } = useAppSelector((state: RootState) => state.gallery);
|
const { shouldHidePreview } = useAppSelector(
|
||||||
|
(state: RootState) => state.gallery
|
||||||
|
);
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@ -69,7 +71,7 @@ export default function InitImagePreview() {
|
|||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
}}
|
}}
|
||||||
src={
|
src={
|
||||||
hidden
|
shouldHidePreview
|
||||||
? undefined
|
? undefined
|
||||||
: typeof initialImage === 'string'
|
: typeof initialImage === 'string'
|
||||||
? initialImage
|
? initialImage
|
||||||
|
Loading…
Reference in New Issue
Block a user