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.

feat(ui): polish scrubber, splash, toasts, badges, and invoke spinner

Josh Corbett372da1d3c2e8
diff --git a/invokeai/frontend/webv2/src/platform/ui/ScrubberField.tsx b/invokeai/frontend/webv2/src/platform/ui/ScrubberField.tsx
index bb3edab2db..02b6753fb4 100644
--- a/invokeai/frontend/webv2/src/platform/ui/ScrubberField.tsx
+++ b/invokeai/frontend/webv2/src/platform/ui/ScrubberField.tsx
@@ -17,6 +17,8 @@ import { useTranslation } from 'react-i18next';
/** Track inset from the frame edge; the text padding clears it so the thumb never crosses a glyph. */
const TRACK_INSET_PX = 10;
+/** The fill runs this far past the thumb so its rounded end frames it. */
+const FILL_OVERHANG_PX = 6;
/** Shift-drag moves the value this fraction of the pointer's track distance. */
const FINE_DRAG_RATIO = 0.1;
/** Shift/PageUp/PageDown step multiplier. */
@@ -98,6 +100,8 @@ const ROOT_CSS = {
'&[data-dragging]': { borderColor: 'border.emphasized' },
'& [data-part="fill"]': {
bg: 'bg.emphasized',
+ // Concentric with the frame's corner inside its 1px border.
+ borderEndRadius: 'calc({radii.control} - 1px)',
insetBlock: 0,
insetInlineStart: 0,
pointerEvents: 'none',
@@ -562,7 +566,7 @@ export const ScrubberField = ({
onDoubleClick={handleDoubleClick}
onPointerDown={handlePointerDown}
>
- <div data-part="fill" style={{ width: thumbPosition }} />
+ <div data-part="fill" style={{ width: `calc(${thumbPosition} + ${FILL_OVERHANG_PX}px)` }} />
{markEntries?.map(({ mark, state }) => (
<div
key={mark}
diff --git a/invokeai/frontend/webv2/src/platform/ui/toaster.browser.test.tsx b/invokeai/frontend/webv2/src/platform/ui/toaster.browser.test.tsx
new file mode 100644
index 0000000000..e7f8532f06
--- /dev/null
+++ b/invokeai/frontend/webv2/src/platform/ui/toaster.browser.test.tsx
@@ -0,0 +1,47 @@
+import { ChakraProvider } from '@chakra-ui/react';
+import { AppToaster, toaster } from '@platform/ui/toaster';
+import { system } from '@theme/system';
+import { act } from 'react';
+import { createRoot, type Root } from 'react-dom/client';
+import { afterEach, describe, expect, it } from 'vitest';
+
+let host: HTMLDivElement | null = null;
+let root: Root | null = null;
+(globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
+
+afterEach(async () => {
+ await act(() => toaster.remove());
+ await act(() => root?.unmount());
+ host?.remove();
+ host = null;
+ root = null;
+});
+
+describe('AppToaster', () => {
+ it('wraps unbroken model sources inside the toast', async () => {
+ host = document.createElement('div');
+ document.body.append(host);
+ root = createRoot(host);
+ await act(() => {
+ root?.render(
+ <ChakraProvider value={system}>
+ <AppToaster />
+ </ChakraProvider>
+ );
+ });
+ await act(() => {
+ toaster.create({
+ description:
+ 'stabilityai/stable-diffusion-xl-base-1.0::sd_xl_base_1.0_0.9vae_with_a_very_long_filename.safetensors',
+ title: 'Model installed',
+ type: 'success',
+ });
+ });
+ await expect.poll(() => document.querySelector('[data-part="description"]')).not.toBeNull();
+ const description = document.querySelector<HTMLElement>('[data-part="description"]')!;
+ const toastRoot = description.closest<HTMLElement>('[data-part="root"]')!;
+
+ expect(description.getBoundingClientRect().right).toBeLessThanOrEqual(toastRoot.getBoundingClientRect().right);
+ expect(description.scrollWidth).toBeLessThanOrEqual(description.clientWidth);
+ });
+});
diff --git a/invokeai/frontend/webv2/src/platform/ui/toaster.tsx b/invokeai/frontend/webv2/src/platform/ui/toaster.tsx
index 292a14d923..f81421d44e 100644
--- a/invokeai/frontend/webv2/src/platform/ui/toaster.tsx
+++ b/invokeai/frontend/webv2/src/platform/ui/toaster.tsx
@@ -22,10 +22,11 @@ export const AppToaster = () => (
<Portal>
<ChakraToaster toaster={toaster}>
{(toast) => (
- <ToastRoot maxW="calc(100vw - 2rem)" overflowWrap="anywhere" w="24rem">
- <HStack align="start" gap="3">
+ <ToastRoot maxW="calc(100vw - 2rem)" w="24rem">
+ {/* Unbroken model names, paths, and URLs wrap only once the flex chain may shrink below them. */}
+ <HStack align="start" gap="3" minW="0" w="full">
<ToastIndicator />
- <Stack gap="1" flex="1">
+ <Stack flex="1" gap="1" minW="0">
{toast.title ? <ToastTitle>{toast.title}</ToastTitle> : null}
{toast.description ? <ToastDescription>{toast.description}</ToastDescription> : null}
</Stack>
diff --git a/invokeai/frontend/webv2/src/workbench/components/WorkbenchSplashScreen.tsx b/invokeai/frontend/webv2/src/workbench/components/WorkbenchSplashScreen.tsx
index b917c66f31..db8d9ea4e5 100644
--- a/invokeai/frontend/webv2/src/workbench/components/WorkbenchSplashScreen.tsx
+++ b/invokeai/frontend/webv2/src/workbench/components/WorkbenchSplashScreen.tsx
@@ -2,6 +2,7 @@ import splashImageUrl from '@assets/SplashImage.webp';
import { Box, Flex, Heading, HStack, Spinner, Text, VStack } from '@chakra-ui/react';
import { APP_VERSION } from '@platform/runtime/appMetadata';
import { InvokeMark } from '@platform/ui/InvokeMark';
+import { previewGridCss } from '@workbench/widgets/preview/PreviewStage';
import { useTranslation } from 'react-i18next';
const splashImageStyle = { backgroundPosition: 'center', backgroundSize: 'cover' } as const;
@@ -10,9 +11,21 @@ export const WorkbenchSplashScreen = ({ messageKey = 'splash.loadingWorkspace' }
const { t } = useTranslation();
return (
- <Flex align="center" aria-busy="true" bg="bg" color="fg" h="100vh" justify="center" role="status" w="100vw">
+ <Flex
+ align="center"
+ aria-busy="true"
+ backgroundColor="bg.inset"
+ color="fg.grid"
+ css={previewGridCss}
+ h="100vh"
+ justify="center"
+ role="status"
+ w="100vw"
+ >
<Box
position="relative"
+ bg="bg"
+ color="fg"
borderColor="border.subtle"
borderRadius="3xl"
borderWidth="1px"
diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/LaunchpadTopBar.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/LaunchpadTopBar.tsx
index b1ba40875d..791ad8b53f 100644
--- a/invokeai/frontend/webv2/src/workbench/launchpad/LaunchpadTopBar.tsx
+++ b/invokeai/frontend/webv2/src/workbench/launchpad/LaunchpadTopBar.tsx
@@ -1,6 +1,6 @@
import type { BackendConnectionStatus } from '@platform/transport/types';
-import { Box, Flex, HStack, Text } from '@chakra-ui/react';
+import { Badge, Box, Flex, HStack, Text } from '@chakra-ui/react';
import { AccountMenu } from '@features/identity';
import { useConnectionStatusSelector } from '@platform/transport/connectionStore';
import { InvokeMark } from '@platform/ui/InvokeMark';
@@ -21,24 +21,11 @@ const ConnectionChip = () => {
return null;
}
- const isDown = status === 'disconnected';
-
return (
- <HStack
- aria-live="polite"
- bg="bg.muted"
- borderColor={isDown ? 'border.error' : 'border.subtle'}
- borderWidth="1px"
- gap="1.5"
- px="2.5"
- py="1"
- rounded="full"
- >
- <Box aria-hidden bg={isDown ? 'fg.error' : 'fg.muted'} boxSize="1.5" rounded="full" />
- <Text color={isDown ? 'fg.error' : 'fg.muted'} fontSize="2xs" fontWeight="600">
- {t(CONNECTION_LABEL_KEY[status])}
- </Text>
- </HStack>
+ <Badge aria-live="polite" colorPalette={status === 'disconnected' ? 'red' : 'gray'} size="md" variant="subtle">
+ <Box aria-hidden bg="currentColor" boxSize="1.5" rounded="full" />
+ {t(CONNECTION_LABEL_KEY[status])}
+ </Badge>
);
};
diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.browser.test.tsx
index 86f83e3cb7..c5a4461375 100644
--- a/invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.browser.test.tsx
@@ -13,7 +13,7 @@ import type * as UseTopbarShortcutModule from './useTopbarShortcut';
// Verify progress returns after hover ends unless focus-visible remains; mouse click-focus must not pin the play
// icon. Mock queue plumbing to isolate that gate.
const harness = vi.hoisted(() => ({
- progress: { activeItemIndex: 1, completedItemCount: 0, message: '', percentage: 0.42 },
+ progress: { activeItemIndex: 1, completedItemCount: 0, message: '', percentage: 0.42 as number | null },
summary: { current: 1, remaining: 1, runningQueueItemId: 'item-1', total: 1 },
}));
@@ -73,6 +73,7 @@ const renderInvokeButton = async (overrides: Partial<InvocationState> = {}) => {
};
const hasProgressRing = (button: HTMLButtonElement): boolean => button.querySelector('[role="progressbar"]') !== null;
+const hasSpinner = (button: HTMLButtonElement): boolean => button.querySelector('.chakra-spinner') !== null;
beforeEach(() => {
harness.progress.percentage = 0.42;
@@ -119,6 +120,14 @@ describe('InvokeButton icon slot', () => {
expect(hasProgressRing(button)).toBe(false);
});
+ it('uses the app spinner, not an indeterminate ring, while progress is unknown', async () => {
+ harness.progress.percentage = null;
+ const { button } = await renderInvokeButton();
+
+ expect(hasSpinner(button)).toBe(true);
+ expect(hasProgressRing(button)).toBe(false);
+ });
+
it('acknowledges canvas preparation immediately and ignores a second click', async () => {
harness.summary.total = 0;
const invoke = vi.fn(() => Promise.resolve());
@@ -126,7 +135,7 @@ describe('InvokeButton icon slot', () => {
expect(button.getAttribute('aria-disabled')).toBe('true');
expect(button.getAttribute('aria-label')).toBe('topbar.invoke.preparing');
- expect(hasProgressRing(button)).toBe(true);
+ expect(hasSpinner(button)).toBe(true);
await act(() => button.click());
diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.tsx b/invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.tsx
index 65e2a54473..c224a0169a 100644
--- a/invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.tsx
+++ b/invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeButton.tsx
@@ -1,6 +1,6 @@
import type { ComponentProps, FocusEvent } from 'react';
-import { Box, HStack, Icon, Kbd, ProgressCircle, Separator, Stack, Text } from '@chakra-ui/react';
+import { Box, HStack, Icon, Kbd, ProgressCircle, Separator, Spinner, Stack, Text } from '@chakra-ui/react';
import { getDeterminateProgressFraction } from '@features/queue/contracts';
import { Button } from '@platform/ui/Button';
import { Tooltip } from '@platform/ui/Tooltip';
@@ -101,15 +101,18 @@ export const InvokeButton = ({ state }: { state: InvocationState }) => {
zIndex="2"
>
<Box alignItems="center" boxSize="3.5" display="flex" justifyContent="center" position="relative">
- {iconMode.mode === 'progress' ? (
- <ProgressCircle.Root size={ICON_RING_SIZE} value={iconMode.value === null ? null : iconMode.value * 100}>
+ {iconMode.mode === 'play' ? (
+ <Icon as={PlayIcon} boxSize="3.5" />
+ ) : iconMode.value === null ? (
+ // The app-wide spinner, not the ring's indeterminate sweep, for unknown progress.
+ <Spinner borderWidth="1.5px" boxSize="3.5" color="bg" />
+ ) : (
+ <ProgressCircle.Root size={ICON_RING_SIZE} value={iconMode.value * 100}>
<ProgressCircle.Circle>
<ProgressCircle.Track stroke="bg/40" />
<ProgressCircle.Range stroke="bg" strokeLinecap="round" />
</ProgressCircle.Circle>
</ProgressCircle.Root>
- ) : (
- <Icon as={PlayIcon} boxSize="3.5" />
)}
</Box>
{t('topbar.invoke.invoke')}