fix(ui): bug where viewer would disappear on upscaling tab

This commit is contained in:
psychedelicious 2024-07-23 10:19:40 +10:00
parent c3a8184431
commit 2e0cebb571
2 changed files with 9 additions and 5 deletions

View File

@ -9,7 +9,13 @@ import CurrentImageButtons from './CurrentImageButtons';
import { ViewerToggleMenu } from './ViewerToggleMenu'; import { ViewerToggleMenu } from './ViewerToggleMenu';
export const ViewerToolbar = memo(() => { export const ViewerToolbar = memo(() => {
const tab = useAppSelector(activeTabNameSelector); const showToggle = useAppSelector((s) => {
const tab = activeTabNameSelector(s);
if (tab === 'upscaling' || tab === 'workflows') {
return false;
}
return true;
});
return ( return (
<Flex w="full" gap={2}> <Flex w="full" gap={2}>
<Flex flex={1} justifyContent="center"> <Flex flex={1} justifyContent="center">
@ -23,7 +29,7 @@ export const ViewerToolbar = memo(() => {
</Flex> </Flex>
<Flex flex={1} justifyContent="center"> <Flex flex={1} justifyContent="center">
<Flex gap={2} marginInlineStart="auto"> <Flex gap={2} marginInlineStart="auto">
{tab !== 'workflows' && <ViewerToggleMenu />} {showToggle && <ViewerToggleMenu />}
</Flex> </Flex>
</Flex> </Flex>
</Flex> </Flex>

View File

@ -1,13 +1,11 @@
import { Box } from '@invoke-ai/ui-library'; import { Box } from '@invoke-ai/ui-library';
import { ImageViewer } from 'features/gallery/components/ImageViewer/ImageViewer'; import { ImageViewer } from 'features/gallery/components/ImageViewer/ImageViewer';
import { useImageViewer } from 'features/gallery/components/ImageViewer/useImageViewer';
import { memo } from 'react'; import { memo } from 'react';
const UpscalingTab = () => { const UpscalingTab = () => {
const imageViewer = useImageViewer();
return ( return (
<Box layerStyle="first" position="relative" w="full" h="full" p={2} borderRadius="base"> <Box layerStyle="first" position="relative" w="full" h="full" p={2} borderRadius="base">
{imageViewer.isOpen && <ImageViewer />} <ImageViewer />
</Box> </Box>
); );
}; };