feat(ui): remove entity list context menu (again)

stupid events
This commit is contained in:
psychedelicious 2024-08-30 23:10:36 +10:00
parent ac9a66a628
commit 765d99ac2f
2 changed files with 5 additions and 20 deletions

View File

@ -1,37 +1,22 @@
import { Box, ContextMenu, Divider, Flex, MenuList } from '@invoke-ai/ui-library'; import { Divider, Flex } from '@invoke-ai/ui-library';
import { useAppSelector } from 'app/store/storeHooks'; import { useAppSelector } from 'app/store/storeHooks';
import { CanvasAddEntityButtons } from 'features/controlLayers/components/CanvasAddEntityButtons'; import { CanvasAddEntityButtons } from 'features/controlLayers/components/CanvasAddEntityButtons';
import { CanvasEntityList } from 'features/controlLayers/components/CanvasEntityList/CanvasEntityList'; import { CanvasEntityList } from 'features/controlLayers/components/CanvasEntityList/CanvasEntityList';
import { EntityListActionBar } from 'features/controlLayers/components/CanvasEntityList/EntityListActionBar'; import { EntityListActionBar } from 'features/controlLayers/components/CanvasEntityList/EntityListActionBar';
import { CanvasEntityListMenuItems } from 'features/controlLayers/components/CanvasEntityList/EntityListActionBarAddLayerMenuItems';
import { CanvasManagerProviderGate } from 'features/controlLayers/contexts/CanvasManagerProviderGate'; import { CanvasManagerProviderGate } from 'features/controlLayers/contexts/CanvasManagerProviderGate';
import { selectHasEntities } from 'features/controlLayers/store/selectors'; import { selectHasEntities } from 'features/controlLayers/store/selectors';
import { memo, useCallback } from 'react'; import { memo } from 'react';
export const CanvasPanelContent = memo(() => { export const CanvasPanelContent = memo(() => {
const hasEntities = useAppSelector(selectHasEntities); const hasEntities = useAppSelector(selectHasEntities);
const renderMenu = useCallback(
() => (
<MenuList>
<CanvasEntityListMenuItems />
</MenuList>
),
[]
);
return ( return (
<CanvasManagerProviderGate> <CanvasManagerProviderGate>
<Flex flexDir="column" gap={2} w="full" h="full"> <Flex flexDir="column" gap={2} w="full" h="full">
<EntityListActionBar /> <EntityListActionBar />
<Divider py={0} /> <Divider py={0} />
<ContextMenu<HTMLDivElement> renderMenu={renderMenu}> {!hasEntities && <CanvasAddEntityButtons />}
{(ref) => ( {hasEntities && <CanvasEntityList />}
<Box ref={ref} w="full" h="full">
{!hasEntities && <CanvasAddEntityButtons />}
{hasEntities && <CanvasEntityList />}
</Box>
)}
</ContextMenu>
</Flex> </Flex>
</CanvasManagerProviderGate> </CanvasManagerProviderGate>
); );

View File

@ -56,7 +56,7 @@ export const CanvasEntityHeader = memo(({ children, ...rest }: FlexProps) => {
}, [entityIdentifier]); }, [entityIdentifier]);
return ( return (
<ContextMenu renderMenu={renderMenu} stopImmediatePropagation> <ContextMenu renderMenu={renderMenu}>
{(ref) => ( {(ref) => (
<Flex ref={ref} gap={2} alignItems="center" p={2} {...rest}> <Flex ref={ref} gap={2} alignItems="center" p={2} {...rest}>
{children} {children}