mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
chore(ui): clean up GalleryPanel
This commit is contained in:
parent
6fe62a2705
commit
cc21fb216c
@ -6,7 +6,7 @@ import FloatingGalleryButton from 'features/ui/components/FloatingGalleryButton'
|
|||||||
import FloatingParametersPanelButtons from 'features/ui/components/FloatingParametersPanelButtons';
|
import FloatingParametersPanelButtons from 'features/ui/components/FloatingParametersPanelButtons';
|
||||||
import { Box, Flex, Grid, Portal } from '@chakra-ui/react';
|
import { Box, Flex, Grid, Portal } from '@chakra-ui/react';
|
||||||
import { APP_HEIGHT, APP_WIDTH } from 'theme/util/constants';
|
import { APP_HEIGHT, APP_WIDTH } from 'theme/util/constants';
|
||||||
import GalleryDrawer from 'features/gallery/components/ImageGalleryPanel';
|
import GalleryDrawer from 'features/gallery/components/GalleryPanel';
|
||||||
import Lightbox from 'features/lightbox/components/Lightbox';
|
import Lightbox from 'features/lightbox/components/Lightbox';
|
||||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||||
import { memo, ReactNode, useCallback, useEffect, useState } from 'react';
|
import { memo, ReactNode, useCallback, useEffect, useState } from 'react';
|
||||||
@ -22,7 +22,6 @@ import { languageSelector } from 'features/system/store/systemSelectors';
|
|||||||
import i18n from 'i18n';
|
import i18n from 'i18n';
|
||||||
import Toaster from './Toaster';
|
import Toaster from './Toaster';
|
||||||
import GlobalHotkeys from './GlobalHotkeys';
|
import GlobalHotkeys from './GlobalHotkeys';
|
||||||
import AuxiliaryProgressIndicator from './AuxiliaryProgressIndicator';
|
|
||||||
|
|
||||||
const DEFAULT_CONFIG = {};
|
const DEFAULT_CONFIG = {};
|
||||||
|
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||||
import { gallerySelector } from 'features/gallery/store/gallerySelectors';
|
import { gallerySelector } from 'features/gallery/store/gallerySelectors';
|
||||||
import {
|
import { setGalleryImageMinimumWidth } from 'features/gallery/store/gallerySlice';
|
||||||
// selectNextImage,
|
|
||||||
// selectPrevImage,
|
|
||||||
setGalleryImageMinimumWidth,
|
|
||||||
} from 'features/gallery/store/gallerySlice';
|
|
||||||
|
|
||||||
import { clamp, isEqual } from 'lodash-es';
|
import { clamp, isEqual } from 'lodash-es';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
@ -23,20 +19,7 @@ import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvas
|
|||||||
import { lightboxSelector } from 'features/lightbox/store/lightboxSelectors';
|
import { lightboxSelector } from 'features/lightbox/store/lightboxSelectors';
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
|
|
||||||
// const GALLERY_TAB_WIDTHS: Record<
|
const selector = createSelector(
|
||||||
// InvokeTabName,
|
|
||||||
// { galleryMinWidth: number; galleryMaxWidth: number }
|
|
||||||
// > = {
|
|
||||||
// txt2img: { galleryMinWidth: 200, galleryMaxWidth: 500 },
|
|
||||||
// img2img: { galleryMinWidth: 200, galleryMaxWidth: 500 },
|
|
||||||
// generate: { galleryMinWidth: 200, galleryMaxWidth: 500 },
|
|
||||||
// unifiedCanvas: { galleryMinWidth: 200, galleryMaxWidth: 200 },
|
|
||||||
// nodes: { galleryMinWidth: 200, galleryMaxWidth: 500 },
|
|
||||||
// postprocessing: { galleryMinWidth: 200, galleryMaxWidth: 500 },
|
|
||||||
// training: { galleryMinWidth: 200, galleryMaxWidth: 500 },
|
|
||||||
// };
|
|
||||||
|
|
||||||
const galleryPanelSelector = createSelector(
|
|
||||||
[
|
[
|
||||||
activeTabNameSelector,
|
activeTabNameSelector,
|
||||||
uiSelector,
|
uiSelector,
|
||||||
@ -76,41 +59,13 @@ const GalleryDrawer = () => {
|
|||||||
// isStaging,
|
// isStaging,
|
||||||
// isResizable,
|
// isResizable,
|
||||||
// isLightboxOpen,
|
// isLightboxOpen,
|
||||||
} = useAppSelector(galleryPanelSelector);
|
} = useAppSelector(selector);
|
||||||
|
|
||||||
// const handleSetShouldPinGallery = () => {
|
|
||||||
// dispatch(togglePinGalleryPanel());
|
|
||||||
// dispatch(requestCanvasRescale());
|
|
||||||
// };
|
|
||||||
|
|
||||||
// const handleToggleGallery = () => {
|
|
||||||
// dispatch(toggleGalleryPanel());
|
|
||||||
// shouldPinGallery && dispatch(requestCanvasRescale());
|
|
||||||
// };
|
|
||||||
|
|
||||||
const handleCloseGallery = () => {
|
const handleCloseGallery = () => {
|
||||||
dispatch(setShouldShowGallery(false));
|
dispatch(setShouldShowGallery(false));
|
||||||
shouldPinGallery && dispatch(requestCanvasRescale());
|
shouldPinGallery && dispatch(requestCanvasRescale());
|
||||||
};
|
};
|
||||||
|
|
||||||
// const resolution = useResolution();
|
|
||||||
|
|
||||||
// useHotkeys(
|
|
||||||
// 'g',
|
|
||||||
// () => {
|
|
||||||
// handleToggleGallery();
|
|
||||||
// },
|
|
||||||
// [shouldPinGallery]
|
|
||||||
// );
|
|
||||||
|
|
||||||
// useHotkeys(
|
|
||||||
// 'shift+g',
|
|
||||||
// () => {
|
|
||||||
// handleSetShouldPinGallery();
|
|
||||||
// },
|
|
||||||
// [shouldPinGallery]
|
|
||||||
// );
|
|
||||||
|
|
||||||
useHotkeys(
|
useHotkeys(
|
||||||
'esc',
|
'esc',
|
||||||
() => {
|
() => {
|
||||||
@ -155,54 +110,6 @@ const GalleryDrawer = () => {
|
|||||||
[galleryImageMinimumWidth]
|
[galleryImageMinimumWidth]
|
||||||
);
|
);
|
||||||
|
|
||||||
// const calcGalleryMinHeight = () => {
|
|
||||||
// if (resolution === 'desktop') return;
|
|
||||||
// return 300;
|
|
||||||
// };
|
|
||||||
|
|
||||||
// const imageGalleryContent = () => {
|
|
||||||
// return (
|
|
||||||
// <Flex
|
|
||||||
// w="100vw"
|
|
||||||
// h={{ base: 300, xl: '100vh' }}
|
|
||||||
// paddingRight={{ base: 8, xl: 0 }}
|
|
||||||
// paddingBottom={{ base: 4, xl: 0 }}
|
|
||||||
// >
|
|
||||||
// <ImageGalleryContent />
|
|
||||||
// </Flex>
|
|
||||||
// );
|
|
||||||
// };
|
|
||||||
|
|
||||||
// const resizableImageGalleryContent = () => {
|
|
||||||
// return (
|
|
||||||
// <ResizableDrawer
|
|
||||||
// direction="right"
|
|
||||||
// isResizable={isResizable || !shouldPinGallery}
|
|
||||||
// isOpen={shouldShowGallery}
|
|
||||||
// onClose={handleCloseGallery}
|
|
||||||
// isPinned={shouldPinGallery && !isLightboxOpen}
|
|
||||||
// minWidth={
|
|
||||||
// shouldPinGallery
|
|
||||||
// ? GALLERY_TAB_WIDTHS[activeTabName].galleryMinWidth
|
|
||||||
// : 200
|
|
||||||
// }
|
|
||||||
// maxWidth={
|
|
||||||
// shouldPinGallery
|
|
||||||
// ? GALLERY_TAB_WIDTHS[activeTabName].galleryMaxWidth
|
|
||||||
// : undefined
|
|
||||||
// }
|
|
||||||
// minHeight={calcGalleryMinHeight()}
|
|
||||||
// >
|
|
||||||
// <ImageGalleryContent />
|
|
||||||
// </ResizableDrawer>
|
|
||||||
// );
|
|
||||||
// };
|
|
||||||
|
|
||||||
// const renderImageGallery = () => {
|
|
||||||
// if (['mobile', 'tablet'].includes(resolution)) return imageGalleryContent();
|
|
||||||
// return resizableImageGalleryContent();
|
|
||||||
// };
|
|
||||||
|
|
||||||
if (shouldPinGallery) {
|
if (shouldPinGallery) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -218,8 +125,6 @@ const GalleryDrawer = () => {
|
|||||||
<ImageGalleryContent />
|
<ImageGalleryContent />
|
||||||
</ResizableDrawer>
|
</ResizableDrawer>
|
||||||
);
|
);
|
||||||
|
|
||||||
// return renderImageGallery();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default memo(GalleryDrawer);
|
export default memo(GalleryDrawer);
|
Loading…
x
Reference in New Issue
Block a user