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(webv2): share launchpad starts between the Home tiles and the new-project menu

Josh Corbettd32d39fb55bf
diff --git a/invokeai/frontend/webv2/performance/architecture-baseline.json b/invokeai/frontend/webv2/performance/architecture-baseline.json
index 7ce6345fb7..3ebc5ceb22 100644
--- a/invokeai/frontend/webv2/performance/architecture-baseline.json
+++ b/invokeai/frontend/webv2/performance/architecture-baseline.json
@@ -291,6 +291,7 @@
"source:src/workbench/launchpad/projects/projectPins.ts",
"source:src/workbench/launchpad/projects/projectsMetrics.ts",
"source:src/workbench/launchpad/projects/useProjectCardActions.ts",
+ "source:src/workbench/launchpad/startEntries.ts",
"source:src/workbench/palette/LaunchpadCommandPalette.tsx",
"source:src/workbench/palette/PaletteButton.tsx",
"source:src/workbench/palette/paletteStore.ts",
@@ -867,6 +868,7 @@
"source:src/workbench/launchpad/projects/projectPins.ts",
"source:src/workbench/launchpad/projects/projectsMetrics.ts",
"source:src/workbench/launchpad/projects/useProjectCardActions.ts",
+ "source:src/workbench/launchpad/startEntries.ts",
"source:src/workbench/layerPanelState.ts",
"source:src/workbench/layoutContracts.ts",
"source:src/workbench/layoutPresetActivation.ts",
diff --git a/invokeai/frontend/webv2/performance/browser-baseline.json b/invokeai/frontend/webv2/performance/browser-baseline.json
index 9e9d3a4017..9010e39765 100644
--- a/invokeai/frontend/webv2/performance/browser-baseline.json
+++ b/invokeai/frontend/webv2/performance/browser-baseline.json
@@ -703,6 +703,7 @@
"source:src/workbench/launchpad/projects/projectPins.ts",
"source:src/workbench/launchpad/projects/projectsMetrics.ts",
"source:src/workbench/launchpad/projects/useProjectCardActions.ts",
+ "source:src/workbench/launchpad/startEntries.ts",
"source:src/workbench/palette/LaunchpadCommandPalette.tsx",
"source:src/workbench/palette/PaletteButton.tsx",
"source:src/workbench/palette/paletteStore.ts",
@@ -1562,6 +1563,7 @@
"source:src/workbench/launchpad/projects/projectPins.ts",
"source:src/workbench/launchpad/projects/projectsMetrics.ts",
"source:src/workbench/launchpad/projects/useProjectCardActions.ts",
+ "source:src/workbench/launchpad/startEntries.ts",
"source:src/workbench/layerPanelState.ts",
"source:src/workbench/layoutContracts.ts",
"source:src/workbench/layoutPresetActivation.ts",
@@ -2618,6 +2620,7 @@
"source:src/workbench/launchpad/projects/projectPins.ts",
"source:src/workbench/launchpad/projects/projectsMetrics.ts",
"source:src/workbench/launchpad/projects/useProjectCardActions.ts",
+ "source:src/workbench/launchpad/startEntries.ts",
"source:src/workbench/layerPanelState.ts",
"source:src/workbench/layoutContracts.ts",
"source:src/workbench/layoutPresetActivation.ts",
@@ -3878,6 +3881,7 @@
"source:src/workbench/launchpad/projects/projectPins.ts",
"source:src/workbench/launchpad/projects/projectsMetrics.ts",
"source:src/workbench/launchpad/projects/useProjectCardActions.ts",
+ "source:src/workbench/launchpad/startEntries.ts",
"source:src/workbench/layerPanelState.ts",
"source:src/workbench/layoutContracts.ts",
"source:src/workbench/layoutPresetActivation.ts",
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.json
index 11faefd903..9d80d56d91 100644
--- a/invokeai/frontend/webv2/public/locales/en.json
+++ b/invokeai/frontend/webv2/public/locales/en.json
@@ -508,7 +508,7 @@
"unsupportedVersion": "\"{{name}}\" was saved by a newer version of Invoke and cannot be opened here."
},
"newProject": "New project",
- "newProjectWithLayout": "Start with a layout",
+ "newProjectStart": "Choose how to start",
"noSavedProjects": "No saved projects yet.",
"noSavedProjectsDescription": "Create your first project to start generating.",
"noSearchMatches": "No projects match “{{search}}”.",
diff --git a/invokeai/frontend/webv2/src/app/router.tsx b/invokeai/frontend/webv2/src/app/router.tsx
index f5f274d2c3..e0db2864b4 100644
--- a/invokeai/frontend/webv2/src/app/router.tsx
+++ b/invokeai/frontend/webv2/src/app/router.tsx
@@ -25,7 +25,7 @@ import {
useRouter,
} from '@tanstack/react-router';
import { WorkbenchSplashScreen } from '@workbench/components/WorkbenchSplashScreen';
-import { isLaunchpadIntentId, isLaunchpadLayoutId } from '@workbench/launchpad/intents';
+import { isLaunchpadIntentId } from '@workbench/launchpad/intents';
import { Launchpad } from '@workbench/launchpad/Launchpad';
import { ProjectFileOptionsProvider } from '@workbench/projects/components/ProjectFileOptionsProvider';
import { peekOpenProjectIds, type WorkbenchSearch } from '@workbench/projects/session';
@@ -180,7 +180,6 @@ const workbenchRoute = createRoute({
validateSearch: (search: Record<string, unknown>): WorkbenchSearch => ({
intent: isLaunchpadIntentId(search.intent) ? search.intent : undefined,
new: search.new === true || search.new === 'true' || search.new === 1 ? true : undefined,
- preset: isLaunchpadLayoutId(search.preset) ? search.preset : undefined,
project: typeof search.project === 'string' && search.project.length > 0 ? search.project : undefined,
}),
});
diff --git a/invokeai/frontend/webv2/src/workbench/WorkbenchSessionController.tsx b/invokeai/frontend/webv2/src/workbench/WorkbenchSessionController.tsx
index cfdf5e542a..e61300ecf4 100644
--- a/invokeai/frontend/webv2/src/workbench/WorkbenchSessionController.tsx
+++ b/invokeai/frontend/webv2/src/workbench/WorkbenchSessionController.tsx
@@ -27,14 +27,8 @@ const HydratedSessionController = ({ search }: { search: WorkbenchSearch }) => {
// Apply the draft intent before stripping it from search so it runs exactly once.
const intent = resolveLaunchpadIntent(search.intent);
- // A named preset chooses the arrangement; intent may still choose the invocation source.
- if (search.preset) {
- commands.layout.applyPreset(search.preset);
- } else if (intent) {
- commands.layout.applyPreset(intent.presetId);
- }
-
if (intent) {
+ commands.layout.applyPreset(intent.presetId);
commands.generation.setSource(intent.sourceId);
}
diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/home/IntentTiles.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/home/IntentTiles.tsx
index c4f4aad8e2..c76aa711d7 100644
--- a/invokeai/frontend/webv2/src/workbench/launchpad/home/IntentTiles.tsx
+++ b/invokeai/frontend/webv2/src/workbench/launchpad/home/IntentTiles.tsx
@@ -1,11 +1,8 @@
-import type { LaunchpadIntentId } from '@workbench/launchpad/intents';
-import type { LucideIcon } from 'lucide-react';
+import type { LaunchpadStartEntry } from '@workbench/launchpad/startEntries';
import { Icon, SimpleGrid, Stack, Text } from '@chakra-ui/react';
import { Link } from '@tanstack/react-router';
-import { LAUNCHPAD_INTENT_IDS } from '@workbench/launchpad/intents';
-import { BlocksIcon, BrushIcon, ClapperboardIcon, ScalingIcon, TypeIcon } from 'lucide-react';
-import { useMemo } from 'react';
+import { LAUNCHPAD_START_ENTRIES } from '@workbench/launchpad/startEntries';
import { useTranslation } from 'react-i18next';
const TILE_COLUMNS = { base: 1, lg: 5, sm: 2 } as const;
@@ -15,38 +12,11 @@ const TILE_HOVER = { bg: 'bg.muted', borderColor: 'border.emphasized' } as const
const TILE_TRANSITION =
'border-color var(--wb-motion-duration-medium) ease, background var(--wb-motion-duration-medium) ease';
-const INTENT_ICON: Record<LaunchpadIntentId, LucideIcon> = {
- canvas: BrushIcon,
- generate: TypeIcon,
- upscale: ScalingIcon,
- video: ClapperboardIcon,
- workflow: BlocksIcon,
-};
-
-// Spelled out rather than interpolated, so the translation-key test can see
-// them and fail the build if a string goes missing.
-const INTENT_LABEL_KEY: Record<LaunchpadIntentId, string> = {
- canvas: 'launchpad.home.intents.canvas',
- generate: 'launchpad.home.intents.generate',
- upscale: 'launchpad.home.intents.upscale',
- video: 'launchpad.home.intents.video',
- workflow: 'launchpad.home.intents.workflow',
-};
-
-const INTENT_DESCRIPTION_KEY: Record<LaunchpadIntentId, string> = {
- canvas: 'launchpad.home.intents.canvasDescription',
- generate: 'launchpad.home.intents.generateDescription',
- upscale: 'launchpad.home.intents.upscaleDescription',
- video: 'launchpad.home.intents.videoDescription',
- workflow: 'launchpad.home.intents.workflowDescription',
-};
-
-const IntentTile = ({ id }: { id: LaunchpadIntentId }) => {
+const IntentTile = ({ entry }: { entry: LaunchpadStartEntry }) => {
const { t } = useTranslation();
- const search = useMemo(() => ({ intent: id, new: true }) as const, [id]);
return (
- <Link search={search} style={TILE_LINK_STYLE} to="/app">
+ <Link search={entry.search} style={TILE_LINK_STYLE} to="/app">
<Stack
bg="bg.subtle"
borderColor="border.subtle"
@@ -58,12 +28,12 @@ const IntentTile = ({ id }: { id: LaunchpadIntentId }) => {
transition={TILE_TRANSITION}
_hover={TILE_HOVER}
>
- <Icon as={INTENT_ICON[id]} boxSize="4" color="fg.muted" />
+ <Icon as={entry.icon} boxSize="4" color="fg.muted" />
<Text fontSize="xs" fontWeight="600">
- {t(INTENT_LABEL_KEY[id])}
+ {t(entry.labelKey)}
</Text>
<Text color="fg.muted" fontSize="2xs">
- {t(INTENT_DESCRIPTION_KEY[id])}
+ {t(entry.descriptionKey)}
</Text>
</Stack>
</Link>
@@ -72,8 +42,8 @@ const IntentTile = ({ id }: { id: LaunchpadIntentId }) => {
export const IntentTiles = () => (
<SimpleGrid columns={TILE_COLUMNS} gap="3">
- {LAUNCHPAD_INTENT_IDS.map((id) => (
- <IntentTile id={id} key={id} />
+ {LAUNCHPAD_START_ENTRIES.map((entry) => (
+ <IntentTile entry={entry} key={entry.id} />
))}
</SimpleGrid>
);
diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/intents.ts b/invokeai/frontend/webv2/src/workbench/launchpad/intents.ts
index e8fee4cd2d..e49e4abf79 100644
--- a/invokeai/frontend/webv2/src/workbench/launchpad/intents.ts
+++ b/invokeai/frontend/webv2/src/workbench/launchpad/intents.ts
@@ -2,8 +2,8 @@ import type { InvocationSourceId } from '@workbench/invocationContracts';
import type { BuiltInLayoutPresetId } from '@workbench/layoutContracts';
/**
- * Apply URL intent once to the fresh draft: presets choose arrangement, intents choose the more specific
- * invocation source. Keep built-in ids here so both routes validate without loading full preset snapshots.
+ * Apply URL intent once to the fresh draft: each intent chooses a built-in arrangement and the invocation source.
+ * Keep built-in ids here so the route validates without loading full preset snapshots.
*/
export type LaunchpadIntentId = 'generate' | 'canvas' | 'upscale' | 'video' | 'workflow';
@@ -33,9 +33,6 @@ const INTENTS: Record<LaunchpadIntentId, LaunchpadIntent> = {
export const isLaunchpadIntentId = (value: unknown): value is LaunchpadIntentId =>
typeof value === 'string' && LAUNCHPAD_INTENT_IDS.includes(value as LaunchpadIntentId);
-/** Launchpad can select built-ins only; custom presets require the mounted account workbench. */
-export const LAUNCHPAD_LAYOUT_IDS: readonly BuiltInLayoutPresetId[] = ['compose', 'edit', 'video', 'automate'];
-
/** Share built-in labels without loading widget-region snapshots; layoutPresets derives its labels from this map. */
export const BUILT_IN_LAYOUT_PRESET_LABELS: Record<BuiltInLayoutPresetId, string> = {
automate: 'Automate',
@@ -44,9 +41,6 @@ export const BUILT_IN_LAYOUT_PRESET_LABELS: Record<BuiltInLayoutPresetId, string
video: 'Video',
};
-export const isLaunchpadLayoutId = (value: unknown): value is BuiltInLayoutPresetId =>
- typeof value === 'string' && LAUNCHPAD_LAYOUT_IDS.includes(value as BuiltInLayoutPresetId);
-
/**
* `null` for anything unrecognised — a hand-edited or stale URL should open a
* plain draft rather than fail.
diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/projects/NewProjectButton.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/projects/NewProjectButton.tsx
index 36f3aa21f7..0452ab425f 100644
--- a/invokeai/frontend/webv2/src/workbench/launchpad/projects/NewProjectButton.tsx
+++ b/invokeai/frontend/webv2/src/workbench/launchpad/projects/NewProjectButton.tsx
@@ -1,44 +1,20 @@
-import type { BuiltInLayoutPresetId } from '@workbench/layoutContracts';
-import type { LucideIcon } from 'lucide-react';
+import type { LaunchpadStartEntry } from '@workbench/launchpad/startEntries';
import { Icon, Menu, Portal } from '@chakra-ui/react';
import { Button, IconButton } from '@platform/ui/Button';
import { Group } from '@platform/ui/Group';
-import { MenuContent } from '@platform/ui/Menu';
-import { Link } from '@tanstack/react-router';
-import { BUILT_IN_LAYOUT_PRESET_LABELS, LAUNCHPAD_LAYOUT_IDS } from '@workbench/launchpad/intents';
-import { ChevronDownIcon, ClapperboardIcon, LayersIcon, PlusIcon, TypeIcon, WorkflowIcon } from 'lucide-react';
+import { MenuActionItem, MenuContent } from '@platform/ui/Menu';
+import { Link, useNavigate } from '@tanstack/react-router';
+import { LAUNCHPAD_START_ENTRIES } from '@workbench/launchpad/startEntries';
+import { ChevronDownIcon, PlusIcon } from 'lucide-react';
+import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
-/**
- * Plain clicks use the last preset; the caret chooses a built-in arrangement. Shared labels avoid drift without
- * importing preset snapshots or the custom icon catalog.
- */
+/** Plain clicks use the last arrangement; the caret offers the same starts as the Home tiles. */
const NEW_PROJECT_SEARCH = { new: true } as const;
const MENU_POSITIONING = { placement: 'bottom-end' } as const;
-const LAYOUT_ICONS: Record<BuiltInLayoutPresetId, LucideIcon> = {
- automate: WorkflowIcon,
- compose: TypeIcon,
- edit: LayersIcon,
- video: ClapperboardIcon,
-};
-
-interface NewProjectLayoutItem {
- icon: LucideIcon;
- id: BuiltInLayoutPresetId;
- label: string;
- search: { new: true; preset: BuiltInLayoutPresetId };
-}
-
-const LAYOUT_ITEMS: NewProjectLayoutItem[] = LAUNCHPAD_LAYOUT_IDS.map((id) => ({
- icon: LAYOUT_ICONS[id],
- id,
- label: BUILT_IN_LAYOUT_PRESET_LABELS[id],
- search: { new: true, preset: id },
-}));
-
export const NewProjectButton = ({ variant = 'solid' }: { variant?: 'outline' | 'solid' }) => {
const { t } = useTranslation();
@@ -52,17 +28,17 @@ export const NewProjectButton = ({ variant = 'solid' }: { variant?: 'outline' |
</Button>
<Menu.Root positioning={MENU_POSITIONING}>
<Menu.Trigger asChild>
- <IconButton aria-label={t('projects.newProjectWithLayout')} size="xs" variant={variant}>
+ <IconButton aria-label={t('projects.newProjectStart')} size="xs" variant={variant}>
<Icon as={ChevronDownIcon} boxSize="3.5" />
</IconButton>
</Menu.Trigger>
<Portal>
<Menu.Positioner>
- <MenuContent minW="12rem">
+ <MenuContent minW="16rem">
<Menu.ItemGroup>
- <Menu.ItemGroupLabel>{t('projects.newProjectWithLayout')}</Menu.ItemGroupLabel>
- {LAYOUT_ITEMS.map((item) => (
- <NewProjectLayoutMenuItem key={item.id} item={item} />
+ <Menu.ItemGroupLabel>{t('launchpad.home.intents.heading')}</Menu.ItemGroupLabel>
+ {LAUNCHPAD_START_ENTRIES.map((entry) => (
+ <NewProjectStartMenuItem entry={entry} key={entry.id} />
))}
</Menu.ItemGroup>
</MenuContent>
@@ -73,11 +49,18 @@ export const NewProjectButton = ({ variant = 'solid' }: { variant?: 'outline' |
);
};
-const NewProjectLayoutMenuItem = ({ item }: { item: NewProjectLayoutItem }) => (
- <Menu.Item asChild value={item.id}>
- <Link search={item.search} to="/app">
- <Icon as={item.icon} boxSize="3.5" color="fg.subtle" />
- <Menu.ItemText fontSize="xs">{item.label}</Menu.ItemText>
- </Link>
- </Menu.Item>
-);
+const NewProjectStartMenuItem = ({ entry }: { entry: LaunchpadStartEntry }) => {
+ const { t } = useTranslation();
+ const navigate = useNavigate();
+ const handleSelect = useCallback(() => void navigate({ search: entry.search, to: '/app' }), [entry.search, navigate]);
+
+ return (
+ <MenuActionItem
+ hint={t(entry.descriptionKey)}
+ icon={entry.icon}
+ label={t(entry.labelKey)}
+ value={entry.id}
+ onSelect={handleSelect}
+ />
+ );
+};
diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/startEntries.ts b/invokeai/frontend/webv2/src/workbench/launchpad/startEntries.ts
new file mode 100644
index 0000000000..1cce8f1fd8
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/launchpad/startEntries.ts
@@ -0,0 +1,47 @@
+import type { LaunchpadIntentId } from '@workbench/launchpad/intents';
+import type { LucideIcon } from 'lucide-react';
+
+import { LAUNCHPAD_INTENT_IDS } from '@workbench/launchpad/intents';
+import { BlocksIcon, BrushIcon, ClapperboardIcon, ScalingIcon, TypeIcon } from 'lucide-react';
+
+/** One presentation per intent so the Home tiles and the new-project menu offer the same starts. */
+export interface LaunchpadStartEntry {
+ id: LaunchpadIntentId;
+ icon: LucideIcon;
+ labelKey: string;
+ descriptionKey: string;
+ search: { intent: LaunchpadIntentId; new: true };
+}
+
+const START_ICONS: Record<LaunchpadIntentId, LucideIcon> = {
+ canvas: BrushIcon,
+ generate: TypeIcon,
+ upscale: ScalingIcon,
+ video: ClapperboardIcon,
+ workflow: BlocksIcon,
+};
+
+// Spelled out rather than interpolated, so the translation-key report can see them.
+const START_LABEL_KEYS: Record<LaunchpadIntentId, string> = {
+ canvas: 'launchpad.home.intents.canvas',
+ generate: 'launchpad.home.intents.generate',
+ upscale: 'launchpad.home.intents.upscale',
+ video: 'launchpad.home.intents.video',
+ workflow: 'launchpad.home.intents.workflow',
+};
+
+const START_DESCRIPTION_KEYS: Record<LaunchpadIntentId, string> = {
+ canvas: 'launchpad.home.intents.canvasDescription',
+ generate: 'launchpad.home.intents.generateDescription',
+ upscale: 'launchpad.home.intents.upscaleDescription',
+ video: 'launchpad.home.intents.videoDescription',
+ workflow: 'launchpad.home.intents.workflowDescription',
+};
+
+export const LAUNCHPAD_START_ENTRIES: readonly LaunchpadStartEntry[] = LAUNCHPAD_INTENT_IDS.map((id) => ({
+ descriptionKey: START_DESCRIPTION_KEYS[id],
+ icon: START_ICONS[id],
+ id,
+ labelKey: START_LABEL_KEYS[id],
+ search: { intent: id, new: true },
+}));
diff --git a/invokeai/frontend/webv2/src/workbench/projects/session.ts b/invokeai/frontend/webv2/src/workbench/projects/session.ts
index a7bbb22e29..dda37495ae 100644
--- a/invokeai/frontend/webv2/src/workbench/projects/session.ts
+++ b/invokeai/frontend/webv2/src/workbench/projects/session.ts
@@ -1,5 +1,4 @@
import type { LaunchpadIntentId } from '@workbench/launchpad/intents';
-import type { BuiltInLayoutPresetId } from '@workbench/layoutContracts';
import type { AccountState, WorkbenchState } from '@workbench/projectContracts';
import type { QueueRunJournal } from '@workbench/queue-integration/queueRunJournal';
import type { WorkbenchPreferences } from '@workbench/settings/contracts';
@@ -12,15 +11,11 @@ import { getClientStateValue, setClientStateValue } from './api';
export const SESSION_STATE_KEY = 'webv2:workbench-account';
-/**
- * project opens a library project; new creates a draft. An explicit preset overrides the arrangement implied by
- * intent.
- */
+/** project opens a library project; new creates a draft whose intent picks the arrangement and source. */
export interface WorkbenchSearch {
new?: true;
project?: string;
intent?: LaunchpadIntentId;
- preset?: BuiltInLayoutPresetId;
}
export interface WorkbenchSessionBlob {