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(queue): steady status chip and tabbed filters

Josh Corbettdebcab3784a9
diff --git a/invokeai/frontend/webv2/src/features/queue/ui/QueueFilterTabs.tsx b/invokeai/frontend/webv2/src/features/queue/ui/QueueFilterTabs.tsx
index deb6c9fc12..6816accf4b 100644
--- a/invokeai/frontend/webv2/src/features/queue/ui/QueueFilterTabs.tsx
+++ b/invokeai/frontend/webv2/src/features/queue/ui/QueueFilterTabs.tsx
@@ -1,12 +1,14 @@
-import { SegmentGroup } from '@chakra-ui/react';
-import { useCallback } from 'react';
+import { SegmentTabs, type SegmentTab } from '@platform/ui';
+import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import type { QueueFilterId } from './queueFilters';
import { QUEUE_FILTERS } from './queueFilters';
-/** Status filter pills for the RECENT list (All · Active · Done · Failed · Canceled). */
+export const QUEUE_FILTER_TABS_ID = 'queue-filter';
+
+/** Status filter tabs for the RECENT list (All · Active · Done · Failed · Canceled). */
export const QueueFilterTabs = ({
value,
onChange,
@@ -15,30 +17,19 @@ export const QueueFilterTabs = ({
onChange: (filter: QueueFilterId) => void;
}) => {
const { t } = useTranslation();
- const onValueChange = useCallback(
- (details: { value: string | null }) => {
- if (details.value) {
- onChange(details.value as QueueFilterId);
- }
- },
- [onChange]
+ const tabs = useMemo<SegmentTab<QueueFilterId>[]>(
+ () => QUEUE_FILTERS.map((filter) => ({ id: filter.id, label: t(filter.labelKey) })),
+ [t]
);
return (
- <SegmentGroup.Root
- aria-label={t('widgets.queue.filterRecentByStatus')}
- colorPalette="accent"
- size="xs"
- value={value}
- onValueChange={onValueChange}
- >
- <SegmentGroup.Indicator />
- {QUEUE_FILTERS.map((filter) => (
- <SegmentGroup.Item key={filter.id} value={filter.id}>
- <SegmentGroup.ItemHiddenInput />
- <SegmentGroup.ItemText>{t(filter.labelKey)}</SegmentGroup.ItemText>
- </SegmentGroup.Item>
- ))}
- </SegmentGroup.Root>
+ <SegmentTabs
+ isCompact
+ activeId={value}
+ ariaLabel={t('widgets.queue.filterRecentByStatus')}
+ idBase={QUEUE_FILTER_TABS_ID}
+ tabs={tabs}
+ onSelect={onChange}
+ />
);
};
diff --git a/invokeai/frontend/webv2/src/features/queue/ui/RecentSection.tsx b/invokeai/frontend/webv2/src/features/queue/ui/RecentSection.tsx
index 8398f28ce2..d3fef924f3 100644
--- a/invokeai/frontend/webv2/src/features/queue/ui/RecentSection.tsx
+++ b/invokeai/frontend/webv2/src/features/queue/ui/RecentSection.tsx
@@ -1,5 +1,6 @@
import { Stack, Text } from '@chakra-ui/react';
import { useMountEffect } from '@platform/react/useMountEffect';
+import { segmentTabsPanelId, segmentTabsTabId } from '@platform/ui';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -7,6 +8,7 @@ import type { QueueFilterId } from './queueFilters';
import { useCurrentBatchItems, useQueueLoadState, useRecentItems } from './queueDataStore';
import { matchesFilter } from './queueFilters';
+import { QUEUE_FILTER_TABS_ID } from './QueueFilterTabs';
import { QueueItemRow } from './QueueItemRow';
import { clearPendingQueueItemReveal, type QueueItemRevealRequest } from './queueUiStore';
import { SectionHeader } from './SectionHeader';
@@ -40,7 +42,12 @@ export const RecentSection = ({
!items.some((item) => item.id === revealRequest.itemId);
return (
- <Stack gap="2">
+ <Stack
+ aria-labelledby={segmentTabsTabId(QUEUE_FILTER_TABS_ID, filter)}
+ gap="2"
+ id={segmentTabsPanelId(QUEUE_FILTER_TABS_ID)}
+ role="tabpanel"
+ >
{cannotReveal && revealRequest ? (
<UnavailableRevealConsumer key={revealRequest.requestId} request={revealRequest} />
) : null}
diff --git a/invokeai/frontend/webv2/src/features/queue/ui/launchpad/QueueStatusBand.tsx b/invokeai/frontend/webv2/src/features/queue/ui/launchpad/QueueStatusBand.tsx
index 87704ff8c5..a8977efa69 100644
--- a/invokeai/frontend/webv2/src/features/queue/ui/launchpad/QueueStatusBand.tsx
+++ b/invokeai/frontend/webv2/src/features/queue/ui/launchpad/QueueStatusBand.tsx
@@ -1,8 +1,8 @@
-import { Flex, Icon, Text } from '@chakra-ui/react';
+import { Flex, Icon, Spinner, Text } from '@chakra-ui/react';
import { queueBackend } from '@features/queue/data/httpRealtimeQueueBackend';
import { queueReadModelOptions } from '@features/queue/data/queries';
import { useQuery } from '@tanstack/react-query';
-import { LoaderCircleIcon } from 'lucide-react';
+import { HourglassIcon } from 'lucide-react';
import { useTranslation } from 'react-i18next';
/**
@@ -60,7 +60,13 @@ export const QueueStatusBand = () => {
py="2"
rounded="lg"
>
- <Icon aria-hidden as={LoaderCircleIcon} boxSize="3.5" color="fg.muted" />
+ {/* A real spinner while something runs; a static glyph for a queue that
+ is only waiting, so the band does not claim activity it cannot show. */}
+ {inProgress > 0 ? (
+ <Spinner color="fg.muted" size="xs" />
+ ) : (
+ <Icon aria-hidden as={HourglassIcon} boxSize="3.5" color="fg.muted" />
+ )}
<Text fontSize="xs" fontWeight="600">
{t('launchpad.home.queue.summary', { inProgress, pending })}
</Text>
diff --git a/invokeai/frontend/webv2/src/platform/ui/StatusWidgetChip.tsx b/invokeai/frontend/webv2/src/platform/ui/StatusWidgetChip.tsx
index b6ad8d268a..c53e01edaa 100644
--- a/invokeai/frontend/webv2/src/platform/ui/StatusWidgetChip.tsx
+++ b/invokeai/frontend/webv2/src/platform/ui/StatusWidgetChip.tsx
@@ -23,6 +23,22 @@ const PROGRESS_FILL_SX: SystemStyleObject = {
transition: 'width var(--wb-motion-duration-fast) linear',
};
+/**
+ * Indeterminate: a band sweeping the track, so "working, no percent yet"
+ * (model load, graph prep) reads as activity instead of a stuck bar. Under
+ * reduce-motion the band does not run at all; the quiet fill carries the state.
+ */
+const PROGRESS_SWEEP_SX: SystemStyleObject = {
+ ':root[data-reduce-motion="true"] &': { animationName: 'none' },
+ animationDuration: '1.4s',
+ animationIterationCount: 'infinite',
+ animationName: 'wb-status-sweep',
+ animationTimingFunction: 'ease-in-out',
+ bg: 'accent.solid',
+ height: 'full',
+ width: '33%',
+};
+
export const StatusWidgetChip = ({
children,
icon,
@@ -42,12 +58,15 @@ export const StatusWidgetChip = ({
<Icon as={icon} boxSize="3" />
<Text whiteSpace="nowrap">{children}</Text>
{progress ? (
- <Box aria-hidden="true" css={PROGRESS_TRACK_SX}>
- <Box
- css={PROGRESS_FILL_SX}
- opacity={progress.value === null ? 0.35 : 1}
- width={`${(progress.value ?? 1) * 100}%`}
- />
+ <Box aria-hidden="true" css={PROGRESS_TRACK_SX} overflow="hidden">
+ {progress.value === null ? (
+ <>
+ <Box css={PROGRESS_FILL_SX} opacity={0.35} position="absolute" width="full" />
+ <Box css={PROGRESS_SWEEP_SX} position="absolute" />
+ </>
+ ) : (
+ <Box css={PROGRESS_FILL_SX} width={`${progress.value * 100}%`} />
+ )}
</Box>
) : null}
</HStack>
diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/system.ts b/invokeai/frontend/webv2/src/platform/ui/theme/system.ts
index 081f6d7bff..41930cf04e 100644
--- a/invokeai/frontend/webv2/src/platform/ui/theme/system.ts
+++ b/invokeai/frontend/webv2/src/platform/ui/theme/system.ts
@@ -343,6 +343,13 @@ const config = defineConfig({
},
},
theme: {
+ keyframes: {
+ // A band crossing an indeterminate progress track (StatusWidgetChip).
+ 'wb-status-sweep': {
+ from: { transform: 'translateX(-100%)' },
+ to: { transform: 'translateX(300%)' },
+ },
+ },
tokens: {
// Pro-app convention: controls keep the default arrow cursor; pointer is
// reserved for links. Overrides Chakra's `button`/`switch` pointer tokens.
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/queue-status/QueueStatusWidgetView.tsx b/invokeai/frontend/webv2/src/workbench/widgets/queue-status/QueueStatusWidgetView.tsx
index bc277c3049..d0eddabfff 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/queue-status/QueueStatusWidgetView.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/queue-status/QueueStatusWidgetView.tsx
@@ -20,13 +20,14 @@ export const QueueStatusWidgetView = ({ presentation }: WidgetViewProps) => {
const summary = getQueueSummary(queueItems);
const chip = getQueueStatusChip(summary, isPaused);
const percent = getDeterminateProgressPercent(progress?.percentage);
- const baseLabel =
+ const label =
chip.labelKey === 'idle'
? t('widgets.queueStatus.idle')
: t(`widgets.queueStatus.${chip.labelKey}`, { count: chip.count });
// The count answers "how much is left"; the percent answers "how far into the
// current one", which is the half the chip was missing.
- const label = chip.tone === 'running' && percent !== null ? `${baseLabel} · ${percent}%` : baseLabel;
+ const showPercent = chip.tone === 'running' && percent !== null;
+ const detail = chip.tone === 'running' ? progress?.message.trim() : undefined;
if (presentation === 'tooltip') {
return (
@@ -35,8 +36,13 @@ export const QueueStatusWidgetView = ({ presentation }: WidgetViewProps) => {
{t('widgets.labels.queueStatus')}
</Text>
<Text color="fg.subtle" fontSize="2xs">
- {label}
+ {showPercent ? `${label} · ${percent}%` : label}
</Text>
+ {detail ? (
+ <Text color="fg.subtle" fontSize="2xs">
+ {detail}
+ </Text>
+ ) : null}
</Stack>
);
}
@@ -47,6 +53,13 @@ export const QueueStatusWidgetView = ({ presentation }: WidgetViewProps) => {
progress={getQueueStatusProgress(chip, progress?.percentage)}
>
{label}
+ {/* Reserved, tabular digits: the chip must not reflow the status bar as
+ the percent ticks from 9 to 10 to 100. */}
+ {showPercent ? (
+ <Text as="span" display="inline-block" fontVariantNumeric="tabular-nums" minW="7ch" textAlign="end">
+ {` · ${percent}%`}
+ </Text>
+ ) : null}
</StatusWidgetChip>
);
};