moving shouldHidePreview from gallery to ui slice.

This commit is contained in:
SammCheese 2023-04-15 11:49:30 +02:00 committed by psychedelicious
parent 116107f464
commit d73f3adc43
6 changed files with 13 additions and 17 deletions

View File

@ -8,10 +8,7 @@ import IAIButton from 'common/components/IAIButton';
import IAIIconButton from 'common/components/IAIIconButton';
import IAIPopover from 'common/components/IAIPopover';
import { setInitialCanvasImage } from 'features/canvas/store/canvasSlice';
import {
GalleryState,
setShouldHidePreview,
} from 'features/gallery/store/gallerySlice';
import { GalleryState } from 'features/gallery/store/gallerySlice';
import { lightboxSelector } from 'features/lightbox/store/lightboxSelectors';
import { setIsLightboxOpen } from 'features/lightbox/store/lightboxSlice';
import FaceRestoreSettings from 'features/parameters/components/AdvancedParameters/FaceRestore/FaceRestoreSettings';
@ -30,6 +27,7 @@ import {
} from 'features/ui/store/uiSelectors';
import {
setActiveTab,
setShouldHidePreview,
setShouldShowImageDetails,
} from 'features/ui/store/uiSlice';
import { useHotkeys } from 'react-hotkeys-hook';
@ -80,9 +78,9 @@ const currentImageButtonsSelector = createSelector(
const { isLightboxOpen } = lightbox;
const { shouldShowImageDetails } = ui;
const { shouldShowImageDetails, shouldHidePreview } = ui;
const { intermediateImage, currentImage, shouldHidePreview } = gallery;
const { intermediateImage, currentImage } = gallery;
return {
isProcessing,

View File

@ -15,8 +15,8 @@ import CurrentImageHidden from './CurrentImageHidden';
export const imagesSelector = createSelector(
[gallerySelector, uiSelector],
(gallery: GalleryState, ui) => {
const { currentImage, intermediateImage, shouldHidePreview } = gallery;
const { shouldShowImageDetails } = ui;
const { currentImage, intermediateImage } = gallery;
const { shouldShowImageDetails, shouldHidePreview } = ui;
return {
imageToDisplay: intermediateImage ? intermediateImage : currentImage,

View File

@ -39,7 +39,6 @@ export interface GalleryState {
currentCategory: GalleryCategory;
galleryWidth: number;
shouldUseSingleGalleryColumn: boolean;
shouldHidePreview: boolean;
}
const initialState: GalleryState = {
@ -64,7 +63,6 @@ const initialState: GalleryState = {
},
galleryWidth: 300,
shouldUseSingleGalleryColumn: false,
shouldHidePreview: false,
};
export const gallerySlice = createSlice({
@ -253,15 +251,11 @@ export const gallerySlice = createSlice({
) => {
state.shouldUseSingleGalleryColumn = action.payload;
},
setShouldHidePreview: (state, action: PayloadAction<boolean>) => {
state.shouldHidePreview = action.payload;
},
},
});
export const {
addImage,
setShouldHidePreview,
clearIntermediateImage,
removeImage,
setCurrentImage,

View File

@ -11,9 +11,7 @@ export default function InitImagePreview() {
(state: RootState) => state.generation.initialImage
);
const { shouldHidePreview } = useAppSelector(
(state: RootState) => state.gallery
);
const { shouldHidePreview } = useAppSelector((state: RootState) => state.ui);
const { t } = useTranslation();

View File

@ -16,6 +16,7 @@ const initialtabsState: UIState = {
addNewModelUIOption: null,
shouldPinGallery: true,
shouldShowGallery: true,
shouldHidePreview: false,
};
const initialState: UIState = initialtabsState;
@ -53,6 +54,9 @@ export const uiSlice = createSlice({
setShouldUseCanvasBetaLayout: (state, action: PayloadAction<boolean>) => {
state.shouldUseCanvasBetaLayout = action.payload;
},
setShouldHidePreview: (state, action: PayloadAction<boolean>) => {
state.shouldHidePreview = action.payload;
},
setShouldShowExistingModelsInSearch: (
state,
action: PayloadAction<boolean>
@ -106,6 +110,7 @@ export const {
setShouldShowExistingModelsInSearch,
setShouldUseSliders,
setAddNewModelUIOption,
setShouldHidePreview,
setShouldPinGallery,
setShouldShowGallery,
togglePanels,

View File

@ -11,6 +11,7 @@ export interface UIState {
shouldShowExistingModelsInSearch: boolean;
shouldUseSliders: boolean;
addNewModelUIOption: AddNewModelType;
shouldHidePreview: boolean;
shouldPinGallery: boolean;
shouldShowGallery: boolean;
}