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.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
feat(preview): visible action strip in footer with density-aware overflow
joshistoast39d9db152374
diff --git a/invokeai/frontend/webv2/src/workbench/image-actions/index.ts b/invokeai/frontend/webv2/src/workbench/image-actions/index.tsindex 9e1417d6c1..441f09874d 100644--- a/invokeai/frontend/webv2/src/workbench/image-actions/index.ts+++ b/invokeai/frontend/webv2/src/workbench/image-actions/index.ts@@ -1,5 +1,6 @@export {ImageContextMenu,+ getGalleryCanvasImportMenuItems,getImageContextMenuImages,getImageContextMenuRecallRequestKey,type ImageContextMenuTarget,diff --git a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewActionStrip.tsx b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewActionStrip.tsxnew file mode 100644index 0000000000..9b62d1daab--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewActionStrip.tsx@@ -0,0 +1,182 @@+import type { GalleryImage } from '@workbench/gallery/api';++import { HStack, Icon, Menu, Portal, Text } from '@chakra-ui/react';+import { IconButton, MenuContent, Tooltip } from '@workbench/components/ui';+import { getGalleryCanvasImportMenuItems, type ImageActions } from '@workbench/image-actions';+import {+ CopyIcon,+ DownloadIcon,+ ImagesIcon,+ LayersIcon,+ MoreHorizontalIcon,+ StarIcon,+ Trash2Icon,+ type LucideIcon,+} from 'lucide-react';+import { useCallback, useMemo } from 'react';+import { useTranslation } from 'react-i18next';++import type { PreviewDensity } from './previewDensity';++/**+ * The footer's always-visible action row: the most-used image verbs, one click+ * away instead of buried in the context menu. At full density every action is+ * an icon button; compact/minimal collapse to star + an overflow menu.+ */++const MENU_POSITIONING = { placement: 'bottom-end' } as const;++export const PreviewActionStrip = ({+ actions,+ density,+ image,+}: {+ actions: ImageActions;+ density: PreviewDensity;+ image: GalleryImage;+}) => {+ const { t } = useTranslation();+ const canvasImportItems = useMemo(() => getGalleryCanvasImportMenuItems(false), []);+ const toggleStar = useCallback(+ () => void actions.setImagesStarred([image.imageName], !image.starred),+ [actions, image.imageName, image.starred]+ );+ const selectForCompare = useCallback(() => actions.selectForCompare(image), [actions, image]);+ const copyImage = useCallback(() => void actions.copyImage(image), [actions, image]);+ const downloadImage = useCallback(() => void actions.downloadImage(image), [actions, image]);+ const deleteImage = useCallback(() => void actions.deleteImages([image.imageName]), [actions, image.imageName]);+ const sendToCanvas = useCallback(+ (destination: (typeof canvasImportItems)[number]['destination']) => void actions.sendToCanvas([image], destination),+ [actions, image]+ );+ const starLabel = image.starred ? 'Unstar image' : 'Star image';+ const starButton = (+ <Tooltip content={starLabel}>+ <IconButton aria-label={starLabel} color="fg.muted" size="2xs" variant="ghost" onClick={toggleStar}>+ <Icon as={StarIcon} boxSize="3.5" fill={image.starred ? 'currentColor' : 'none'} />+ </IconButton>+ </Tooltip>+ );++ if (density !== 'full') {+ return (+ <HStack flexShrink={0} gap="0.5">+ {starButton}+ <Menu.Root positioning={MENU_POSITIONING}>+ <Menu.Trigger asChild>+ <IconButton aria-label="Image actions" color="fg.muted" size="2xs" variant="ghost">+ <Icon as={MoreHorizontalIcon} boxSize="3.5" />+ </IconButton>+ </Menu.Trigger>+ <Portal>+ <Menu.Positioner>+ <MenuContent minW="12rem">+ <StripMenuItem+ icon={ImagesIcon}+ label="Select for Compare"+ value="compare"+ onClick={selectForCompare}+ />+ <StripMenuItem icon={CopyIcon} label="Copy to clipboard" value="copy" onClick={copyImage} />+ <StripMenuItem icon={DownloadIcon} label="Download image" value="download" onClick={downloadImage} />+ <Menu.Separator borderColor="border.subtle" />+ {canvasImportItems.map((item) => (+ <StripCanvasImportMenuItem+ key={item.value}+ destination={item.destination}+ label={t(item.label)}+ value={item.value}+ onSend={sendToCanvas}+ />+ ))}+ <Menu.Separator borderColor="border.subtle" />+ <StripMenuItem+ color="fg.error"+ icon={Trash2Icon}+ label="Delete Image"+ value="delete"+ onClick={deleteImage}+ />+ </MenuContent>+ </Menu.Positioner>+ </Portal>+ </Menu.Root>+ </HStack>+ );+ }++ return (+ <HStack flexShrink={0} gap="0.5">+ {starButton}+ <StripIconButton icon={ImagesIcon} label="Select for Compare" onClick={selectForCompare} />+ <StripIconButton icon={CopyIcon} label="Copy to clipboard" onClick={copyImage} />+ <StripIconButton icon={DownloadIcon} label="Download image" onClick={downloadImage} />+ <Menu.Root positioning={MENU_POSITIONING}>+ <Menu.Trigger asChild>+ <IconButton aria-label="Send to canvas" color="fg.muted" size="2xs" variant="ghost">+ <Icon as={LayersIcon} boxSize="3.5" />+ </IconButton>+ </Menu.Trigger>+ <Portal>+ <Menu.Positioner>+ <MenuContent minW="12rem">+ {canvasImportItems.map((item) => (+ <StripCanvasImportMenuItem+ key={item.value}+ destination={item.destination}+ label={t(item.label)}+ value={item.value}+ onSend={sendToCanvas}+ />+ ))}+ </MenuContent>+ </Menu.Positioner>+ </Portal>+ </Menu.Root>+ <StripIconButton icon={Trash2Icon} label="Delete Image" onClick={deleteImage} />+ </HStack>+ );+};++const StripIconButton = ({ icon, label, onClick }: { icon: LucideIcon; label: string; onClick: () => void }) => (+ <Tooltip content={label}>+ <IconButton aria-label={label} color="fg.muted" size="2xs" variant="ghost" onClick={onClick}>+ <Icon as={icon} boxSize="3.5" />+ </IconButton>+ </Tooltip>+);++const StripMenuItem = ({+ color,+ icon,+ label,+ value,+ onClick,+}: {+ color?: string;+ icon: LucideIcon;+ label: string;+ value: string;+ onClick: () => void;+}) => (+ <Menu.Item color={color} value={value} onClick={onClick}>+ <Icon as={icon} boxSize="3.5" color={color ?? 'fg.subtle'} />+ <Text fontSize="xs">{label}</Text>+ </Menu.Item>+);++const StripCanvasImportMenuItem = ({+ destination,+ label,+ value,+ onSend,+}: {+ destination: Parameters<ImageActions['sendToCanvas']>[1];+ label: string;+ value: string;+ onSend: (destination: Parameters<ImageActions['sendToCanvas']>[1]) => void;+}) => {+ const handleClick = useCallback(() => onSend(destination), [destination, onSend]);++ return <StripMenuItem icon={LayersIcon} label={label} value={value} onClick={handleClick} />;+};diff --git a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFooter.tsx b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFooter.tsxindex 9980b2f23d..1f8d5bc1dc 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFooter.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFooter.tsx@@ -1,18 +1,27 @@+import type { GalleryImage } from '@workbench/gallery/api';+import type { ImageActions } from '@workbench/image-actions';import type { GeneratedImageContract } from '@workbench/types';-import { Badge, HStack, Stack, Text } from '@chakra-ui/react';+import { Badge, Box, HStack, Stack, Text } from '@chakra-ui/react';import { Button } from '@workbench/components/ui';import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';import { useTranslation } from 'react-i18next';+import type { PreviewDensity } from './previewDensity';++import { PreviewActionStrip } from './PreviewActionStrip';+/**- * The preview's info card: board context ("N of M"), prev/next navigation and- * the image identity rows. Later phases add the action strip, step message and- * metadata rail here — never in the widget shell.+ * The preview's info card: board context ("N of M"), the action strip,+ * prev/next navigation and the image identity rows. Later phases add the step+ * message and metadata rail here — never in the widget shell.*/export const PreviewFooter = ({+ actionImage,+ actions,boardImageCount,boardName,+ density,image,isLive,isLoadingBoard,@@ -20,8 +29,11 @@ export const PreviewFooter = ({onPrevious,selectedIndex,}: {+ actionImage: GalleryImage | null;+ actions: ImageActions;boardImageCount: number;boardName: string;+ density: PreviewDensity;image: GeneratedImageContract;isLive: boolean;isLoadingBoard: boolean;@@ -47,6 +59,12 @@ export const PreviewFooter = ({</Text></HStack><HStack flexShrink={0} gap="1">+ {actionImage ? (+ <>+ <PreviewActionStrip actions={actions} density={density} image={actionImage} />+ <Box bg="border.subtle" flexShrink={0} h="4" mx="0.5" w="1px" />+ </>+ ) : null}<Buttonaria-label={t('widgets.preview.previousImageInBoard')}disabled={selectedIndex <= 0}diff --git a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsxindex 31b61de17d..86e9b4ea2a 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx@@ -11,7 +11,12 @@ import {type GalleryView,} from '@workbench/gallery/api';import { getGallerySettings } from '@workbench/gallery/settings';-import { ImageContextMenu, useImageActions, type ImageContextMenuTarget } from '@workbench/image-actions';+import {+ ImageContextMenu,+ useImageActions,+ type ImageActions,+ type ImageContextMenuTarget,+} from '@workbench/image-actions';import { imageUrlToStreamingSource, progressImageToStreamingSource } from '@workbench/images/streamingImageSource';import { useStreamingImageSource } from '@workbench/images/useStreamingImageSource';import {@@ -418,6 +423,8 @@ export const PreviewWidgetView = ({ region, runtime }: WidgetViewProps) => {/>) : (<SelectedImagePreview+ actionImage={contextMenuImage}+ actions={imageActions}boardImageCount={boardImages.length}boardName={boardName}density={density}@@ -449,6 +456,8 @@ export const PreviewWidgetView = ({ region, runtime }: WidgetViewProps) => {};const SelectedImagePreview = ({+ actionImage,+ actions,boardImageCount,boardName,density,@@ -461,6 +470,8 @@ const SelectedImagePreview = ({onNext,onPrevious,}: {+ actionImage: GalleryImage | null;+ actions: ImageActions;boardImageCount: number;boardName: string;density: PreviewDensity;@@ -516,8 +527,11 @@ const SelectedImagePreview = ({onContextMenu={onContextMenu}/><PreviewFooter+ actionImage={actionImage}+ actions={actions}boardImageCount={boardImageCount}boardName={boardName}+ density={density}image={image}isLive={isProgressImage}isLoadingBoard={isLoadingBoard}