Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

refactor(canvas): remove unused canvas operation panel

joshistoast606675cc8376
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasBottomOverlay.test.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasBottomOverlay.test.tsx
index 964abaffd0..0094cd6cde 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasBottomOverlay.test.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/CanvasBottomOverlay.test.tsx
@@ -9,12 +9,6 @@ import {
BOTTOM_OVERLAY_STACK_LAYOUT,
CanvasBottomOverlay,
} from './CanvasBottomOverlay';
-import {
- CANVAS_OPERATION_BODY_LAYOUT,
- CANVAS_OPERATION_FIXED_SECTION_LAYOUT,
- CANVAS_OPERATION_PANEL_LAYOUT,
- CanvasOperationPanel,
-} from './tool-options/CanvasOperationPanel';
describe('CanvasBottomOverlay', () => {
it('allocates only the canvas widget inset and allows the stack to shrink', () => {
@@ -36,37 +30,6 @@ describe('CanvasBottomOverlay', () => {
expect(markup.indexOf('Staging')).toBeLessThan(markup.indexOf('Operation'));
});
- it('server-renders the complete staging and operation flex chain with body-only scrolling', () => {
- const markup = renderToStaticMarkup(
- <ChakraProvider value={system}>
- <CanvasBottomOverlay.Root data-layout="overlay">
- <CanvasBottomOverlay.Staging data-layout="staging">Staging</CanvasBottomOverlay.Staging>
- <CanvasBottomOverlay.Controls data-layout="controls">
- <CanvasOperationPanel.Root aria-label="Filter">
- <CanvasOperationPanel.Header>Header</CanvasOperationPanel.Header>
- <CanvasOperationPanel.Body>{'Large body '.repeat(500)}</CanvasOperationPanel.Body>
- <CanvasOperationPanel.Feedback>Ready</CanvasOperationPanel.Feedback>
- <CanvasOperationPanel.Footer>Footer</CanvasOperationPanel.Footer>
- </CanvasOperationPanel.Root>
- </CanvasBottomOverlay.Controls>
- </CanvasBottomOverlay.Root>
- </ChakraProvider>
- );
-
- expect(markup).toContain('data-layout="overlay"');
- expect(markup.indexOf('data-layout="overlay"')).toBeLessThan(markup.indexOf('data-layout="staging"'));
- expect(markup.indexOf('data-layout="staging"')).toBeLessThan(markup.indexOf('data-layout="controls"'));
- expect(markup.indexOf('data-slot="header"')).toBeLessThan(markup.indexOf('data-slot="body"'));
- expect(markup.indexOf('data-slot="body"')).toBeLessThan(markup.indexOf('data-slot="feedback"'));
- expect(markup.indexOf('data-slot="feedback"')).toBeLessThan(markup.indexOf('data-slot="footer"'));
- expect(BOTTOM_OVERLAY_LAYOUT).toMatchObject({ bottom: '2', overflow: 'hidden', top: '2' });
- expect(BOTTOM_OVERLAY_STACK_LAYOUT).toMatchObject({ justifyContent: 'flex-end' });
- expect(BOTTOM_CONTROLS_SLOT_LAYOUT).toMatchObject({ flex: '0 1 auto', minH: '0', overflow: 'hidden' });
- expect(CANVAS_OPERATION_PANEL_LAYOUT).toMatchObject({ maxH: 'full', minH: '0', overflow: 'hidden' });
- expect(CANVAS_OPERATION_BODY_LAYOUT).toMatchObject({ minH: '0', overflowY: 'auto' });
- expect(CANVAS_OPERATION_FIXED_SECTION_LAYOUT).toEqual({ flexShrink: '0' });
- });
-
it('forwards root props and ref-compatible attributes', () => {
const markup = renderToStaticMarkup(
<ChakraProvider value={system}>
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/CanvasOperationPanel.test.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/CanvasOperationPanel.test.tsx
deleted file mode 100644
index 31079335ac..0000000000
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/CanvasOperationPanel.test.tsx
+++ /dev/null
@@ -1,84 +0,0 @@
-import { ChakraProvider } from '@chakra-ui/react';
-import { system } from '@theme/system';
-import { renderToStaticMarkup } from 'react-dom/server';
-import { describe, expect, it } from 'vitest';
-
-import {
- CANVAS_OPERATION_BODY_LAYOUT,
- CANVAS_OPERATION_FIXED_SECTION_LAYOUT,
- CANVAS_OPERATION_FOOTER_LAYOUT,
- CANVAS_OPERATION_PANEL_LAYOUT,
- CANVAS_OPERATION_SLOT_LAYOUT,
- CanvasOperationPanel,
-} from './CanvasOperationPanel';
-
-describe('CanvasOperationPanel', () => {
- it('renders the operation panel slots as semantic regions in stable order', () => {
- const markup = renderToStaticMarkup(
- <ChakraProvider value={system}>
- <CanvasOperationPanel.Root aria-labelledby="operation-title">
- <CanvasOperationPanel.Header>
- <h2 id="operation-title">Filter</h2>
- </CanvasOperationPanel.Header>
- <CanvasOperationPanel.Body>Inputs</CanvasOperationPanel.Body>
- <CanvasOperationPanel.Feedback>Status</CanvasOperationPanel.Feedback>
- <CanvasOperationPanel.Footer>
- <button>Process</button>
- <button>Cancel</button>
- </CanvasOperationPanel.Footer>
- </CanvasOperationPanel.Root>
- </ChakraProvider>
- );
-
- expect(markup).toContain('role="region"');
- expect(markup).toContain('aria-labelledby="operation-title"');
- expect(markup).toContain('data-operation="filter"');
- expect(markup).toContain('data-slot="header"');
- expect(markup).toContain('data-slot="body"');
- expect(markup).toContain('data-slot="feedback"');
- expect(markup).toContain('data-slot="footer"');
- expect(markup.indexOf('data-slot="header"')).toBeLessThan(markup.indexOf('data-slot="body"'));
- expect(markup.indexOf('data-slot="body"')).toBeLessThan(markup.indexOf('data-slot="feedback"'));
- expect(markup.indexOf('data-slot="feedback"')).toBeLessThan(markup.indexOf('data-slot="footer"'));
- expect(markup.indexOf('Process')).toBeLessThan(markup.indexOf('Cancel'));
- });
-
- it('uses a widget-sized flex policy with a 30rem ideal width', () => {
- expect(CANVAS_OPERATION_PANEL_LAYOUT).toEqual({
- flex: '0 1 30rem',
- maxH: 'full',
- maxW: 'full',
- minH: '0',
- minW: '0',
- overflow: 'hidden',
- w: '30rem',
- });
- expect(CANVAS_OPERATION_FOOTER_LAYOUT).toMatchObject({ flexWrap: 'wrap', minW: '0' });
- expect(CANVAS_OPERATION_SLOT_LAYOUT).toEqual({ px: '4', py: '3' });
- });
-
- it('keeps vertical overflow on the body while fixed sections retain their order', () => {
- expect(CANVAS_OPERATION_BODY_LAYOUT).toEqual({
- flex: '1',
- minH: '0',
- overflowX: 'hidden',
- overflowY: 'auto',
- });
- expect(CANVAS_OPERATION_FIXED_SECTION_LAYOUT).toEqual({ flexShrink: '0' });
- const markup = renderToStaticMarkup(
- <ChakraProvider value={system}>
- <CanvasOperationPanel.Root aria-label="Filter">
- <CanvasOperationPanel.Header>Filter</CanvasOperationPanel.Header>
- <CanvasOperationPanel.Body>Parameters</CanvasOperationPanel.Body>
- <CanvasOperationPanel.Feedback>Ready</CanvasOperationPanel.Feedback>
- <CanvasOperationPanel.Footer>Process</CanvasOperationPanel.Footer>
- </CanvasOperationPanel.Root>
- </ChakraProvider>
- );
-
- const body = markup.indexOf('data-slot="body"');
- const feedback = markup.indexOf('data-slot="feedback"');
- expect(body).toBeGreaterThan(-1);
- expect(body).toBeLessThan(feedback);
- });
-});
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/CanvasOperationPanel.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/CanvasOperationPanel.tsx
deleted file mode 100644
index 3685f635e3..0000000000
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/tool-options/CanvasOperationPanel.tsx
+++ /dev/null
@@ -1,99 +0,0 @@
-import type { BoxProps, FlexProps } from '@chakra-ui/react';
-
-import { Box, Flex } from '@chakra-ui/react';
-import { Panel } from '@workbench/components/ui';
-
-export const CANVAS_OPERATION_PANEL_LAYOUT = {
- flex: '0 1 30rem',
- maxH: 'full',
- maxW: 'full',
- minH: '0',
- minW: '0',
- overflow: 'hidden',
- w: '30rem',
-} satisfies BoxProps;
-
-export const CANVAS_OPERATION_SLOT_LAYOUT = {
- px: '4',
- py: '3',
-} satisfies BoxProps;
-
-export const CANVAS_OPERATION_FOOTER_LAYOUT = {
- flexWrap: 'wrap',
- minW: '0',
-} satisfies FlexProps;
-
-export const CANVAS_OPERATION_BODY_LAYOUT = {
- flex: '1',
- minH: '0',
- overflowX: 'hidden',
- overflowY: 'auto',
-} satisfies BoxProps;
-
-export const CANVAS_OPERATION_FIXED_SECTION_LAYOUT = { flexShrink: '0' } satisfies BoxProps;
-
-const Root = ({ children, ...rest }: BoxProps) => (
- <Panel
- data-operation="filter"
- density="none"
- display="flex"
- flexDirection="column"
- pointerEvents="auto"
- role="region"
- rounded="xl"
- shadow="lg"
- tone="raised"
- {...CANVAS_OPERATION_PANEL_LAYOUT}
- {...rest}
- >
- {children}
- </Panel>
-);
-
-const Header = (props: BoxProps) => (
- <Box
- as="header"
- borderBottomWidth="1px"
- data-slot="header"
- {...CANVAS_OPERATION_SLOT_LAYOUT}
- {...CANVAS_OPERATION_FIXED_SECTION_LAYOUT}
- {...props}
- />
-);
-
-const Body = (props: BoxProps) => (
- <Box
- data-scroll-container="body"
- data-slot="body"
- {...CANVAS_OPERATION_SLOT_LAYOUT}
- {...CANVAS_OPERATION_BODY_LAYOUT}
- {...props}
- />
-);
-
-const Feedback = (props: BoxProps) => (
- <Box
- borderTopWidth="1px"
- data-slot="feedback"
- minH="16"
- px="4"
- py="2"
- {...CANVAS_OPERATION_FIXED_SECTION_LAYOUT}
- {...props}
- />
-);
-
-const Footer = (props: FlexProps) => (
- <Flex
- as="footer"
- borderTopWidth="1px"
- data-slot="footer"
- gap="2"
- {...CANVAS_OPERATION_SLOT_LAYOUT}
- {...CANVAS_OPERATION_FOOTER_LAYOUT}
- {...CANVAS_OPERATION_FIXED_SECTION_LAYOUT}
- {...props}
- />
-);
-
-export const CanvasOperationPanel = { Body, Feedback, Footer, Header, Root };