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(notifications): open the notification center as a popover
Josh Corbett3cc7e0a4105f
diff --git a/invokeai/frontend/webv2/src/workbench/shell/BottomPanel.tsx b/invokeai/frontend/webv2/src/workbench/shell/BottomPanel.tsxindex 2d00d8d461..affa5b097f 100644--- a/invokeai/frontend/webv2/src/workbench/shell/BottomPanel.tsx+++ b/invokeai/frontend/webv2/src/workbench/shell/BottomPanel.tsx@@ -19,7 +19,8 @@ export const BottomPanel = () => {!bottomRegion.isCollapsed &&bottomRegion.instanceIds.includes(bottomRegion.activeInstanceId) &&widget?.status === 'enabled' &&- widget.manifest.bottomPanel !== 'tooltip';+ widget.manifest.bottomPanel !== 'tooltip' &&+ widget.manifest.bottomPanel !== 'popover';if (!canShowBottomPanel) {return null;diff --git a/invokeai/frontend/webv2/src/workbench/shell/StatusBar.tsx b/invokeai/frontend/webv2/src/workbench/shell/StatusBar.tsxindex 64eaf21577..c7c6a3b700 100644--- a/invokeai/frontend/webv2/src/workbench/shell/StatusBar.tsx+++ b/invokeai/frontend/webv2/src/workbench/shell/StatusBar.tsx@@ -2,9 +2,9 @@ import type { WidgetInstanceId } from '@workbench/widgetContracts';import type { WidgetRegionDropState } from '@workbench/widgetDnd';import type { PlacedWidgetRegionItem, WidgetPlacementInstanceMeta } from '@workbench/widgetRegionViewModel';-import { Box } from '@chakra-ui/react';+import { Box, Popover, Portal } from '@chakra-ui/react';import { horizontalListSortingStrategy } from '@dnd-kit/sortable';-import { Row, Tooltip } from '@platform/ui';+import { PopoverContent, Row, Tooltip } from '@platform/ui';import {WidgetEnableMenu,WidgetInstanceContextMenu,@@ -22,6 +22,7 @@ import {getWidgetRegionItems,isCompactBottomItem,isExpandableBottomItem,+ isPopoverBottomItem,} from '@workbench/widgetRegionViewModel';import { getWidgetById, getWidgetsForRegion } from '@workbench/widgetRegistry';import { useActiveProjectSelector, useWorkbenchCommands } from '@workbench/WorkbenchContext';@@ -30,9 +31,11 @@ import { useTranslation } from 'react-i18next';interface BottomWidgetItem extends PlacedWidgetRegionItem<WidgetPlacementInstanceMeta> {isExpandable: boolean;+ isPopover: boolean;}const BOTTOM_MENU_POSITIONING = { placement: 'top-end' } as const;+const WIDGET_POPOVER_POSITIONING = { placement: 'top-end' } as const;const BOTTOM_MENU_TRIGGER = { kind: 'bottom' } as const;/*** Same three-step ladder as the side rails (see `WidgetBar`): the brand hue@@ -68,7 +71,7 @@ export const StatusBar = ({ dropState }: { dropState: WidgetRegionDropState }) =return [];}- return [{ ...item, isExpandable: isExpandableBottomItem(item) }];+ return [{ ...item, isExpandable: isExpandableBottomItem(item), isPopover: isPopoverBottomItem(item) }];});const sortableInstanceIds = useMemo(() => compactItems.map((item) => item.id), [compactItems]);const openEnableMenu = useCallback((event: MouseEvent) => {@@ -169,28 +172,40 @@ const CompactBottomWidget = ({region: 'bottom',typeId: item.typeId,});- const rowDragHandleProps = item.isExpandable+ const [isPopoverOpen, setIsPopoverOpen] = useState(false);+ const isActivatable = item.isExpandable || item.isPopover;+ const rowDragHandleProps = isActivatable? Object.fromEntries(Object.entries(dragHandleProps).filter(([key]) => key !== 'onKeyDown')): dragHandleProps;const handleKeyDown = useCallback(- (event: KeyboardEvent) => {- if (event.key === 'Enter' || event.key === ' ') {- event.preventDefault();- onSelect(item.id);+ (event: KeyboardEvent<HTMLElement>) => {+ if (event.key !== 'Enter' && event.key !== ' ') {+ return;}++ event.preventDefault();++ // A popover chip is a real Popover.Trigger; a div gets no native+ // Enter/Space click, so synthesize one for the trigger's own handling.+ if (item.isPopover) {+ event.currentTarget.click();+ return;+ }++ onSelect(item.id);},- [item.id, onSelect]+ [item.id, item.isPopover, onSelect]);const activationProps = useMemo(() =>- item.isExpandable+ isActivatable? {role: 'button' as const,tabIndex: 0,onKeyDown: handleKeyDown,}: {},- [handleKeyDown, item.isExpandable]+ [handleKeyDown, isActivatable]);const handleClick = useCallback(() => {if (item.isExpandable) {@@ -198,43 +213,90 @@ const CompactBottomWidget = ({}}, [item.id, item.isExpandable, onSelect]);const handleContextMenu = useCallback((event: MouseEvent) => onContextMenu(item, event), [item, onContextMenu]);+ const handlePopoverOpenChange = useCallback((event: { open: boolean }) => setIsPopoverOpen(event.open), []);const tooltipContent = useMemo(() => (item.instance ? <BottomWidgetTooltipContent item={item} /> : null), [item]);+ const isRowActive = item.isPopover ? isPopoverOpen : isActive;+ const row = (+ <Row+ {...rowDragHandleProps}+ aria-label={item.label}+ aria-pressed={item.isPopover ? undefined : isRowActive}+ color={isRowActive ? undefined : 'fg.muted'}+ cursor={isDragging ? 'grabbing' : 'default'}+ h="full"+ w="auto"+ {...(isRowActive ? COMPACT_ROW_ACTIVE_PROPS : null)}+ _hover={isRowActive ? COMPACT_ROW_ACTIVE_HOVER_PROPS : COMPACT_ROW_HOVER_PROPS}+ {...activationProps}+ onClick={handleClick}+ onContextMenu={handleContextMenu}+ >+ {item.instance ? (+ <WidgetRendererById instanceId={item.id} widget={item.widget} presentation="compact" region="bottom" />+ ) : null}+ </Row>+ );+ // The Row is the popover's actual trigger (toggle, dismissal exemption,+ // focus restore, aria) while the outer Box keeps the tooltip's trigger id —+ // two elements, so the two machines never fight over one `id`.const content = (<Box ref={setNodeRef} h="full" style={style}>- <Row- {...rowDragHandleProps}- aria-label={item.label}- aria-pressed={isActive}- color={isActive ? undefined : 'fg.muted'}- cursor={isDragging ? 'grabbing' : item.isExpandable ? 'pointer' : 'default'}- h="full"- w="auto"- {...(isActive ? COMPACT_ROW_ACTIVE_PROPS : null)}- _hover={isActive ? COMPACT_ROW_ACTIVE_HOVER_PROPS : COMPACT_ROW_HOVER_PROPS}- {...activationProps}- onClick={handleClick}- onContextMenu={handleContextMenu}- >- {item.instance ? (- <WidgetRendererById instanceId={item.id} widget={item.widget} presentation="compact" region="bottom" />- ) : null}- </Row>+ {item.isPopover ? <Popover.Trigger asChild>{row}</Popover.Trigger> : row}</Box>);- if (item.isExpandable) {+ const labelTooltip = (+ <Tooltip+ closeDelay={80}+ content={item.failureMessage ? `${item.label}: ${item.failureMessage}` : item.label}+ openDelay={250}+ positioning={TOOLTIP_POSITIONING}+ >+ {content}+ </Tooltip>+ );++ if (item.isPopover) {+ // VSCode-style notification center: the chip anchors a large dismissable+ // popover instead of claiming the shared bottom panel.return (- <Tooltip- closeDelay={80}- content={item.failureMessage ? `${item.label}: ${item.failureMessage}` : item.label}- openDelay={250}- positioning={TOOLTIP_POSITIONING}+ <Popover.Root+ lazyMount+ open={isPopoverOpen}+ positioning={WIDGET_POPOVER_POSITIONING}+ unmountOnExit+ onOpenChange={handlePopoverOpenChange}>- {content}- </Tooltip>+ {labelTooltip}+ <Portal>+ <Popover.Positioner>+ <PopoverContent+ display="flex"+ flexDirection="column"+ maxH="min(28rem, var(--available-height))"+ overflow="hidden"+ p="0"+ w="26rem"+ >+ {item.instance ? (+ <WidgetRendererById+ instanceId={item.id}+ widget={item.widget}+ presentation="expanded"+ region="popover"+ />+ ) : null}+ </PopoverContent>+ </Popover.Positioner>+ </Portal>+ </Popover.Root>);}+ if (item.isExpandable) {+ return labelTooltip;+ }+return (<Tooltip closeDelay={80} content={tooltipContent} openDelay={250} positioning={TOOLTIP_POSITIONING}>{content}diff --git a/invokeai/frontend/webv2/src/workbench/widgetContracts.ts b/invokeai/frontend/webv2/src/workbench/widgetContracts.tsindex 191eac006f..fff2c3547e 100644--- a/invokeai/frontend/webv2/src/workbench/widgetContracts.ts+++ b/invokeai/frontend/webv2/src/workbench/widgetContracts.ts@@ -296,7 +296,8 @@ export interface WidgetManifest {allowedRegions: WidgetRegion[];allowMultiple: boolean;icon: WidgetIconComponent;- bottomPanel?: 'expandable' | 'tooltip';+ /** `popover`: the compact chip opens a dismissable popover instead of claiming the bottom panel. */+ bottomPanel?: 'expandable' | 'tooltip' | 'popover';centerPlacement?: 'toolbar' | 'view';/** Opt-in: the widget can be detached into a movable floating window. */allowFloating?: boolean;diff --git a/invokeai/frontend/webv2/src/workbench/widgetRegionViewModel.ts b/invokeai/frontend/webv2/src/workbench/widgetRegionViewModel.tsindex 2ea771ed4b..72ccb13903 100644--- a/invokeai/frontend/webv2/src/workbench/widgetRegionViewModel.ts+++ b/invokeai/frontend/webv2/src/workbench/widgetRegionViewModel.ts@@ -157,7 +157,11 @@ export const isCompactBottomItem = <Instance extends WidgetPlacementInstanceMetaexport const isExpandableBottomItem = <Instance extends WidgetPlacementInstanceMeta>(item: WidgetRegionItem<Instance>-): boolean => item.widget.manifest.bottomPanel !== 'tooltip';+): boolean => item.widget.manifest.bottomPanel !== 'tooltip' && item.widget.manifest.bottomPanel !== 'popover';++export const isPopoverBottomItem = <Instance extends WidgetPlacementInstanceMeta>(+ item: WidgetRegionItem<Instance>+): boolean => item.widget.manifest.bottomPanel === 'popover';export const canRemoveItem = (item: WidgetRegionItem, viewModel: WidgetRegionViewModel): boolean => {if (viewModel.region !== 'center') {diff --git a/invokeai/frontend/webv2/src/workbench/widgets/notifications/NotificationsWidgetView.tsx b/invokeai/frontend/webv2/src/workbench/widgets/notifications/NotificationsWidgetView.tsxindex 7fd6c24252..fffedef3bc 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/notifications/NotificationsWidgetView.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/notifications/NotificationsWidgetView.tsx@@ -2,11 +2,14 @@ import type { WorkbenchNotificationKind } from '@workbench/projectContracts';import type { WidgetViewProps } from '@workbench/widgetContracts';import { Badge, HStack, Icon, Stack, Text } from '@chakra-ui/react';+import { Scrollable } from '@platform/ui/Scrollable';import { StatusWidgetChip } from '@workbench/widget-frame';import { useWorkbenchSelector } from '@workbench/WorkbenchContext';import { BellIcon, CircleCheckIcon, CircleXIcon, InfoIcon, TriangleAlertIcon, type LucideIcon } from 'lucide-react';import { useTranslation } from 'react-i18next';+import { NotificationsHeaderActions } from './NotificationsHeaderActions';+const kindColorPalette: Record<WorkbenchNotificationKind, string> = {error: 'red',info: 'blue',@@ -36,6 +39,24 @@ export const NotificationsWidgetView = ({ presentation, region }: WidgetViewPropreturn <StatusWidgetChip icon={icon}>{t('notifications.labelWithCount', { label })}</StatusWidgetChip>;}+ // The popover renders the view bare (no widget-frame header), so the header+ // actions that frame would have mounted live here instead.+ if (region === 'popover') {+ return (+ <Stack flex="1" gap="0" minH="0">+ <HStack borderBottomWidth="1px" borderColor="border.subtle" justify="space-between" px="2" py="1.5">+ <Text color="fg.subtle" fontSize="2xs" fontWeight="700" textTransform="uppercase">+ {t('widgets.labels.notifications')}+ </Text>+ <NotificationsHeaderActions />+ </HStack>+ <Scrollable minH="0">+ <NotificationsPanel />+ </Scrollable>+ </Stack>+ );+ }+return <NotificationsPanel />;};diff --git a/invokeai/frontend/webv2/src/workbench/widgets/notifications/manifest.ts b/invokeai/frontend/webv2/src/workbench/widgets/notifications/manifest.tsindex fc77311f6f..36a416fb5e 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/notifications/manifest.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/notifications/manifest.ts@@ -5,7 +5,7 @@ import { BellIcon } from 'lucide-react';export const notificationsWidgetManifest: WidgetManifest = {allowMultiple: false,allowedRegions: ['bottom'],- bottomPanel: 'expandable',+ bottomPanel: 'popover',failurePolicy: { isolateRenderFailure: true, onRegistrationFailure: 'disable' },icon: BellIcon,id: 'notifications',