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(launchpad): rebuild the shell, library, and home screen
joshistoastad38ba53f54e
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.jsonindex d59853abd6..6065ec5ef5 100644--- a/invokeai/frontend/webv2/public/locales/en.json+++ b/invokeai/frontend/webv2/public/locales/en.json@@ -406,6 +406,7 @@"deleteFailed": "Delete failed","deleteProject": "Delete project","deleteProjectCardBody": "Delete \"{{name}}\"? The project is removed from the server permanently.",+ "deleteProjectOpenWarning": "It is currently open in the editor — unsaved changes there can recreate it.","deleteProjectQuestion": "Delete project?","deleteProjectTabBody": "Delete \"{{name}}\"? The project and its saved copy on the server are removed permanently. To keep it in your library, close the tab instead.","deleteProjectWithEllipsis": "Delete project…",@@ -413,18 +414,43 @@"editedRelative": "Edited {{time}}","exportFailed": "Export failed","failedToLoad": "Failed to load your projects.",+ "gridView": "Grid view",+ "groups": {+ "all": "All projects",+ "month": "Earlier this month",+ "older": "Older",+ "open": "Open now",+ "pinned": "Pinned",+ "today": "Today",+ "week": "Earlier this week"+ },"importFailed": "Import failed","importWithEllipsis": "Import…",+ "libraryDescription": "Every project saved to your account.",+ "listView": "List view","newProject": "New project","noSavedProjects": "No saved projects yet.",+ "noSavedProjectsDescription": "Create your first project to start generating.",+ "noSearchMatches": "No projects match “{{search}}”.",+ "noSearchMatchesDescription": "Try a different name, or clear the search.","openProject": "Open project","openProjectLabel": "Open {{name}}","openProjects": "Open projects",+ "pin": "Pin","projectDetails": "Project details","projectDuplicated": "Project duplicated","projectDuplicatedDescription": "\"{{name}}\" was created.","renameFailed": "Rename failed",- "renameWithEllipsis": "Rename…"+ "renameWithEllipsis": "Rename…",+ "searchLabel": "Search projects",+ "searchPlaceholder": "Search projects…",+ "sort": {+ "created": "Date created",+ "edited": "Last edited",+ "label": "Sort by",+ "name": "Name"+ },+ "unpin": "Unpin"},"users": {"accountCount_one": "{{count}} account in this workspace.",@@ -764,22 +790,29 @@"apiKeyFor": "{{title}} API key","apiKeys": "API Keys","apiKeysDescription": "Keys are used when installing protected models and when generating with external API models.",+ "backendDisconnectedProgressStale": "Backend disconnected. Progress may be stale.","base": "Base","baseArchitecture": "Base Architecture","baseUrlFor": "{{title}} base URL",- "backendDisconnectedProgressStale": "Backend disconnected. Progress may be stale.",- "bundleInstallQueued": "Bundle install queued",- "bundleInstallQueuedDescription_one": "{{name}}: {{count}} install queued.",- "bundleInstallQueuedDescription_other": "{{name}}: {{count}} installs queued.",- "bytePlusApiKeyPlaceholder": "API key from BytePlus console","bulkDeleteBody_one": "Delete {{count}} selected model? Database records are removed, and files inside the InvokeAI models directory are deleted.","bulkDeleteBody_other": "Delete {{count}} selected models? Database records are removed, and files inside the InvokeAI models directory are deleted.","bulkDeleteConfirm_one": "Delete {{count}} Model","bulkDeleteConfirm_other": "Delete {{count}} Models","bulkDeleteFailed": "Bulk delete failed","bulkDeletePartialDescription": "{{deleted}} deleted; {{failed}} failed: {{error}}",+ "bundleInstallQueued": "Bundle install queued",+ "bundleInstallQueuedDescription_one": "{{name}}: {{count}} install queued.",+ "bundleInstallQueuedDescription_other": "{{name}}: {{count}} installs queued.",+ "bytePlusApiKeyPlaceholder": "API key from BytePlus console","cacheEmptied": "Model cache emptied",+ "cancelAllInstalls": "Cancel all installs",+ "cancelFailed": "Cancel failed",+ "cancelInstall": "Cancel install",+ "civitaiKey": "Civitai key",+ "civitaiKeyDescription": "Attached automatically when installing civitai.com models that require login. Stored in this browser only.",+ "civitaiKeyPlaceholder": "32-character key from civitai.com/user/account","cleanupOrphaned": "Clean up orphaned models…",+ "clearFinished": "Clear finished","clearSelection": "Clear selection","convert": "Convert","convertBody": "Convert \"{{name}}\" to the diffusers format in place? The original checkpoint file is replaced by a diffusers folder.",@@ -787,15 +820,8 @@"couldNotLoad": "Could not load models","couldNotLoadInstallQueue": "Could not load the install queue","couldNotLoadStarterModels": "Could not load starter models",- "customizedForThisModel": "Customized for this model","customizeDefaultField": "Customize {{field}} for this model",- "civitaiKey": "Civitai key",- "civitaiKeyDescription": "Attached automatically when installing civitai.com models that require login. Stored in this browser only.",- "civitaiKeyPlaceholder": "32-character key from civitai.com/user/account",- "cancelAllInstalls": "Cancel all installs",- "cancelFailed": "Cancel failed",- "cancelInstall": "Cancel install",- "clearFinished": "Clear finished",+ "customizedForThisModel": "Customized for this model","defaultFieldInherited": {"cfgRescale": "App default: 0 (off)","cfgScale": "App default: 7",@@ -827,11 +853,11 @@"defaultSettingsSaved": "Default settings saved","deleteBody": "Delete \"{{name}}\"? The database record is removed, and the model files are deleted if they live inside the InvokeAI models directory.","deleteModel": "Delete model",+ "deleteSelectedTitle": "Delete selected models",+ "deleteSelectedWithBytes": "Delete Selected ({{bytes}})","deleted": "Models deleted","deletedDescription_one": "{{count}} model deleted.","deletedDescription_other": "{{count}} models deleted.",- "deleteSelectedTitle": "Delete selected models",- "deleteSelectedWithBytes": "Delete Selected ({{bytes}})","description": "Description","details": "Model Details","dismissResults": "Dismiss results",@@ -853,15 +879,15 @@"failedToUnlink": "Failed to unlink models.","failedToUpdateTriggerPhrases": "Failed to update trigger phrases.","failedToUploadModelImage": "Failed to upload model image.",- "fileNotFoundOnDisk": "The file for this model was not found on disk.","fileCount_one": "{{count}} file","fileCount_other": "{{count}} files",+ "fileNotFoundOnDisk": "The file for this model was not found on disk.",+ "fileSize": "File Size","filesInRepo_one": "{{count}} file in {{repo}}","filesInRepo_other": "{{count}} files in {{repo}}",- "fileSize": "File Size",+ "filterAndSort": "Filter and sort models","filterAndSortStarterModels": "Filter and sort starter models","filterFiles": "Filter files",- "filterAndSort": "Filter and sort models","filterResults": "Filter results","hash": "Hash","huggingFaceKeyDescription": "For gated repos like FLUX. Stored on the InvokeAI server and verified with HuggingFace.",@@ -870,10 +896,10 @@"installAll": "Install all","installAllCount": "Install all ({{count}})","installFailed": "Install failed",- "installJobs": "Install jobs",+ "installInPlace": "Install in place","installJobSummary_one": "{{count}} job · no active installs","installJobSummary_other": "{{count}} jobs · no active installs",- "installInPlace": "Install in place",+ "installJobs": "Install jobs","installQueue": "Install Queue","installed": "Installed","installsDependencies_one": " (installs {{count}} dependency)",@@ -887,10 +913,17 @@"unknown": "Not set","valid": "Valid"},+ "launchpad": {+ "installing_one": "{{count}} model installing…",+ "installing_other": "{{count}} models installing…",+ "noModelsDescription": "Invoke needs at least one model before it can generate. Install a starter bundle to get going.",+ "noModelsTitle": "No models installed",+ "starterBundles": "Starter bundles"+ },"library": "Model library","libraryMaintenance": "Model library maintenance",- "manager": "Model Manager","manageApiKeys": "Manage API keys",+ "manager": "Model Manager","missingFilesCount": "Missing files ({{count}})","modelAndDependenciesQueued_one": "{{name}} and {{count}} dependency","modelAndDependenciesQueued_other": "{{name}} and {{count}} dependencies",@@ -899,13 +932,14 @@"modelImageUpdated": "Model image updated","modelInstallQueued": "Model install queued","modelManager": "Model manager",- "modelUpdated": "Model updated","modelType": "Model Type",+ "modelUpdated": "Model updated","noInstallableModelFiles": "This HuggingFace repo has no installable model files.","noInstallsDescription": "Model installs appear here while they download and import.","noInstallsYet": "No installs yet","noModelFilesFound": "No model files found in {{path}}.","noModelFilesFoundTitle": "No model files found",+ "noOrphaned": "No orphaned model folders found — your library is clean.","noRelatedModels": "No related models linked yet.","noStarterModelsPull": "No starter models match - press Pull to install the source you entered.","noStarterModelsSearch": "No starter models match your search.",@@ -913,7 +947,6 @@"noneInstalledDescription": "Use Add Models to install your first model.","noneMatchFilters": "No models match your filters","noneMatchFiltersDescription": "Try clearing the search or filters.",- "noOrphaned": "No orphaned model folders found — your library is clean.","orphanedCleanup": "Orphaned model cleanup","orphanedCleanupFailed": "Orphaned model cleanup failed","orphanedCleanupPartialDescription": "{{deleted}} deleted, {{failed}} failed: {{error}}",@@ -921,9 +954,6 @@"orphanedDeletedDescription_other": "{{count}} orphaned model folders deleted.","orphanedDescription": "Folders in the models directory with no database record — usually leftovers from failed installs or external deletes.","orphanedTitle": "Orphaned Models",- "predictionType": "Prediction Type",- "runVaeOnCpu": "Run on CPU",- "runVaeOnCpuHelp": "Run this VAE on CPU only to reduce VRAM usage. This may be slower.","overrideBaseUrl": "Override base URL","path": "Path","pauseAllDownloads": "Pause all downloads",@@ -932,8 +962,9 @@"pauseFailed": "Pause failed","pauseInstall": "Pause install","plusMore": " +{{count}} more",- "pruneFailed": "Prune failed",+ "predictionType": "Prediction Type","press": "Press",+ "pruneFailed": "Prune failed","pull": "Pull","queueActionFailed": "Queue action failed","refreshList": "Refresh model list",@@ -955,28 +986,25 @@"retryFailed": "Retry failed","retryFailedDownload": "Retry failed download","retryInstall": "Retry install",+ "runVaeOnCpu": "Run on CPU",+ "runVaeOnCpuHelp": "Run this VAE on CPU only to reduce VRAM usage. This may be slower.","saveDefaults": "Save Defaults","scan": "Scan","scanFailed": "Scan failed","scanFolderTooltip": "Scan this folder for model files","scanSummary_one": "{{count}} file in {{path}} · {{notInstalled}} not installed","scanSummary_other": "{{count}} files in {{path}} · {{notInstalled}} not installed",+ "searchCompatibleToLink": "Search compatible models to link...","searchModels": "Search models","searchModelsPlaceholder": "Search models…",- "searchCompatibleToLink": "Search compatible models to link...","searchOrAdd": "Search or add a model","searchOrAddPlaceholder": "Search models, or paste a URL, file path, or Hugging Face repo","selectAllCount": "Select all ({{count}})",- "selectedCount_one": "{{count}} selected",- "selectedCount_other": "{{count}} selected","selectModel": "Select a model","selectModelDescription": "Pick a model from the library to view details, edit metadata, set per-model defaults, and manage trigger phrases.",+ "selectedCount_one": "{{count}} selected",+ "selectedCount_other": "{{count}} selected","someCouldNotBeDeleted": "Some models could not be deleted",- "sortBase": "Base",- "sortDefault": "Default",- "sortFormat": "Format",- "sortName": "Name",- "sortSize": "Size","sort": {"base": "Base","default": "Default",@@ -984,22 +1012,27 @@"name": "Name","size": "Size"},+ "sortBase": "Base","sortBy": "Sort By",+ "sortDefault": "Default",+ "sortFormat": "Format",+ "sortName": "Name",+ "sortSize": "Size","source": "Source","sourceUrl": "Source URL",- "vaeCpuSettingSaved": "VAE CPU setting saved","sourceUrlHelp": "Model page or download URL.","title": "Models","toFindModelsInFolder": "to find models in this folder.","toInstallFrom": "to install from {{source}}.",- "type": "Type","triggerPhraseDuplicate": "That trigger phrase is already on this model.","triggerPhrases": "Trigger Phrases","triggerPhrasesHelp": "Phrases that activate this model, surfaced in the prompt editor.",+ "type": "Type","unlink": "Unlink","unlinkNamed": "Unlink {{name}}","uploadCoverImageFor": "Upload cover image for {{name}}","useSupportedImage": "Use a PNG, JPEG, or WebP image.",+ "vaeCpuSettingSaved": "VAE CPU setting saved","variant": "Variant","variantHelp": "Architecture variant, e.g. inpaint or dev.","waitingForDownload": "Waiting for download"@@ -1062,7 +1095,6 @@"uninstalled": "Uninstalled"},"launchpad": {- "backToProject": "Back to project","browserIssues": {"canvasReadbackIntegrity": {"description": "Your browser is modifying or blocking canvas pixel data. This can make later strokes noisy or pixelated.",@@ -1074,10 +1106,55 @@"copySetting": "Copy browser setting","settingCopied": "Browser setting copied"},+ "connection": {+ "connecting": "Connecting…",+ "disconnected": "Disconnected"+ },+ "groups": {+ "manage": "Manage",+ "workspace": "Workspace"+ },+ "help": {+ "community": "Community",+ "discord": "Discord",+ "documentation": "Documentation",+ "github": "GitHub",+ "guides": "Guides",+ "label": "Help and resources",+ "version": "Version {{version}}",+ "youtube": "YouTube"+ },+ "home": {+ "intents": {+ "canvas": "Edit on canvas",+ "canvasDescription": "Paint, compose, and refine",+ "generate": "Generate from text",+ "generateDescription": "Start from a prompt",+ "heading": "Start something",+ "upscale": "Upscale an image",+ "upscaleDescription": "Add resolution and detail",+ "workflow": "Build a workflow",+ "workflowDescription": "Wire nodes together"+ },+ "queue": {+ "summary": "{{inProgress}} running · {{pending}} queued"+ },+ "recentOutputs": "Recent outputs",+ "recentProjects": "Recent projects",+ "resume": "Pick up where you left off",+ "resumeAction": "Resume",+ "viewAllProjects": "View all projects"+ },+ "openProjects": {+ "activeLabel": "Open projects. Current project: {{name}}",+ "label": "Open projects",+ "openEditor": "Open editor"+ },"projectsGreeting": "Welcome to Invoke","projectsGreetingWithName": "Welcome back, {{name}}","projectsSubtitle": "Pick up where you left off, or start something new.","sections": {+ "home": "Home","models": "Models","nodes": "Nodes","projects": "Projects",diff --git a/invokeai/frontend/webv2/scripts/run-accessibility-journeys.mjs b/invokeai/frontend/webv2/scripts/run-accessibility-journeys.mjsindex 1db35049c2..c8fe486e34 100644--- a/invokeai/frontend/webv2/scripts/run-accessibility-journeys.mjs+++ b/invokeai/frontend/webv2/scripts/run-accessibility-journeys.mjs@@ -74,9 +74,22 @@ const openRepresentativePage = async (browser, path, viewport = { height: 1_000,return { consoleErrors, context, page, pageErrors };};-const waitForProjects = async (page) => {+/** `/` is Home: the greeting, the resume card, and the intent tiles. */+const waitForHome = async (page) => {await page.getByRole('heading', { exact: true, name: 'Welcome to Invoke' }).waitFor();await page.getByRole('link', { exact: true, name: 'Open Fixture Project 001' }).waitFor();+ await page.getByText('Generate from text', { exact: true }).waitFor();+};++/**+ * `/projects` is the library itself, which is where the grid lives. The+ * heading is matched at level 2 because the shell also renders a visually+ * hidden level-1 heading naming the active section, which on this page is the+ * same word.+ */+const waitForProjects = async (page) => {+ await page.getByRole('heading', { exact: true, level: 2, name: 'Projects' }).waitFor();+ await page.getByRole('link', { exact: true, name: 'Open Fixture Project 001' }).waitFor();};const waitForModels = async (page) => {@@ -129,8 +142,13 @@ const selectCenterView = async (page, from, to) => {const surfaces = [{- id: 'launchpad-projects-representative',+ id: 'launchpad-home-representative',path: '/#/',+ ready: waitForHome,+ },+ {+ id: 'launchpad-projects-representative',+ path: '/#/projects',ready: waitForProjects,},{@@ -240,11 +258,13 @@ const runKeyboardJourney = async (browser) => {const { context, page, pageErrors } = await openRepresentativePage(browser, '/#/');try {- await waitForProjects(page);+ await waitForHome(page);const projectsTab = page.getByRole('tab', { exact: true, name: 'Projects' });const modelsTab = page.getByRole('tab', { exact: true, name: 'Models' });+ // The rail is grouped, but it is still one tablist: arrowing off the last+ // Workspace tab has to land on the first Manage tab, skipping the headings.await projectsTab.focus();await projectsTab.press('ArrowDown');await expectFocused(modelsTab, 'ArrowDown should move focus from Projects to Models.');diff --git a/invokeai/frontend/webv2/src/app/router.tsx b/invokeai/frontend/webv2/src/app/router.tsxindex e7eb3a7f5c..ac8b302e40 100644--- a/invokeai/frontend/webv2/src/app/router.tsx+++ b/invokeai/frontend/webv2/src/app/router.tsx@@ -22,6 +22,7 @@ import {useRouter,} from '@tanstack/react-router';import { WorkbenchSplashScreen } from '@workbench/components/WorkbenchSplashScreen';+import { isLaunchpadIntentId } from '@workbench/launchpad/intents';import { Launchpad } from '@workbench/launchpad/Launchpad';import { peekOpenProjectIds, type WorkbenchSearch } from '@workbench/projects/session';import { loadWorkbenchSettings } from '@workbench/settings/store';@@ -178,6 +179,7 @@ const workbenchRoute = createRoute({getParentRoute: () => authenticatedRoute,path: '/app',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,project: typeof search.project === 'string' && search.project.length > 0 ? search.project : undefined,}),diff --git a/invokeai/frontend/webv2/src/architecture/featureInterfaces.ts b/invokeai/frontend/webv2/src/architecture/featureInterfaces.tsindex 0c111d5aa6..76591f2dda 100644--- a/invokeai/frontend/webv2/src/architecture/featureInterfaces.ts+++ b/invokeai/frontend/webv2/src/architecture/featureInterfaces.ts@@ -5,12 +5,12 @@* To publish a new entry module, add it here and cover it in dependencyPolicy.test.ts.*/export const FEATURE_PUBLIC_INTERFACES: Readonly<Record<string, readonly string[]>> = {- gallery: ['contracts', 'paletteSearch', 'queries', 'react', 'utility', 'widget'],+ gallery: ['contracts', 'launchpad', 'paletteSearch', 'queries', 'react', 'utility', 'widget'],generation: ['components', 'contracts', 'graph', 'prompts', 'queries', 'react', 'runtime', 'settings', 'widget'],identity: [],- models: ['react'],+ models: ['launchpad', 'react'],nodes: [],- queue: ['contracts', 'devices', 'menu', 'queries', 'react', 'reveal', 'utility', 'widget'],+ queue: ['contracts', 'devices', 'launchpad', 'menu', 'queries', 'react', 'reveal', 'utility', 'widget'],upscale: ['widget'],workflow: ['contracts', 'graph', 'paletteSearch', 'preview', 'queries', 'react', 'utility', 'widget'],};diff --git a/invokeai/frontend/webv2/src/features/gallery/launchpad.ts b/invokeai/frontend/webv2/src/features/gallery/launchpad.tsnew file mode 100644index 0000000000..2a132cb2ca--- /dev/null+++ b/invokeai/frontend/webv2/src/features/gallery/launchpad.ts@@ -0,0 +1,5 @@+/**+ * Gallery surface for the Launchpad. Exported eagerly — see the note in the+ * Launchpad's `livePanels` module about the single shared lazy boundary.+ */+export { RecentOutputs } from './ui/launchpad/RecentOutputs';diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/launchpad/RecentOutputs.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/launchpad/RecentOutputs.tsxnew file mode 100644index 0000000000..519b3f2741--- /dev/null+++ b/invokeai/frontend/webv2/src/features/gallery/ui/launchpad/RecentOutputs.tsx@@ -0,0 +1,73 @@+import type { GalleryImage } from '@features/gallery/core/types';++import { Box, Flex, Image, SimpleGrid, Skeleton, Text } from '@chakra-ui/react';+import { ALL_READABLE_BOARDS_ID, listPaletteImages } from '@features/gallery/data/backend';+import { getGalleryImageThumbnailUrl } from '@features/gallery/data/imageUrls';+import { useMountEffect } from '@platform/react/useMountEffect';+import { captureAccountScope, isAccountScopeCurrent } from '@platform/state/accountLifecycle';+import { useState } from 'react';+import { useTranslation } from 'react-i18next';++/**+ * The last few images this account produced, across every project.+ *+ * The gallery's own "recent images" is per-project widget state, so a+ * cross-project strip has to read the backend directly. It uses the same+ * cancellable read the command palette does, which is the entry point built+ * for exactly this kind of deferred cross-feature surface.+ */++const OUTPUT_COUNT = 8;+const GRID_COLUMNS = { base: 4, md: 8 } as const;++export const RecentOutputs = () => {+ const { t } = useTranslation();+ const [images, setImages] = useState<GalleryImage[] | null>(null);++ useMountEffect(() => {+ const owner = captureAccountScope();++ void listPaletteImages({+ boardId: ALL_READABLE_BOARDS_ID,+ galleryView: 'images',+ limit: OUTPUT_COUNT,+ searchTerm: '',+ signal: owner.signal,+ })+ .then((page) => {+ if (isAccountScopeCurrent(owner)) {+ setImages(page.images);+ }+ })+ .catch(() => {+ if (isAccountScopeCurrent(owner)) {+ setImages([]);+ }+ });+ });++ if (images !== null && images.length === 0) {+ return null;+ }++ return (+ <Flex direction="column" gap="3">+ <Text fontSize="xs" fontWeight="700">+ {t('launchpad.home.recentOutputs')}+ </Text>+ <SimpleGrid columns={GRID_COLUMNS} gap="2">+ {images === null+ ? Array.from({ length: OUTPUT_COUNT }, (_value, index) => (+ <Skeleton aspectRatio={1} key={index} rounded="md" />+ ))+ : images.map((image) => <RecentOutput image={image} key={image.imageName} />)}+ </SimpleGrid>+ </Flex>+ );+};++const RecentOutput = ({ image }: { image: GalleryImage }) => (+ <Box aspectRatio={1} bg="bg.muted" overflow="hidden" rounded="md">+ <Image alt="" h="full" objectFit="cover" src={getGalleryImageThumbnailUrl(image.imageName)} w="full" />+ </Box>+);diff --git a/invokeai/frontend/webv2/src/features/identity/ui/UsersPage.tsx b/invokeai/frontend/webv2/src/features/identity/ui/UsersPage.tsxindex b5580fe7e2..4e9e709430 100644--- a/invokeai/frontend/webv2/src/features/identity/ui/UsersPage.tsx+++ b/invokeai/frontend/webv2/src/features/identity/ui/UsersPage.tsx@@ -1,30 +1,19 @@-import type { SystemStyleObject } from '@chakra-ui/react';--import { Box } from '@chakra-ui/react';-import { Scrollable } from '@platform/ui';+import { PageShell } from '@platform/ui/PageShell';import { useTranslation } from 'react-i18next';import { UsersManagementPanel } from './UserManagement';/**- * Admin-only section: create, edit, and remove users. Mirrors the Projects- * page's centered measure and self-scroll so the chrome stays put.+ * Admin-only section: create, edit, and remove users. Shares the Launchpad's+ * page chrome, so it carries the same heading, measure, and self-scroll as the+ * project library instead of its own copy of them.*/-const USERS_PAGE_MEASURE_SX: SystemStyleObject = {- maxW: '6xl',- mx: 'auto',- p: { base: 4, md: 8 },- w: 'full',-};-export const UsersPage = () => {const { t } = useTranslation();return (- <Scrollable h="full" label={t('users.management')} minH="0">- <Box css={USERS_PAGE_MEASURE_SX}>- <UsersManagementPanel />- </Box>- </Scrollable>+ <PageShell description={t('users.description')} regionLabel={t('users.management')} title={t('users.title')}>+ <UsersManagementPanel />+ </PageShell>);};diff --git a/invokeai/frontend/webv2/src/features/models/launchpad.ts b/invokeai/frontend/webv2/src/features/models/launchpad.tsnew file mode 100644index 0000000000..50d4b2fb1d--- /dev/null+++ b/invokeai/frontend/webv2/src/features/models/launchpad.ts@@ -0,0 +1,6 @@+/**+ * Models surface for the Launchpad. Exported eagerly: the Launchpad puts one+ * dynamic-import boundary in front of every live panel at once, so a second+ * one here would only fragment that chunk.+ */+export { ModelsNotice } from './ui/launchpad/ModelsNotice';diff --git a/invokeai/frontend/webv2/src/features/models/ui/launchpad/ModelsNotice.tsx b/invokeai/frontend/webv2/src/features/models/ui/launchpad/ModelsNotice.tsxnew file mode 100644index 0000000000..1ff7234f3f--- /dev/null+++ b/invokeai/frontend/webv2/src/features/models/ui/launchpad/ModelsNotice.tsx@@ -0,0 +1,161 @@+import type { StarterModelBundle } from '@features/models/core/types';++import { Flex, Icon, Spinner, Stack, Text, Wrap } from '@chakra-ui/react';+import {+ ensureInstallsLoaded,+ isActiveInstallStatus,+ refreshInstalls,+ useInstallsSelector,+} from '@features/models/data/installsStore';+import { ensureModelsLoaded, refreshModels, useModelsSelector } from '@features/models/data/modelsStore';+import { ensureStartersLoaded, useStartersSelector } from '@features/models/data/startersStore';+import { getStarterBundleInstallSources } from '@features/models/ui/add-models/starterModelInstallSources';+import { useInstallActions } from '@features/models/ui/add-models/useInstallActions';+import { useMountEffect } from '@platform/react/useMountEffect';+import { captureAccountScope, isAccountScopeCurrent } from '@platform/state/accountLifecycle';+import { Button } from '@platform/ui/Button';+import { BoxIcon } from 'lucide-react';+import { useCallback, useEffect, useMemo } from 'react';+import { useTranslation } from 'react-i18next';++/**+ * The first-run gap this closes: a fresh install used to show an empty project+ * grid and a "New project" button that dropped you into an editor which could+ * not generate anything, with no mention that models were the missing piece.+ *+ * It renders only while that is actually true — no models installed, or a+ * starter bundle still downloading — and disappears for good once the library+ * has something in it.+ */++const INSTALL_POLL_INTERVAL_MS = 2_500;++const EMPTY_BUNDLES: Record<string, StarterModelBundle> = {};++const PANEL_STYLE = {+ bg: 'bg.subtle',+ borderColor: 'border.subtle',+ borderWidth: '1px',+ gap: '3',+ p: '4',+ rounded: 'lg',+} as const;++export const ModelsNotice = () => {+ const { t } = useTranslation();+ const modelCount = useModelsSelector((snapshot) => snapshot.models.length);+ const modelsStatus = useModelsSelector((snapshot) => snapshot.status);+ const bundles = useStartersSelector((snapshot) => snapshot.response?.starter_bundles ?? EMPTY_BUNDLES);+ const activeInstallCount = useInstallsSelector(+ (snapshot) => snapshot.jobs.filter((job) => isActiveInstallStatus(job.status)).length+ );++ useMountEffect(() => {+ void ensureModelsLoaded();+ ensureStartersLoaded();+ ensureInstallsLoaded();+ });++ /**+ * Installs started here would otherwise sit on "Installing…" forever: the+ * socket handling, reconnect refresh, and completion toasts all live in+ * `ModelInstallRuntime`, which only the model manager mounts. Mounting a+ * second copy of that runtime is not an option — its outcome toasts keep+ * per-instance state, so Home and an already-visited Models section would+ * each announce every install.+ *+ * Polling only while something is actually installing keeps this to the+ * window where it matters, and both refreshes de-duplicate in flight.+ */+ useEffect(() => {+ if (activeInstallCount === 0) {+ return;+ }++ const owner = captureAccountScope();+ const interval = setInterval(() => {+ if (!isAccountScopeCurrent(owner)) {+ return;+ }++ void refreshInstalls(owner);+ void refreshModels(owner);+ }, INSTALL_POLL_INTERVAL_MS);++ return () => {+ clearInterval(interval);+ };+ }, [activeInstallCount]);++ // Nothing to say until the library has actually been read; guessing "you+ // have no models" during the first fetch would be a lie half the time.+ if (modelsStatus !== 'loaded' || modelCount > 0) {+ return activeInstallCount > 0 ? <InstallProgress count={activeInstallCount} /> : null;+ }++ return (+ <Stack {...PANEL_STYLE}>+ <Flex align="center" gap="2">+ <Icon as={BoxIcon} boxSize="4" color="fg.muted" />+ <Text fontSize="sm" fontWeight="700">+ {t('models.launchpad.noModelsTitle')}+ </Text>+ </Flex>+ <Text color="fg.muted" fontSize="xs">+ {t('models.launchpad.noModelsDescription')}+ </Text>+ {activeInstallCount > 0 ? <InstallProgress count={activeInstallCount} /> : <StarterBundles bundles={bundles} />}+ </Stack>+ );+};++const InstallProgress = ({ count }: { count: number }) => {+ const { t } = useTranslation();++ return (+ <Flex align="center" gap="2">+ <Spinner color="fg.muted" size="xs" />+ <Text color="fg.muted" fontSize="xs">+ {t('models.launchpad.installing', { count })}+ </Text>+ </Flex>+ );+};++const StarterBundles = ({ bundles }: { bundles: Record<string, StarterModelBundle> }) => {+ const { t } = useTranslation();+ const entries = useMemo(() => Object.entries(bundles), [bundles]);++ if (entries.length === 0) {+ return null;+ }++ return (+ <Stack gap="2">+ <Text color="fg.muted" fontSize="2xs" fontWeight="600" textTransform="uppercase">+ {t('models.launchpad.starterBundles')}+ </Text>+ <Wrap gap="2">+ {entries.map(([key, bundle]) => (+ <StarterBundleButton bundle={bundle} bundleKey={key} key={key} />+ ))}+ </Wrap>+ </Stack>+ );+};++const StarterBundleButton = ({ bundle, bundleKey }: { bundle: StarterModelBundle; bundleKey: string }) => {+ const { install } = useInstallActions();++ const handleInstall = useCallback(() => {+ for (const source of getStarterBundleInstallSources(bundle)) {+ void install({ config: source.config, source: source.source }, { silent: true });+ }+ }, [bundle, install]);++ return (+ <Button size="xs" variant="outline" onClick={handleInstall}>+ {bundle.name || bundleKey}+ </Button>+ );+};diff --git a/invokeai/frontend/webv2/src/features/queue/launchpad.ts b/invokeai/frontend/webv2/src/features/queue/launchpad.tsnew file mode 100644index 0000000000..d53af4a5e9--- /dev/null+++ b/invokeai/frontend/webv2/src/features/queue/launchpad.ts@@ -0,0 +1,5 @@+/**+ * Queue surface for the Launchpad. Exported eagerly — see the note in the+ * Launchpad's `livePanels` module about the single shared lazy boundary.+ */+export { QueueStatusBand } from './ui/launchpad/QueueStatusBand';diff --git a/invokeai/frontend/webv2/src/features/queue/ui/launchpad/QueueStatusBand.tsx b/invokeai/frontend/webv2/src/features/queue/ui/launchpad/QueueStatusBand.tsxnew file mode 100644index 0000000000..87704ff8c5--- /dev/null+++ b/invokeai/frontend/webv2/src/features/queue/ui/launchpad/QueueStatusBand.tsx@@ -0,0 +1,69 @@+import { Flex, Icon, 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 { useTranslation } from 'react-i18next';++/**+ * What the backend is doing right now, on the home screen.+ *+ * The Launchpad used to surface no application state at all — the home screen+ * of an image generator said nothing about whether anything was generating.+ * This is deliberately a single line: the Queue widget in the editor is where+ * the detail lives.+ *+ * Scoped to every job rather than the active project, because Home is not+ * inside a project.+ *+ * Reads `data/queries` directly rather than the feature's `publicApi`: that+ * module constructs the realtime runtime and coordinator at import time, so+ * going through it would pull the whole Queue runtime onto the home screen for+ * two numbers.+ */++const ALL_JOBS_SCOPE = {} as const;++/**+ * Socket-driven invalidation lives in the editor's Queue widget runtime, and+ * the query client has window-focus refetching turned off, so without this the+ * band would show whatever the counts were when Home first mounted and never+ * move again.+ */+const QUEUE_POLL_INTERVAL_MS = 5_000;++export const QueueStatusBand = () => {+ const { t } = useTranslation();+ const { data } = useQuery({+ ...queueReadModelOptions(queueBackend, ALL_JOBS_SCOPE),+ refetchInterval: QUEUE_POLL_INTERVAL_MS,+ refetchIntervalInBackground: false,+ });++ const counts = data?.status.queue;+ const inProgress = counts?.inProgress ?? 0;+ const pending = counts?.pending ?? 0;++ if (inProgress === 0 && pending === 0) {+ return null;+ }++ return (+ <Flex+ align="center"+ aria-live="polite"+ bg="bg.subtle"+ borderColor="border.subtle"+ borderWidth="1px"+ gap="2"+ px="3"+ py="2"+ rounded="lg"+ >+ <Icon aria-hidden as={LoaderCircleIcon} boxSize="3.5" color="fg.muted" />+ <Text fontSize="xs" fontWeight="600">+ {t('launchpad.home.queue.summary', { inProgress, pending })}+ </Text>+ </Flex>+ );+};diff --git a/invokeai/frontend/webv2/src/workbench/WorkbenchSessionController.tsx b/invokeai/frontend/webv2/src/workbench/WorkbenchSessionController.tsxindex bfac410a45..431695f2c8 100644--- a/invokeai/frontend/webv2/src/workbench/WorkbenchSessionController.tsx+++ b/invokeai/frontend/webv2/src/workbench/WorkbenchSessionController.tsx@@ -2,6 +2,7 @@ import { flushGenerateDrafts } from '@features/generation/react';import { useMountEffect } from '@platform/react/useMountEffect';import { areArraysEqual } from '@platform/state/selectors';import { useNavigate } from '@tanstack/react-router';+import { resolveLaunchpadIntent } from '@workbench/launchpad/intents';import type { WorkbenchSearch } from './projects/session';@@ -20,6 +21,15 @@ const HydratedSessionController = ({ search }: { search: WorkbenchSearch }) => {useMountEffect(() => {if (search.new === true) {+ // Arrange the fresh draft before the search is stripped, so the intent+ // applies exactly once and never survives into a later navigation.+ const intent = resolveLaunchpadIntent(search.intent);++ if (intent) {+ commands.layout.applyPreset(intent.presetId);+ commands.generation.setSource(intent.sourceId);+ }+void navigate({ replace: true, search: {}, to: '/app' });return;}@@ -72,5 +82,10 @@ export const WorkbenchSessionController = ({ search }: { search: WorkbenchSearchreturn null;}- return <HydratedSessionController key={`${search.new === true}:${search.project ?? ''}`} search={search} />;+ return (+ <HydratedSessionController+ key={`${search.new === true}:${search.project ?? ''}:${search.intent ?? ''}`}+ search={search}+ />+ );};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/HelpMenu.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/HelpMenu.tsxnew file mode 100644index 0000000000..1882f317a1--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/HelpMenu.tsx@@ -0,0 +1,129 @@+import type { LucideIcon } from 'lucide-react';++import { chakra, HStack, Icon, Menu, Portal, Text } from '@chakra-ui/react';+import { APP_VERSION } from '@platform/runtime/appMetadata';+import { Button } from '@platform/ui/Button';+import { MenuContent } from '@platform/ui/Menu';+import {+ BookOpenTextIcon,+ ChevronRightIcon,+ ClapperboardIcon,+ CircleQuestionMarkIcon,+ CodeIcon,+ MessagesSquareIcon,+} from 'lucide-react';+import { useTranslation } from 'react-i18next';++/**+ * Docs and community, pinned to the bottom of the Launchpad rail. This used to+ * be two outlined cards — the only card-styled objects on the surface, and+ * visually heavier than the section nav above them. One menu button says the+ * same thing without competing with the navigation for attention.+ */++const MENU_POSITIONING = { placement: 'right-end' } as const;+const GROUP_LABEL_PROPS = { color: 'fg.subtle', fontSize: '2xs', textTransform: 'uppercase' } as const;+const TRIGGER_JUSTIFY = { justifyContent: 'space-between' } as const;++interface HelpLink {+ href: string;+ icon: LucideIcon;+ labelKey: string;+ value: string;+}++const GUIDES: HelpLink[] = [+ {+ href: 'https://invoke-ai.github.io/InvokeAI/',+ icon: BookOpenTextIcon,+ labelKey: 'launchpad.help.documentation',+ value: 'documentation',+ },+ {+ href: 'https://www.youtube.com/@invokeai',+ icon: ClapperboardIcon,+ labelKey: 'launchpad.help.youtube',+ value: 'youtube',+ },+];++const COMMUNITY: HelpLink[] = [+ {+ href: 'https://discord.gg/ZmtBAhwWhy',+ icon: MessagesSquareIcon,+ labelKey: 'launchpad.help.discord',+ value: 'discord',+ },+ {+ href: 'https://github.com/invoke-ai/InvokeAI',+ icon: CodeIcon,+ labelKey: 'launchpad.help.github',+ value: 'github',+ },+];++const HelpMenuLink = ({ href, icon, labelKey, value }: HelpLink) => {+ const { t } = useTranslation();++ return (+ <Menu.Item asChild value={value}>+ <chakra.a href={href} rel="noreferrer" target="_blank">+ <Icon as={icon} boxSize="3.5" />+ <Menu.ItemText>{t(labelKey)}</Menu.ItemText>+ </chakra.a>+ </Menu.Item>+ );+};++export const HelpMenu = () => {+ const { t } = useTranslation();++ return (+ <Menu.Root positioning={MENU_POSITIONING}>+ <Menu.Trigger asChild>+ <Button+ aria-label={t('launchpad.help.label')}+ color="fg.muted"+ css={TRIGGER_JUSTIFY}+ size="xs"+ variant="ghost"+ w="full"+ >+ <Icon as={CircleQuestionMarkIcon} boxSize="3.5" />+ <Text flex="1" textAlign="start" truncate>+ {t('launchpad.help.label')}+ </Text>+ <Icon as={ChevronRightIcon} boxSize="3" />+ </Button>+ </Menu.Trigger>+ <Portal>+ <Menu.Positioner>+ <MenuContent minW="13rem">+ <Menu.ItemGroup>+ <Menu.ItemGroupLabel {...GROUP_LABEL_PROPS}>{t('launchpad.help.guides')}</Menu.ItemGroupLabel>+ {GUIDES.map((link) => (+ <HelpMenuLink key={link.value} {...link} />+ ))}+ </Menu.ItemGroup>+ <Menu.Separator />+ <Menu.ItemGroup>+ <Menu.ItemGroupLabel {...GROUP_LABEL_PROPS}>{t('launchpad.help.community')}</Menu.ItemGroupLabel>+ {COMMUNITY.map((link) => (+ <HelpMenuLink key={link.value} {...link} />+ ))}+ </Menu.ItemGroup>+ <Menu.Separator />+ <HStack justify="space-between" px="3" py="1.5">+ <Text fontSize="2xs" fontWeight="700">+ Invoke+ </Text>+ <Text color="fg.subtle" fontSize="2xs">+ {t('launchpad.help.version', { version: APP_VERSION })}+ </Text>+ </HStack>+ </MenuContent>+ </Menu.Positioner>+ </Portal>+ </Menu.Root>+ );+};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/Launchpad.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/Launchpad.tsxindex 69542ec1e5..ef9a10afc2 100644--- a/invokeai/frontend/webv2/src/workbench/launchpad/Launchpad.tsx+++ b/invokeai/frontend/webv2/src/workbench/launchpad/Launchpad.tsx@@ -5,12 +5,13 @@ import { NodesPage } from '@features/nodes';import { Tabs } from '@platform/ui';import { useLocation, useNavigate } from '@tanstack/react-router';import { LaunchpadCommandPalette } from '@workbench/palette/LaunchpadCommandPalette';-import { BoxIcon, BlocksIcon, FolderIcon, UsersIcon, type LucideIcon } from 'lucide-react';+import { BoxIcon, BlocksIcon, FolderIcon, HouseIcon, UsersIcon, type LucideIcon } from 'lucide-react';import { useCallback, useMemo, type ReactNode } from 'react';import { useTranslation } from 'react-i18next';-import { LaunchpadNav } from './LaunchpadNav';+import { LaunchpadNav, type LaunchpadNavGroupId } from './LaunchpadNav';import { LaunchpadTopBar } from './LaunchpadTopBar';+import { HomePage } from './pages/HomePage';import { ProjectsPage } from './pages/ProjectsPage';/**@@ -21,30 +22,40 @@ import { ProjectsPage } from './pages/ProjectsPage';* them. It deliberately mounts none of the workbench providers or runtimes, so* it stays on the light side of the route-level code split; the heaviest page,* the model manager, lazy-loads its own chunk the first time it is opened.+ *+ * Sections carry a `group`, because where you work and what you administer are+ * not peers: a flat list gave "Users" the same standing as "Projects".*/-type LaunchpadSectionId = 'projects' | 'models' | 'nodes' | 'users';+type LaunchpadSectionId = 'home' | 'projects' | 'models' | 'nodes' | 'users';interface LaunchpadSection {id: LaunchpadSectionId;label: string;icon: LucideIcon;+ group: LaunchpadNavGroupId;render: () => ReactNode;condition?: boolean;}-const DEFAULT_SECTION_ID: LaunchpadSectionId = 'projects';-const SECTION_IDS: readonly string[] = ['projects', 'models', 'nodes', 'users'];+const DEFAULT_SECTION_ID: LaunchpadSectionId = 'home';+const SECTION_IDS: readonly string[] = ['home', 'projects', 'models', 'nodes', 'users'];const isSectionId = (value: string): value is LaunchpadSectionId => SECTION_IDS.includes(value);+/** `/` is Home; every other section is its own path. */const normalizeSectionId = (value: string): LaunchpadSectionId | null => {const id = value.replace(/^\/+/, '');+ if (id === '') {+ return 'home';+ }+return isSectionId(id) ? id : null;};-const SECTION_PATHS: Record<LaunchpadSectionId, '/projects' | '/models' | '/nodes' | '/users'> = {+const SECTION_PATHS: Record<LaunchpadSectionId, '/' | '/projects' | '/models' | '/nodes' | '/users'> = {+ home: '/',models: '/models',nodes: '/nodes',projects: '/projects',@@ -77,6 +88,14 @@ export const Launchpad = () => {([{+ group: 'workspace',+ icon: HouseIcon,+ id: 'home',+ label: t('launchpad.sections.home'),+ render: () => <HomePage />,+ },+ {+ group: 'workspace',icon: FolderIcon,id: 'projects',label: t('launchpad.sections.projects'),@@ -84,6 +103,7 @@ export const Launchpad = () => {},{condition: canManageModels,+ group: 'manage',icon: BoxIcon,id: 'models',label: t('launchpad.sections.models'),@@ -91,6 +111,7 @@ export const Launchpad = () => {},{condition: canManageNodes,+ group: 'manage',icon: BlocksIcon,id: 'nodes',label: t('launchpad.sections.nodes'),@@ -98,6 +119,7 @@ export const Launchpad = () => {},{condition: canManageUsers,+ group: 'manage',icon: UsersIcon,id: 'users',label: t('launchpad.sections.users'),diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/LaunchpadNav.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/LaunchpadNav.tsxindex fbbfc25e1f..c756ccbe6d 100644--- a/invokeai/frontend/webv2/src/workbench/launchpad/LaunchpadNav.tsx+++ b/invokeai/frontend/webv2/src/workbench/launchpad/LaunchpadNav.tsx@@ -1,53 +1,118 @@+import type { SystemStyleObject } from '@chakra-ui/react';import type { LucideIcon } from 'lucide-react';import { Box, Icon, Stack, Text } from '@chakra-ui/react';import { Tabs } from '@platform/ui';+import { Fragment, useMemo } from 'react';+import { useTranslation } from 'react-i18next';-import { ResourceLinks } from './ResourceLinks';+import { HelpMenu } from './HelpMenu';const NAV_BORDER_END_WIDTH = { md: '1px' } as const;+const NAV_BORDER_BOTTOM_WIDTH = { base: '1px', md: '0' } as const;const NAV_WIDTH = { base: 'full', md: '56' } as const;-const RESOURCE_LINKS_MARGIN_TOP = { md: 'auto' } as const;+/**+ * Below `md` the shell stacks the rail above the page, and `h="full"` there+ * made the rail claim the entire viewport — collapsing the page area to zero+ * height inside the fixed, overflow-hidden shell. The rail takes only what its+ * content needs until it is a sidebar again.+ */+const NAV_HEIGHT = { base: 'auto', md: 'full' } as const;+const FOOTER_MARGIN_TOP = { md: 'auto' } as const;++/**+ * The Launchpad's persistent left rail. Sections are split into where you work+ * and what you administer: they are not peers, and stacking them in one flat+ * list gave "Users" the same weight as "Projects".+ *+ * The group headings are `role="presentation"` children of a single+ * `Tabs.List`, not separate lists — roving focus walks `[role=tab]`+ * descendants, so one tablist keeps arrow-key navigation running across the+ * whole rail while the headings stay decorative. Two sibling lists would split+ * that navigation in half.+ */++export type LaunchpadNavGroupId = 'workspace' | 'manage';export interface LaunchpadNavItem {id: string;label: string;icon: LucideIcon;+ group: LaunchpadNavGroupId;}+const GROUP_ORDER: readonly LaunchpadNavGroupId[] = ['workspace', 'manage'];++const GROUP_LABEL_KEY: Record<LaunchpadNavGroupId, string> = {+ manage: 'launchpad.groups.manage',+ workspace: 'launchpad.groups.workspace',+};+/**- * The Launchpad's persistent left rail: top-level section switcher up top,- * docs/community links pinned to the bottom. Kept deliberately narrow so the- * page area to its right gets the room — the model manager in particular wants- * the full width. Renders inside the section `Tabs.Root`, so the triggers carry- * the roving-focus and selection semantics for free.+ * Deliberately not the shared `dropdownGroupLabel` fragment: that one is tuned+ * for menu surfaces, and its `fg.subtle` only reaches 4.11:1 against the rail's+ * background at this size. `fg.muted` clears 4.5:1.*/-export const LaunchpadNav = ({ items }: { items: LaunchpadNavItem[] }) => (- <Stack- aria-label="Launchpad sections"- as="nav"- borderColor="border.subtle"- borderEndWidth={NAV_BORDER_END_WIDTH}- flexShrink={0}- gap="4"- h="full"- minH="0"- p="2"- w={NAV_WIDTH}- >- {items.length > 1 ? (- <Tabs.List flexShrink={0} gap="0.5">- {items.map((item) => (- <Tabs.Trigger key={item.id} value={item.id}>- <Icon as={item.icon} boxSize="3.5" flexShrink={0} />- <Text truncate>{item.label}</Text>- </Tabs.Trigger>- ))}- </Tabs.List>- ) : null}-- <Box mt={RESOURCE_LINKS_MARGIN_TOP}>- <ResourceLinks />- </Box>- </Stack>-);+const GROUP_LABEL_SX: SystemStyleObject = {+ color: 'fg.muted',+ fontSize: '2xs',+ fontWeight: '600',+ letterSpacing: '0.02em',+ textTransform: 'uppercase',+};++export const LaunchpadNav = ({ items }: { items: LaunchpadNavItem[] }) => {+ const { t } = useTranslation();+ const groups = useMemo(+ () =>+ GROUP_ORDER.map((group) => ({ group, items: items.filter((item) => item.group === group) })).filter(+ (entry) => entry.items.length > 0+ ),+ [items]+ );+ // Headings only earn their space once there is more than one group to tell+ // apart; a capability-limited account often has just the one.+ const showGroupLabels = groups.length > 1;++ return (+ <Stack+ aria-label={t('launchpad.sectionsLabel')}+ as="nav"+ borderColor="border.subtle"+ borderBottomWidth={NAV_BORDER_BOTTOM_WIDTH}+ borderEndWidth={NAV_BORDER_END_WIDTH}+ flexShrink={0}+ gap="2"+ h={NAV_HEIGHT}+ minH="0"+ p="2"+ w={NAV_WIDTH}+ >+ {items.length > 1 ? (+ <Tabs.List flexShrink={0} gap="0.5">+ {groups.map((entry, index) => (+ <Fragment key={entry.group}>+ {showGroupLabels ? (+ // A `role="separator"` element is an invalid tablist child, so+ // the spacing above each heading does the dividing instead.+ <Text css={GROUP_LABEL_SX} pb="1" pt={index > 0 ? '3' : '1'} px="2" role="presentation">+ {t(GROUP_LABEL_KEY[entry.group])}+ </Text>+ ) : null}+ {entry.items.map((item) => (+ <Tabs.Trigger key={item.id} value={item.id}>+ <Icon as={item.icon} boxSize="3.5" flexShrink={0} />+ <Text truncate>{item.label}</Text>+ </Tabs.Trigger>+ ))}+ </Fragment>+ ))}+ </Tabs.List>+ ) : null}++ <Box mt={FOOTER_MARGIN_TOP}>+ <HelpMenu />+ </Box>+ </Stack>+ );+};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/LaunchpadTopBar.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/LaunchpadTopBar.tsxindex 4cca2daa3a..14baafc995 100644--- a/invokeai/frontend/webv2/src/workbench/launchpad/LaunchpadTopBar.tsx+++ b/invokeai/frontend/webv2/src/workbench/launchpad/LaunchpadTopBar.tsx@@ -3,22 +3,26 @@ import type { BackendConnectionStatus } from '@platform/transport/types';import { Box, Flex, HStack, Text } from '@chakra-ui/react';import { AccountMenu } from '@features/identity';import { useConnectionStatusSelector } from '@platform/transport/connectionStore';-import { Button } from '@platform/ui';import { InvokeMark } from '@platform/ui/InvokeMark';-import { Link, useSearch } from '@tanstack/react-router';import { PaletteButton } from '@workbench/palette/PaletteButton';import { SettingsButton } from '@workbench/settings/SettingsButton';-import { ArrowLeftIcon } from 'lucide-react';-import { useMemo } from 'react';import { useTranslation } from 'react-i18next';-const CONNECTION_LABEL: Record<Exclude<BackendConnectionStatus, 'connected'>, string> = {- connecting: 'Connecting…',- disconnected: 'Disconnected',+import { OpenProjectsControl } from './OpenProjectsControl';++const CONNECTION_LABEL_KEY: Record<Exclude<BackendConnectionStatus, 'connected'>, string> = {+ connecting: 'launchpad.connection.connecting',+ disconnected: 'launchpad.connection.disconnected',};-/** Subtle backend-connection indicator; hidden while the socket is healthy. */+/**+ * Subtle backend-connection indicator; hidden while the socket is healthy.+ *+ * The status changes on its own, with no interaction to attribute it to, so+ * the region is announced politely rather than only being visible.+ */const ConnectionChip = () => {+ const { t } = useTranslation();const status = useConnectionStatusSelector((snapshot) => snapshot.status);if (status === 'connected') {@@ -29,6 +33,7 @@ const ConnectionChip = () => {return (<HStack+ aria-live="polite"bg="bg.muted"borderColor={isDown ? 'border.error' : 'border.subtle'}borderWidth="1px"@@ -37,50 +42,39 @@ const ConnectionChip = () => {py="1"rounded="full">- <Box bg={isDown ? 'fg.error' : 'fg.muted'} boxSize="1.5" 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">- {CONNECTION_LABEL[status]}+ {t(CONNECTION_LABEL_KEY[status])}</Text></HStack>);};-export const LaunchpadTopBar = () => {- const { t } = useTranslation();- const search = useSearch({ strict: false }) as { project?: string };- const projectSearch = useMemo(() => (search.project ? { project: search.project } : {}), [search.project]);-- return (- <Flex- align="center"- borderBottomWidth="1px"- bg="bg.subtle"- flexShrink={0}- justify="space-between"- pe="1.5"- ps="4"- h="12"- >- <HStack gap="3">- <InvokeMark size={20} />- <Text fontSize="sm" fontWeight="700">- Invoke- </Text>- <Button asChild size="xs" variant="subtle">- <Link search={projectSearch} to="/app">- <ArrowLeftIcon />- {t('launchpad.backToProject')}- </Link>- </Button>- </HStack>- <HStack gap="2">- <ConnectionChip />- <HStack gap="0.5">- <PaletteButton />- <SettingsButton />- <AccountMenu />- </HStack>+export const LaunchpadTopBar = () => (+ <Flex+ align="center"+ bg="bg.subtle"+ borderBottomWidth="1px"+ flexShrink={0}+ h="12"+ justify="space-between"+ pe="1.5"+ ps="4"+ >+ <HStack gap="3">+ <InvokeMark size={20} />+ <Text fontSize="sm" fontWeight="700">+ Invoke+ </Text>+ <OpenProjectsControl />+ </HStack>+ <HStack gap="2">+ <ConnectionChip />+ <HStack gap="0.5">+ <PaletteButton />+ <SettingsButton />+ <AccountMenu /></HStack>- </Flex>- );-};+ </HStack>+ </Flex>+);diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/NewProjectCard.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/NewProjectCard.tsxdeleted file mode 100644index c09b88e22c..0000000000--- a/invokeai/frontend/webv2/src/workbench/launchpad/NewProjectCard.tsx+++ /dev/null@@ -1,39 +0,0 @@-/* eslint-disable react-perf/jsx-no-jsx-as-prop, react-perf/jsx-no-new-array-as-prop, react-perf/jsx-no-new-function-as-prop, react-perf/jsx-no-new-object-as-prop */-import { Flex, Icon, Text } from '@chakra-ui/react';-import { Link } from '@tanstack/react-router';-import { PlusIcon } from 'lucide-react';-import { useTranslation } from 'react-i18next';--/** The grid's leading cell: start a fresh draft in the editor. */-export const NewProjectCard = () => {- const { t } = useTranslation();-- return (- <Flex- align="center"- borderColor="border.subtle"- borderStyle="dashed"- borderWidth="1.5px"- direction="column"- gap="2"- justify="center"- minH="40"- position="relative"- rounded="lg"- transition="border-color var(--wb-motion-duration-medium) ease, background var(--wb-motion-duration-medium) ease"- _hover={{ bg: 'bg.subtle', borderColor: 'border.emphasized' }}- >- <Link- aria-label={t('projects.createNewProject')}- search={{ new: true }}- style={{ inset: 0, position: 'absolute' }}- to="/app"- />- <Icon as={PlusIcon} boxSize="6" color="fg.muted" />- <Text color="fg.muted" fontSize="xs" fontWeight="600">- {t('projects.newProject')}- </Text>- </Flex>- );-};-/* eslint-disable react-perf/jsx-no-jsx-as-prop, react-perf/jsx-no-new-array-as-prop, react-perf/jsx-no-new-function-as-prop, react-perf/jsx-no-new-object-as-prop */diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/OpenProjectsControl.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/OpenProjectsControl.tsxnew file mode 100644index 0000000000..ef20d34926--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/OpenProjectsControl.tsx@@ -0,0 +1,120 @@+import { Icon, Menu, Portal, Text } from '@chakra-ui/react';+import { useMountEffect } from '@platform/react/useMountEffect';+import { Button } from '@platform/ui/Button';+import { MenuContent } from '@platform/ui/Menu';+import { Link } from '@tanstack/react-router';+import { useProjectLibrarySelector } from '@workbench/projects/library';+import { refreshOpenProjects, useOpenProjectsSelector } from '@workbench/projects/openProjects';+import { ArrowLeftIcon, CheckIcon } from 'lucide-react';+import { useMemo } from 'react';+import { useTranslation } from 'react-i18next';++/**+ * The way back into the editor, driven by the saved session rather than the+ * URL.+ *+ * The button used to be unconditional, which meant a brand-new account was+ * offered "Back to project" with no project to go back to — and `/app` bounces+ * a definitely-empty session straight back here. So an empty open set hides+ * the control entirely.+ *+ * An *unknown* session (first run, a pre-split blob, an unreachable backend)+ * is not the same as an empty one: the store reports it as `null` and the+ * `/app` guard deliberately does not redirect on it. This mirrors that —+ * unknown still offers the plain way in and lets the editor sort it out.+ */++const MENU_POSITIONING = { placement: 'bottom-start' } as const;++export const OpenProjectsControl = () => {+ const { t } = useTranslation();+ const status = useOpenProjectsSelector((snapshot) => snapshot.status);+ const openProjectIds = useOpenProjectsSelector((snapshot) => snapshot.ids);+ const activeProjectId = useOpenProjectsSelector((snapshot) => snapshot.activeId);+ const summaries = useProjectLibrarySelector((snapshot) => snapshot.summaries);++ useMountEffect(() => {+ void refreshOpenProjects();+ });++ const openProjects = useMemo(() => {+ if (!openProjectIds) {+ return [];+ }++ const nameById = new Map(summaries.map((summary) => [summary.id, summary.name]));++ return openProjectIds.map((id) => ({ id, name: nameById.get(id) ?? null }));+ }, [openProjectIds, summaries]);++ if (status !== 'ready') {+ return null;+ }++ if (openProjectIds === null) {+ return <OpenEditorButton />;+ }++ if (openProjects.length === 0) {+ return null;+ }++ const activeName = openProjects.find((project) => project.id === activeProjectId)?.name;+ const triggerLabel = activeName ?? t('launchpad.openProjects.label');++ return (+ <Menu.Root positioning={MENU_POSITIONING}>+ <Menu.Trigger asChild>+ <Button+ aria-label={activeName ? t('launchpad.openProjects.activeLabel', { name: activeName }) : triggerLabel}+ maxW="56"+ size="xs"+ variant="subtle"+ >+ <ArrowLeftIcon />+ <Text truncate>{triggerLabel}</Text>+ </Button>+ </Menu.Trigger>+ <Portal>+ <Menu.Positioner>+ <MenuContent minW="15rem">+ {openProjects.map((project) => (+ <OpenProjectItem+ id={project.id}+ isActive={project.id === activeProjectId}+ key={project.id}+ name={project.name}+ />+ ))}+ </MenuContent>+ </Menu.Positioner>+ </Portal>+ </Menu.Root>+ );+};++const OpenProjectItem = ({ id, isActive, name }: { id: string; isActive: boolean; name: string | null }) => {+ const search = useMemo(() => ({ project: id }), [id]);++ return (+ <Menu.Item asChild value={id}>+ <Link search={search} to="/app">+ <Icon as={CheckIcon} boxSize="3.5" opacity={isActive ? 1 : 0} />+ <Menu.ItemText>{name ?? id}</Menu.ItemText>+ </Link>+ </Menu.Item>+ );+};++const OpenEditorButton = () => {+ const { t } = useTranslation();++ return (+ <Button asChild size="xs" variant="subtle">+ <Link to="/app">+ <ArrowLeftIcon />+ {t('launchpad.openProjects.openEditor')}+ </Link>+ </Button>+ );+};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/ProjectCard.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/ProjectCard.tsxdeleted file mode 100644index 0a79fcca9d..0000000000--- a/invokeai/frontend/webv2/src/workbench/launchpad/ProjectCard.tsx+++ /dev/null@@ -1,223 +0,0 @@-import { Box, Flex, Icon, Menu, Portal, Stack, Text } from '@chakra-ui/react';-import { IconButton, ConfirmDialog, MenuContent, RenameDialog, toaster } from '@platform/ui';-import { Link } from '@tanstack/react-router';-import {- deleteLibraryProject,- duplicateLibraryProject,- renameLibraryProject,- type ProjectSummary,-} from '@workbench/projects/library';-import { exportLibraryProject } from '@workbench/projects/projectFile';-import {- ArrowRightIcon,- CopyIcon,- EllipsisVerticalIcon,- FileDownIcon,- FolderIcon,- PencilIcon,- Trash2Icon,-} from 'lucide-react';-import { useCallback, useMemo, useState, type MouseEvent } from 'react';-import { useTranslation } from 'react-i18next';--import { formatRelativeTime } from './formatRelativeTime';--const CARD_HOVER = { bg: 'bg.muted', borderColor: 'border.emphasized' } as const;-const LINK_STYLE = { inset: 0, position: 'absolute' } as const;-const MENU_ITEM_DELETE_HOVER = { bg: 'bg.error', color: 'fg.error' } as const;-const MENU_POSITION_BOTTOM_END = { placement: 'bottom-end' } as const;--/**- * One saved project in the Home grid. The whole card is a deep link into the- * editor (`/app?project=…` — hovering preloads the editor chunk); the corner- * menu carries the library actions, which all run against the server without- * mounting the editor.- */-export const ProjectCard = ({ summary }: { summary: ProjectSummary }) => {- const { t } = useTranslation();- const [isRenameOpen, setIsRenameOpen] = useState(false);- const [isDeleteOpen, setIsDeleteOpen] = useState(false);- const [isActionsOpen, setIsActionsOpen] = useState(false);- const [contextMenuTarget, setContextMenuTarget] = useState<{ x: number; y: number } | null>(null);-- const projectSearch = useMemo(() => ({ project: summary.id }), [summary.id]);- const menuPositioning = useMemo(- () =>- contextMenuTarget- ? {- getAnchorRect: () => ({ height: 1, width: 1, x: contextMenuTarget.x, y: contextMenuTarget.y }),- placement: 'bottom-start' as const,- }- : MENU_POSITION_BOTTOM_END,- [contextMenuTarget]- );-- const handleRename = useCallback(- async (name: string) => {- try {- await renameLibraryProject(summary.id, name);- } catch (error) {- toaster.create({- description: error instanceof Error ? error.message : undefined,- title: t('projects.renameFailed'),- type: 'error',- });- throw error;- }- },- [summary.id, t]- );-- const handleDuplicate = useCallback(async () => {- try {- const copy = await duplicateLibraryProject(summary.id);-- toaster.create({- description: t('projects.projectDuplicatedDescription', { name: copy.name }),- title: t('projects.projectDuplicated'),- type: 'success',- });- } catch (error) {- toaster.create({- description: error instanceof Error ? error.message : undefined,- title: t('projects.duplicateFailed'),- type: 'error',- });- }- }, [summary.id, t]);-- const handleExport = useCallback(async () => {- try {- await exportLibraryProject(summary.id);- } catch (error) {- toaster.create({- description: error instanceof Error ? error.message : undefined,- title: t('projects.exportFailed'),- type: 'error',- });- }- }, [summary.id, t]);-- const handleDelete = useCallback(async () => {- try {- await deleteLibraryProject(summary.id);- } catch (error) {- toaster.create({- description: error instanceof Error ? error.message : undefined,- title: t('projects.deleteFailed'),- type: 'error',- });- }- }, [summary.id, t]);- const handleContextMenu = useCallback((event: MouseEvent<HTMLDivElement>) => {- event.preventDefault();- setContextMenuTarget({ x: event.clientX, y: event.clientY });- setIsActionsOpen(true);- }, []);- const handleOpenChange = useCallback((event: { open: boolean }) => {- setIsActionsOpen(event.open);-- if (!event.open) {- setContextMenuTarget(null);- }- }, []);- const clearContextMenuTarget = useCallback(() => setContextMenuTarget(null), []);- const openRenameDialog = useCallback(() => setIsRenameOpen(true), []);- const closeRenameDialog = useCallback(() => setIsRenameOpen(false), []);- const openDeleteDialog = useCallback(() => setIsDeleteOpen(true), []);- const closeDeleteDialog = useCallback(() => setIsDeleteOpen(false), []);-- return (- <Box- bg="bg.subtle"- borderColor="border.subtle"- borderWidth="1px"- overflow="hidden"- position="relative"- rounded="lg"- transition="border-color var(--wb-motion-duration-medium) ease, background var(--wb-motion-duration-medium) ease"- _hover={CARD_HOVER}- onContextMenu={handleContextMenu}- >- <Link- aria-label={t('projects.openProjectLabel', { name: summary.name })}- search={projectSearch}- style={LINK_STYLE}- to="/app"- />- <Flex align="center" bg="bg.muted" h="24" justify="center" pointerEvents="none">- <Icon as={FolderIcon} boxSize="8" color="fg.subtle" opacity={0.6} />- </Flex>- <Flex align="center" gap="2" p="3" pointerEvents="none">- <Stack flex="1" gap="0" minW="0">- <Text fontSize="xs" fontWeight="600" truncate>- {summary.name}- </Text>- <Text color="fg.muted" fontSize="2xs">- {t('projects.editedRelative', { time: formatRelativeTime(summary.updatedAt) })}- </Text>- </Stack>- </Flex>- <Box bottom="2" pointerEvents="auto" position="absolute" right="2" zIndex="1">- <Menu.Root open={isActionsOpen} positioning={menuPositioning} onOpenChange={handleOpenChange}>- <Menu.Trigger asChild>- <IconButton- aria-label={t('common.actions')}- color="fg.muted"- size="2xs"- variant="ghost"- onClick={clearContextMenuTarget}- >- <EllipsisVerticalIcon />- </IconButton>- </Menu.Trigger>- <Portal>- <Menu.Positioner>- <MenuContent minW="44">- <Menu.Item asChild value="open">- <Link search={projectSearch} to="/app">- <Icon as={ArrowRightIcon} boxSize="3.5" />- {t('common.open')}- </Link>- </Menu.Item>- <Menu.Item value="rename" onClick={openRenameDialog}>- <Icon as={PencilIcon} boxSize="3.5" />- {t('projects.renameWithEllipsis')}- </Menu.Item>- <Menu.Item value="duplicate" onClick={handleDuplicate}>- <Icon as={CopyIcon} boxSize="3.5" />- {t('common.duplicate')}- </Menu.Item>- <Menu.Item value="export" onClick={handleExport}>- <Icon as={FileDownIcon} boxSize="3.5" />- {t('common.export')}- </Menu.Item>- <Menu.Separator />- <Menu.Item color="fg.error" value="delete" _hover={MENU_ITEM_DELETE_HOVER} onClick={openDeleteDialog}>- <Icon as={Trash2Icon} boxSize="3.5" />- {t('common.delete')}…- </Menu.Item>- </MenuContent>- </Menu.Positioner>- </Portal>- </Menu.Root>- </Box>-- <RenameDialog- initialName={summary.name}- isOpen={isRenameOpen}- onClose={closeRenameDialog}- onSubmit={handleRename}- />-- <ConfirmDialog- body={t('projects.deleteProjectCardBody', { name: summary.name })}- confirmLabel={t('projects.deleteProject')}- isOpen={isDeleteOpen}- title={t('projects.deleteProjectQuestion')}- onClose={closeDeleteDialog}- onConfirm={handleDelete}- />- </Box>- );-};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/ProjectsGrid.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/ProjectsGrid.tsxdeleted file mode 100644index cd2fe58bcf..0000000000--- a/invokeai/frontend/webv2/src/workbench/launchpad/ProjectsGrid.tsx+++ /dev/null@@ -1,46 +0,0 @@-import { Alert, SimpleGrid, Skeleton, Stack } from '@chakra-ui/react';-import { Button } from '@platform/ui';-import { refreshProjectLibrary, useProjectLibrarySelector } from '@workbench/projects/library';-import { useCallback } from 'react';-import { useTranslation } from 'react-i18next';--import { NewProjectCard } from './NewProjectCard';-import { ProjectCard } from './ProjectCard';--const GRID_COLUMNS = { base: 1, lg: 3, sm: 2 } as const;--/**- * The saved-projects grid, fed by the project library store (summaries are- * already sorted most-recently-edited first). The "new project" cell always- * leads, so an empty library still presents the next step.- */-export const ProjectsGrid = () => {- const { t } = useTranslation();- const error = useProjectLibrarySelector((snapshot) => snapshot.error);- const status = useProjectLibrarySelector((snapshot) => snapshot.status);- const summaries = useProjectLibrarySelector((snapshot) => snapshot.summaries);- const isFirstLoad = summaries.length === 0 && (status === 'idle' || status === 'loading');- const handleRetry = useCallback(() => void refreshProjectLibrary(), []);-- return (- <Stack gap="3">- {status === 'error' ? (- <Alert.Root borderRadius="md" size="sm" status="error">- <Alert.Indicator />- <Alert.Title flex="1" fontSize="xs">- {error ?? t('projects.failedToLoad')}- </Alert.Title>- <Button size="2xs" variant="outline" onClick={handleRetry}>- {t('common.retry')}- </Button>- </Alert.Root>- ) : null}- <SimpleGrid columns={GRID_COLUMNS} gap="4">- <NewProjectCard />- {isFirstLoad- ? Array.from({ length: 3 }, (_value, index) => <Skeleton key={index} minH="40" rounded="lg" />)- : summaries.map((summary) => <ProjectCard key={summary.id} summary={summary} />)}- </SimpleGrid>- </Stack>- );-};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/ResourceLinks.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/ResourceLinks.tsxdeleted file mode 100644index e8296153ee..0000000000--- a/invokeai/frontend/webv2/src/workbench/launchpad/ResourceLinks.tsx+++ /dev/null@@ -1,52 +0,0 @@-import type { ComponentType } from 'react';--import { Card, Flex, Icon, Link, Stack, Text } from '@chakra-ui/react';-import { BookOpenTextIcon, ClapperboardIcon, CodeIcon, ExternalLinkIcon, MessagesSquareIcon } from 'lucide-react';--type ResourceLink = { href: string; icon: ComponentType; label: string };--const COMMUNITY: ResourceLink[] = [- { href: 'https://discord.gg/ZmtBAhwWhy', icon: MessagesSquareIcon, label: 'Discord' },- { href: 'https://github.com/invoke-ai/InvokeAI', icon: CodeIcon, label: 'GitHub' },-];--const GUIDES: ResourceLink[] = [- { href: 'https://invoke-ai.github.io/InvokeAI/', icon: BookOpenTextIcon, label: 'Documentation' },- { href: 'https://www.youtube.com/@invokeai', icon: ClapperboardIcon, label: 'YouTube' },-];--const RESOURCES = [- {- label: 'Community',- resources: COMMUNITY,- },- {- label: 'Guides',- resources: GUIDES,- },-];--const ResourceItem = ({ href, icon, label }: ResourceLink) => (- <Link href={href} target="_blank" rel="noreferrer" asChild>- <Flex align="center" gap={2} py={1}>- <Icon as={icon} boxSize="3.5" />- <Text fontSize="sm">{label}</Text>- <Icon as={ExternalLinkIcon} boxSize="3" color="fg.subtle" ms="auto" />- </Flex>- </Link>-);--export const ResourceLinks = () => (- <Stack>- {RESOURCES.map((section) => (- <Card.Root variant="outline" size="sm" key={section.label}>- <Card.Header fontSize="sm">{section.label}</Card.Header>- <Card.Body pt="2">- {section.resources.map((resource) => (- <ResourceItem {...resource} key={resource.href} />- ))}- </Card.Body>- </Card.Root>- ))}- </Stack>-);diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/home/IntentTiles.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/home/IntentTiles.tsxnew file mode 100644index 0000000000..714d8a6159--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/home/IntentTiles.tsx@@ -0,0 +1,82 @@+import type { LaunchpadIntentId } from '@workbench/launchpad/intents';+import type { LucideIcon } from 'lucide-react';++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, ScalingIcon, TypeIcon } from 'lucide-react';+import { useMemo } from 'react';+import { useTranslation } from 'react-i18next';++/**+ * "What do you want to make?", asked before "which file do you want to open?".+ *+ * Each tile opens a fresh draft already arranged for that kind of work. The+ * old frontend put this inside the editor as a per-tab panel; at the home+ * level it is the first move rather than a thing you find after arriving.+ */++const TILE_COLUMNS = { base: 1, lg: 4, sm: 2 } as const;+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,+ 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',+ 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',+ workflow: 'launchpad.home.intents.workflowDescription',+};++const IntentTile = ({ id }: { id: LaunchpadIntentId }) => {+ const { t } = useTranslation();+ const search = useMemo(() => ({ intent: id, new: true }) as const, [id]);++ return (+ <Link search={search} to="/app">+ <Stack+ bg="bg.subtle"+ borderColor="border.subtle"+ borderWidth="1px"+ gap="1"+ h="full"+ p="3"+ rounded="lg"+ transition={TILE_TRANSITION}+ _hover={TILE_HOVER}+ >+ <Icon as={INTENT_ICON[id]} boxSize="4" color="fg.muted" />+ <Text fontSize="xs" fontWeight="600">+ {t(INTENT_LABEL_KEY[id])}+ </Text>+ <Text color="fg.muted" fontSize="2xs">+ {t(INTENT_DESCRIPTION_KEY[id])}+ </Text>+ </Stack>+ </Link>+ );+};++export const IntentTiles = () => (+ <SimpleGrid columns={TILE_COLUMNS} gap="3">+ {LAUNCHPAD_INTENT_IDS.map((id) => (+ <IntentTile id={id} key={id} />+ ))}+ </SimpleGrid>+);diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/home/LivePanel.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/home/LivePanel.tsxnew file mode 100644index 0000000000..3ff021d02a--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/home/LivePanel.tsx@@ -0,0 +1,34 @@+import { lazy, Suspense } from 'react';++/**+ * Places one live panel on Home.+ *+ * All three resolve from the same `import('./livePanels')` promise, so the+ * bundler emits a single dynamic chunk for the lot rather than one per panel —+ * but each still mounts wherever the page wants it. Every panel renders+ * nothing until it has something to report, so the fallback is `null`: a+ * skeleton for a band that will usually turn out to be empty is worse than+ * nothing appearing at all.+ */++const loadLivePanels = () => import('./livePanels');++const ModelsNotice = lazy(() => loadLivePanels().then((module) => ({ default: module.ModelsNotice })));+const QueueStatusBand = lazy(() => loadLivePanels().then((module) => ({ default: module.QueueStatusBand })));+const RecentOutputs = lazy(() => loadLivePanels().then((module) => ({ default: module.RecentOutputs })));++const PANELS = {+ models: ModelsNotice,+ outputs: RecentOutputs,+ queue: QueueStatusBand,+} as const;++export const LivePanel = ({ panel }: { panel: keyof typeof PANELS }) => {+ const Panel = PANELS[panel];++ return (+ <Suspense fallback={null}>+ <Panel />+ </Suspense>+ );+};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/home/RecentProjectsRow.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/home/RecentProjectsRow.tsxnew file mode 100644index 0000000000..2ef85443f7--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/home/RecentProjectsRow.tsx@@ -0,0 +1,58 @@+import type { ProjectSummary } from '@workbench/projects/library';++import { Flex, SimpleGrid, Text } from '@chakra-ui/react';+import { Button } from '@platform/ui/Button';+import { Link } from '@tanstack/react-router';+import { ProjectCard } from '@workbench/launchpad/projects/ProjectCard';+import { ArrowRightIcon } from 'lucide-react';+import { useTranslation } from 'react-i18next';++/**+ * A short strip of recent projects under the resume card — enough to recognise+ * what else is in flight without turning Home into a second library. The full+ * one is a click away.+ */++const GRID_COLUMNS = { base: 1, lg: 4, sm: 2 } as const;++export const RecentProjectsRow = ({+ pinnedIds,+ summaries,+ onTogglePin,+}: {+ pinnedIds: readonly string[];+ summaries: readonly ProjectSummary[];+ onTogglePin: (projectId: string) => void;+}) => {+ const { t } = useTranslation();++ if (summaries.length === 0) {+ return null;+ }++ return (+ <Flex direction="column" gap="3">+ <Flex align="center" justify="space-between">+ <Text fontSize="xs" fontWeight="700">+ {t('launchpad.home.recentProjects')}+ </Text>+ <Button asChild size="2xs" variant="ghost">+ <Link to="/projects">+ {t('launchpad.home.viewAllProjects')}+ <ArrowRightIcon />+ </Link>+ </Button>+ </Flex>+ <SimpleGrid columns={GRID_COLUMNS} gap="4">+ {summaries.map((summary) => (+ <ProjectCard+ isPinned={pinnedIds.includes(summary.id)}+ key={summary.id}+ summary={summary}+ onTogglePin={onTogglePin}+ />+ ))}+ </SimpleGrid>+ </Flex>+ );+};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/home/ResumeCard.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/home/ResumeCard.tsxnew file mode 100644index 0000000000..cbd3f5a8ba--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/home/ResumeCard.tsx@@ -0,0 +1,74 @@+import type { ProjectSummary } from '@workbench/projects/library';++import { Box, Flex, Stack, Text } from '@chakra-ui/react';+import { Button } from '@platform/ui/Button';+import { Link } from '@tanstack/react-router';+import { formatRelativeTime } from '@workbench/launchpad/formatRelativeTime';+import { ProjectCover } from '@workbench/launchpad/projects/ProjectCover';+import { ArrowRightIcon } from 'lucide-react';+import { useMemo } from 'react';+import { useTranslation } from 'react-i18next';++/**+ * The single most recently edited project, given more room than the rest.+ *+ * Returning users almost always want the thing they were last working on, and+ * making them find it in a grid of equals is the small tax the old home screen+ * charged on every visit.+ */++const CARD_HOVER = { bg: 'bg.muted', borderColor: 'border.emphasized' } as const;+const LINK_STYLE = { inset: 0, position: 'absolute' } as const;+const CARD_TRANSITION =+ 'border-color var(--wb-motion-duration-medium) ease, background var(--wb-motion-duration-medium) ease';+const COVER_WIDTH = { base: '32', sm: '40' } as const;++export const ResumeCard = ({ summary }: { summary: ProjectSummary }) => {+ const { t } = useTranslation();+ const search = useMemo(() => ({ project: summary.id }), [summary.id]);++ return (+ <Flex+ align="stretch"+ bg="bg.subtle"+ borderColor="border.subtle"+ borderWidth="1px"+ overflow="hidden"+ position="relative"+ rounded="lg"+ transition={CARD_TRANSITION}+ _hover={CARD_HOVER}+ >+ <Link+ aria-label={t('projects.openProjectLabel', { name: summary.name })}+ search={search}+ style={LINK_STYLE}+ to="/app"+ />+ <Box flexShrink={0} pointerEvents="none" w={COVER_WIDTH}>+ <ProjectCover coverUrl={summary.coverUrl} />+ </Box>+ <Flex align="center" flex="1" gap="3" justify="space-between" minW="0" p="4" pointerEvents="none" wrap="wrap">+ <Stack gap="0.5" minW="0">+ <Text color="fg.muted" fontSize="2xs" fontWeight="600" textTransform="uppercase">+ {t('launchpad.home.resume')}+ </Text>+ <Text fontSize="sm" fontWeight="700" truncate>+ {summary.name}+ </Text>+ <Text color="fg.muted" fontSize="2xs">+ {t('projects.editedRelative', { time: formatRelativeTime(summary.updatedAt) })}+ </Text>+ </Stack>+ <Box pointerEvents="auto">+ <Button asChild size="xs" variant="solid">+ <Link search={search} to="/app">+ {t('launchpad.home.resumeAction')}+ <ArrowRightIcon />+ </Link>+ </Button>+ </Box>+ </Flex>+ </Flex>+ );+};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/home/livePanels.ts b/invokeai/frontend/webv2/src/workbench/launchpad/home/livePanels.tsnew file mode 100644index 0000000000..0e3bb98ee6--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/home/livePanels.ts@@ -0,0 +1,13 @@+/**+ * Every Launchpad panel that reads live backend state, behind one import.+ *+ * These are the only Home surfaces that need Gallery, Models, or Queue code,+ * none of which belongs in the Launchpad's initial graph. Giving each its own+ * `lazy()` boundary cost ten extra requests at first paint, because each+ * dynamic entry split its own copy of the shared feature graph out with it.+ * Collapsing them into this single module means one dynamic chunk for all+ * three, while `LivePanel` still lets the page place them independently.+ */+export { RecentOutputs } from '@features/gallery/launchpad';+export { ModelsNotice } from '@features/models/launchpad';+export { QueueStatusBand } from '@features/queue/launchpad';diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/intents.test.ts b/invokeai/frontend/webv2/src/workbench/launchpad/intents.test.tsnew file mode 100644index 0000000000..7ecbd21d74--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/intents.test.ts@@ -0,0 +1,41 @@+import { isLaunchpadIntentId, LAUNCHPAD_INTENT_IDS, resolveLaunchpadIntent } from '@workbench/launchpad/intents';+import { builtInLayoutPresetDescriptors } from '@workbench/layoutPresets';+import { describe, expect, it } from 'vitest';++describe('launchpad intents', () => {+ it('resolves every advertised id', () => {+ for (const id of LAUNCHPAD_INTENT_IDS) {+ expect(resolveLaunchpadIntent(id)?.id).toBe(id);+ }+ });++ it('names a real built-in preset for every intent', () => {+ const presetIds = new Set(builtInLayoutPresetDescriptors.map((descriptor) => descriptor.preset.id));++ for (const id of LAUNCHPAD_INTENT_IDS) {+ expect(presetIds).toContain(resolveLaunchpadIntent(id)?.presetId);+ }+ });++ it('opens text-to-image in Compose and node work in Automate', () => {+ expect(resolveLaunchpadIntent('generate')).toEqual({ id: 'generate', presetId: 'compose', sourceId: 'generate' });+ expect(resolveLaunchpadIntent('workflow')).toEqual({ id: 'workflow', presetId: 'automate', sourceId: 'workflow' });+ });++ it('sets a source that a preset alone could not imply', () => {+ // Compose hosts both generate and upscale, so the intent has to say which.+ const generate = resolveLaunchpadIntent('generate');+ const upscale = resolveLaunchpadIntent('upscale');++ expect(generate?.presetId).toBe(upscale?.presetId);+ expect(generate?.sourceId).not.toBe(upscale?.sourceId);+ });++ it('falls back to no intent for a stale or hand-edited value', () => {+ expect(resolveLaunchpadIntent('sideways')).toBeNull();+ expect(resolveLaunchpadIntent(undefined)).toBeNull();+ expect(resolveLaunchpadIntent(42)).toBeNull();+ expect(isLaunchpadIntentId('generate')).toBe(true);+ expect(isLaunchpadIntentId('')).toBe(false);+ });+});diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/intents.ts b/invokeai/frontend/webv2/src/workbench/launchpad/intents.tsnew file mode 100644index 0000000000..1100ca8f83--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/intents.ts@@ -0,0 +1,43 @@+import type { InvocationSourceId } from '@workbench/invocationContracts';+import type { BuiltInLayoutPresetId } from '@workbench/layoutContracts';++/**+ * What the user said they wanted to make, translated into how the editor+ * should open.+ *+ * A layout preset deliberately does not imply an invocation source — several+ * graph widgets are placed in every preset, which is why `builtInLayoutPresets`+ * warns against inferring one from the other. An intent therefore names both+ * explicitly rather than deriving one from the other.+ *+ * This is the whole contract behind `/app?new=true&intent=…`: the Launchpad+ * writes the id into the URL, and the editor's session controller applies it+ * once, on the fresh draft.+ */++export type LaunchpadIntentId = 'generate' | 'canvas' | 'upscale' | 'workflow';++export interface LaunchpadIntent {+ id: LaunchpadIntentId;+ presetId: BuiltInLayoutPresetId;+ sourceId: InvocationSourceId;+}++export const LAUNCHPAD_INTENT_IDS: readonly LaunchpadIntentId[] = ['generate', 'canvas', 'upscale', 'workflow'];++const INTENTS: Record<LaunchpadIntentId, LaunchpadIntent> = {+ canvas: { id: 'canvas', presetId: 'edit', sourceId: 'canvas' },+ generate: { id: 'generate', presetId: 'compose', sourceId: 'generate' },+ upscale: { id: 'upscale', presetId: 'compose', sourceId: 'upscale' },+ workflow: { id: 'workflow', presetId: 'automate', sourceId: 'workflow' },+};++export const isLaunchpadIntentId = (value: unknown): value is LaunchpadIntentId =>+ typeof value === 'string' && LAUNCHPAD_INTENT_IDS.includes(value as LaunchpadIntentId);++/**+ * `null` for anything unrecognised — a hand-edited or stale URL should open a+ * plain draft rather than fail.+ */+export const resolveLaunchpadIntent = (value: unknown): LaunchpadIntent | null =>+ isLaunchpadIntentId(value) ? INTENTS[value] : null;diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/pages/HomePage.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/pages/HomePage.tsxnew file mode 100644index 0000000000..a8a970edb3--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/pages/HomePage.tsx@@ -0,0 +1,150 @@+/* eslint-disable react-perf/jsx-no-jsx-as-prop */+import { Skeleton, Stack, Text } from '@chakra-ui/react';+import { useAuthSession, useCapabilities } from '@features/identity';+import { LAUNCHPAD_READY_MARK, markSemanticReady } from '@platform/performance/semanticReady';+import { useMountEffect } from '@platform/react/useMountEffect';+import {+ assertAccountScopeCurrent,+ captureAccountScope,+ isAccountScopeCurrent,+} from '@platform/state/accountLifecycle';+import { Button, toaster } from '@platform/ui';+import { PageShell } from '@platform/ui/PageShell';+import { Link, useNavigate } from '@tanstack/react-router';+import { IntentTiles } from '@workbench/launchpad/home/IntentTiles';+import { LivePanel } from '@workbench/launchpad/home/LivePanel';+import { RecentProjectsRow } from '@workbench/launchpad/home/RecentProjectsRow';+import { ResumeCard } from '@workbench/launchpad/home/ResumeCard';+import { KnownBrowserIssuesAlert } from '@workbench/launchpad/KnownBrowserIssuesAlert';+import { prunePinnedProjects, toggleProjectPinPreference } from '@workbench/launchpad/projects/projectPins';+import { getProjectLibrary, refreshProjectLibrary, useProjectLibrarySelector } from '@workbench/projects/library';+import { refreshOpenProjects } from '@workbench/projects/openProjects';+import { importProjectFile, pickProjectFile } from '@workbench/projects/projectFile';+import { useWorkbenchPreferenceSelector } from '@workbench/settings/store';+import { FileUpIcon, PlusIcon } from 'lucide-react';+import { useCallback } from 'react';+import { useTranslation } from 'react-i18next';++/**+ * The Launchpad's landing section: resume what you were doing, or start+ * something new.+ *+ * Home deliberately shows only a handful of recent projects — the full library+ * is its own section. What it adds over a file list is the first move: intent+ * tiles that open a draft already arranged for the kind of work you named.+ */++const NEW_PROJECT_SEARCH = { new: true } as const;+const RECENT_PROJECT_COUNT = 4;+const BROWSER_ISSUES_BANNER = <KnownBrowserIssuesAlert />;++export const HomePage = () => {+ const session = useAuthSession();+ const { canManageModels } = useCapabilities();+ const navigate = useNavigate();+ const { t } = useTranslation();++ const status = useProjectLibrarySelector((snapshot) => snapshot.status);+ const summaries = useProjectLibrarySelector((snapshot) => snapshot.summaries);+ const pinnedIds = useWorkbenchPreferenceSelector((preferences) => preferences.launchpadPinnedProjectIds);++ useMountEffect(() => {+ const owner = captureAccountScope();++ void refreshOpenProjects();+ void refreshProjectLibrary().then(() => {+ if (isAccountScopeCurrent(owner)) {+ prunePinnedProjects(getProjectLibrary().summaries);+ markSemanticReady(LAUNCHPAD_READY_MARK);+ }+ });+ });++ const displayName = session.user?.display_name?.trim();+ const greeting = displayName+ ? t('launchpad.projectsGreetingWithName', { name: displayName })+ : t('launchpad.projectsGreeting');++ const handleImport = useCallback(async () => {+ const owner = captureAccountScope();+ const file = await pickProjectFile(owner);++ if (!file || !isAccountScopeCurrent(owner)) {+ return;+ }++ try {+ const record = await importProjectFile(file, owner);++ assertAccountScopeCurrent(owner);+ await navigate({ search: { project: record.project_id }, to: '/app' });+ assertAccountScopeCurrent(owner);+ } catch (error) {+ if (!isAccountScopeCurrent(owner)) {+ return;+ }++ toaster.create({+ description: error instanceof Error ? error.message : undefined,+ title: t('projects.importFailed'),+ type: 'error',+ });+ }+ }, [navigate, t]);+ const handleImportClick = useCallback(() => void handleImport(), [handleImport]);++ const isFirstLoad = summaries.length === 0 && (status === 'idle' || status === 'loading');+ const [mostRecent, ...rest] = summaries;++ return (+ <PageShell+ actions={+ <>+ <Button size="xs" variant="outline" onClick={handleImportClick}>+ <FileUpIcon />+ {t('projects.importWithEllipsis')}+ </Button>+ <Button asChild size="xs" variant="solid">+ <Link search={NEW_PROJECT_SEARCH} to="/app">+ <PlusIcon />+ {t('projects.newProject')}+ </Link>+ </Button>+ </>+ }+ banner={BROWSER_ISSUES_BANNER}+ description={t('launchpad.projectsSubtitle')}+ regionLabel={t('launchpad.sections.home')}+ title={greeting}+ >+ {/* Ordered by how much it should interrupt: a missing model blocks+ everything, a running job is worth knowing about, the rest is+ browsing. Each renders nothing when it has nothing to say.++ The models panel is capability-gated rather than merely hidden: every+ endpoint it touches — catalog, starters, install — is admin-only, so+ mounting it for a non-admin would mean a burst of unauthorized+ requests on every visit to Home, and a call to action they could not+ complete. */}+ {canManageModels ? <LivePanel panel="models" /> : null}+ <LivePanel panel="queue" />++ {isFirstLoad ? <Skeleton minH="24" rounded="lg" /> : mostRecent ? <ResumeCard summary={mostRecent} /> : null}++ <Stack gap="3">+ <Text fontSize="xs" fontWeight="700">+ {t('launchpad.home.intents.heading')}+ </Text>+ <IntentTiles />+ </Stack>++ <RecentProjectsRow+ pinnedIds={pinnedIds}+ summaries={rest.slice(0, RECENT_PROJECT_COUNT)}+ onTogglePin={toggleProjectPinPreference}+ />++ <LivePanel panel="outputs" />+ </PageShell>+ );+};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/pages/ProjectsPage.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/pages/ProjectsPage.tsxindex 6ee851d607..294e81f007 100644--- a/invokeai/frontend/webv2/src/workbench/launchpad/pages/ProjectsPage.tsx+++ b/invokeai/frontend/webv2/src/workbench/launchpad/pages/ProjectsPage.tsx@@ -1,7 +1,7 @@-import type { SystemStyleObject } from '@chakra-ui/react';+/* eslint-disable react-perf/jsx-no-jsx-as-prop */+import type { ProjectSortId, ProjectsViewId } from '@workbench/launchpad/projects/projectLibraryView';-import { Flex, Heading, HStack, Stack, Text } from '@chakra-ui/react';-import { useAuthSession } from '@features/identity';+import { Stack } from '@chakra-ui/react';import { LAUNCHPAD_READY_MARK, markSemanticReady } from '@platform/performance/semanticReady';import { useMountEffect } from '@platform/react/useMountEffect';import {@@ -9,49 +9,62 @@ import {captureAccountScope,isAccountScopeCurrent,} from '@platform/state/accountLifecycle';-import { Button, Scrollable, toaster } from '@platform/ui';+import { Button, toaster } from '@platform/ui';+import { PageShell } from '@platform/ui/PageShell';import { Link, useNavigate } from '@tanstack/react-router';import { KnownBrowserIssuesAlert } from '@workbench/launchpad/KnownBrowserIssuesAlert';-import { ProjectsGrid } from '@workbench/launchpad/ProjectsGrid';-import { refreshProjectLibrary } from '@workbench/projects/library';+import { prunePinnedProjects, toggleProjectPinPreference } from '@workbench/launchpad/projects/projectPins';+import { ProjectsBrowser } from '@workbench/launchpad/projects/ProjectsBrowser';+import { ProjectsToolbar } from '@workbench/launchpad/projects/ProjectsToolbar';+import { getProjectLibrary, refreshProjectLibrary } from '@workbench/projects/library';+import { refreshOpenProjects } from '@workbench/projects/openProjects';import { importProjectFile, pickProjectFile } from '@workbench/projects/projectFile';+import { patchWorkbenchPreferences, useWorkbenchPreferenceSelector } from '@workbench/settings/store';import { FileUpIcon, PlusIcon } from 'lucide-react';-import { useCallback } from 'react';+import { useCallback, useState } from 'react';import { useTranslation } from 'react-i18next';/**- * The Launchpad's home section: your project library. It keeps a comfortable- * centered measure (the grid reads better than full-bleed) and owns its own- * scroll so the rail and header stay fixed.+ * The Launchpad's project library.+ *+ * Sort, layout, and pins persist through workbench preferences, so they follow+ * the account rather than the browser. The search term deliberately does not —+ * a filter you did not set is a filter you cannot find your way out of.*/-const PROJECTS_PAGE_MEASURE_SX: SystemStyleObject = {- maxW: '6xl',- mx: 'auto',- p: { base: 4, md: 8 },- w: 'full',-};const NEW_PROJECT_SEARCH = { new: true } as const;export const ProjectsPage = () => {- const session = useAuthSession();const navigate = useNavigate();const { t } = useTranslation();+ const [searchTerm, setSearchTerm] = useState('');+ // Captured once per visit: the date buckets should reflect when the library+ // was opened, and reading the clock each render would rebucket unstably.+ const [now] = useState(() => Date.now());++ const view = useWorkbenchPreferenceSelector((preferences) => preferences.launchpadProjectsView);+ const sort = useWorkbenchPreferenceSelector((preferences) => preferences.launchpadProjectsSort);+ const pinnedIds = useWorkbenchPreferenceSelector((preferences) => preferences.launchpadPinnedProjectIds);useMountEffect(() => {const owner = captureAccountScope();+ void refreshOpenProjects();void refreshProjectLibrary().then(() => {if (isAccountScopeCurrent(owner)) {+ prunePinnedProjects(getProjectLibrary().summaries);markSemanticReady(LAUNCHPAD_READY_MARK);}});});- const displayName = session.user?.display_name?.trim();- const greeting = displayName- ? t('launchpad.projectsGreetingWithName', { name: displayName })- : t('launchpad.projectsGreeting');+ const handleViewChange = useCallback((next: ProjectsViewId) => {+ void patchWorkbenchPreferences({ launchpadProjectsView: next });+ }, []);+ const handleSortChange = useCallback((next: ProjectSortId) => {+ void patchWorkbenchPreferences({ launchpadProjectsSort: next });+ }, []);+ const handleClearSearch = useCallback(() => setSearchTerm(''), []);const handleImport = useCallback(async () => {const owner = captureAccountScope();@@ -82,33 +95,47 @@ export const ProjectsPage = () => {const handleImportClick = useCallback(() => void handleImport(), [handleImport]);return (- <Scrollable h="full" label={t('launchpad.sections.projects')} minH="0">- <Stack css={PROJECTS_PAGE_MEASURE_SX} gap="5">- <Flex align="center" gap="3" justify="space-between" wrap="wrap">- <Stack gap="0.5">- <Heading fontSize="xl" fontWeight="700">- {greeting}- </Heading>- <Text color="fg.muted" fontSize="xs">- {t('launchpad.projectsSubtitle')}- </Text>- </Stack>- <HStack gap="2" wrap="wrap">- <Button size="xs" variant="outline" onClick={handleImportClick}>- <FileUpIcon />- {t('projects.importWithEllipsis')}- </Button>- <Button asChild size="xs" variant="solid">- <Link search={NEW_PROJECT_SEARCH} to="/app">- <PlusIcon />- {t('projects.newProject')}- </Link>- </Button>- </HStack>- </Flex>- <KnownBrowserIssuesAlert />- <ProjectsGrid />- </Stack>- </Scrollable>+ <PageShell+ actions={+ <>+ <Button size="xs" variant="outline" onClick={handleImportClick}>+ <FileUpIcon />+ {t('projects.importWithEllipsis')}+ </Button>+ <Button asChild size="xs" variant="solid">+ <Link search={NEW_PROJECT_SEARCH} to="/app">+ <PlusIcon />+ {t('projects.newProject')}+ </Link>+ </Button>+ </>+ }+ banner={+ <Stack gap="4">+ <KnownBrowserIssuesAlert />+ <ProjectsToolbar+ searchTerm={searchTerm}+ sort={sort}+ view={view}+ onSearchTermChange={setSearchTerm}+ onSortChange={handleSortChange}+ onViewChange={handleViewChange}+ />+ </Stack>+ }+ description={t('projects.libraryDescription')}+ scroll="content"+ title={t('launchpad.sections.projects')}+ >+ <ProjectsBrowser+ now={now}+ pinnedIds={pinnedIds}+ searchTerm={searchTerm}+ sort={sort}+ view={view}+ onClearSearch={handleClearSearch}+ onTogglePin={toggleProjectPinPreference}+ />+ </PageShell>);};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/projects/NewProjectCard.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/projects/NewProjectCard.tsxnew file mode 100644index 0000000000..db45473f88--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/projects/NewProjectCard.tsx@@ -0,0 +1,39 @@+import { Flex, Icon, Text } from '@chakra-ui/react';+import { Link } from '@tanstack/react-router';+import { PlusIcon } from 'lucide-react';+import { useTranslation } from 'react-i18next';++/** The library's leading cell: start a fresh draft in the editor. */++const NEW_PROJECT_SEARCH = { new: true } as const;+const LINK_STYLE = { inset: 0, position: 'absolute' } as const;+const CARD_HOVER = { bg: 'bg.subtle', borderColor: 'border.emphasized' } as const;+const CARD_TRANSITION =+ 'border-color var(--wb-motion-duration-medium) ease, background var(--wb-motion-duration-medium) ease';++export const NewProjectCard = () => {+ const { t } = useTranslation();++ return (+ <Flex+ align="center"+ borderColor="border.subtle"+ borderStyle="dashed"+ borderWidth="1.5px"+ direction="column"+ gap="2"+ justify="center"+ minH="28"+ position="relative"+ rounded="lg"+ transition={CARD_TRANSITION}+ _hover={CARD_HOVER}+ >+ <Link aria-label={t('projects.createNewProject')} search={NEW_PROJECT_SEARCH} style={LINK_STYLE} to="/app" />+ <Icon as={PlusIcon} boxSize="5" color="fg.muted" />+ <Text color="fg.muted" fontSize="xs" fontWeight="600">+ {t('projects.newProject')}+ </Text>+ </Flex>+ );+};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectActionsMenu.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectActionsMenu.tsxnew file mode 100644index 0000000000..f0b55a5c9e--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectActionsMenu.tsx@@ -0,0 +1,172 @@+import type { ReactNode } from 'react';++import { Icon, Menu, Portal } from '@chakra-ui/react';+import { ConfirmDialog } from '@platform/ui/ConfirmDialog';+import { MenuContent } from '@platform/ui/Menu';+import { RenameDialog } from '@platform/ui/RenameDialog';+import { Link } from '@tanstack/react-router';+import { useOpenProjectsSelector } from '@workbench/projects/openProjects';+import { ArrowRightIcon, CopyIcon, FileDownIcon, PencilIcon, PinIcon, PinOffIcon, Trash2Icon } from 'lucide-react';+import { useCallback, useMemo, useState } from 'react';+import { useTranslation } from 'react-i18next';++import type { ProjectCardActions } from './useProjectCardActions';++/**+ * The per-project action menu, plus the rename and delete dialogs it opens.+ * The grid card and the list row both mount this, so right-click and the+ * overflow button offer the same things in the same order everywhere.+ */++const MENU_ITEM_DELETE_HOVER = { bg: 'bg.error', color: 'fg.error' } as const;++export interface ProjectActionsMenuProps {+ actions: ProjectCardActions;+ isPinned: boolean;+ /** Anchor point for a right-click; `null` anchors to the trigger instead. */+ contextMenuTarget: { x: number; y: number } | null;+ isOpen: boolean;+ projectId: string;+ projectName: string;+ children: ReactNode;+ onOpenChange: (details: { open: boolean }) => void;+ onTogglePin: () => void;+}++const MENU_POSITION_BOTTOM_END = { placement: 'bottom-end' } as const;++export const ProjectActionsMenu = ({+ actions,+ children,+ contextMenuTarget,+ isOpen,+ isPinned,+ onOpenChange,+ onTogglePin,+ projectId,+ projectName,+}: ProjectActionsMenuProps) => {+ const { t } = useTranslation();+ const [isRenameOpen, setIsRenameOpen] = useState(false);+ const [isDeleteOpen, setIsDeleteOpen] = useState(false);+ /**+ * Deleting a project another tab still has open with unsaved edits does not+ * stick: that tab's next autosave sees a 404 and deliberately recreates the+ * project rather than discard the work. That policy is right, but silently+ * losing a delete is not — so say so before confirming.+ */+ const isProjectOpen = useOpenProjectsSelector((snapshot) => snapshot.ids?.includes(projectId) ?? false);++ const projectSearch = useMemo(() => ({ project: projectId }), [projectId]);+ const positioning = useMemo(+ () =>+ contextMenuTarget+ ? {+ getAnchorRect: () => ({ height: 1, width: 1, x: contextMenuTarget.x, y: contextMenuTarget.y }),+ placement: 'bottom-start' as const,+ }+ : MENU_POSITION_BOTTOM_END,+ [contextMenuTarget]+ );++ const openRenameDialog = useCallback(() => setIsRenameOpen(true), []);+ const closeRenameDialog = useCallback(() => setIsRenameOpen(false), []);+ const openDeleteDialog = useCallback(() => setIsDeleteOpen(true), []);+ const closeDeleteDialog = useCallback(() => setIsDeleteOpen(false), []);+ const handleDuplicate = useCallback(() => void actions.duplicate(), [actions]);+ const handleExport = useCallback(() => void actions.export(), [actions]);++ return (+ <>+ <Menu.Root open={isOpen} positioning={positioning} onOpenChange={onOpenChange}>+ {children}+ <Portal>+ <Menu.Positioner>+ <MenuBody+ isPinned={isPinned}+ projectSearch={projectSearch}+ onDelete={openDeleteDialog}+ onDuplicate={handleDuplicate}+ onExport={handleExport}+ onRename={openRenameDialog}+ onTogglePin={onTogglePin}+ />+ </Menu.Positioner>+ </Portal>+ </Menu.Root>++ <RenameDialog+ initialName={projectName}+ isOpen={isRenameOpen}+ onClose={closeRenameDialog}+ onSubmit={actions.rename}+ />++ <ConfirmDialog+ body={+ isProjectOpen+ ? `${t('projects.deleteProjectCardBody', { name: projectName })} ${t('projects.deleteProjectOpenWarning')}`+ : t('projects.deleteProjectCardBody', { name: projectName })+ }+ confirmLabel={t('projects.deleteProject')}+ isOpen={isDeleteOpen}+ title={t('projects.deleteProjectQuestion')}+ onClose={closeDeleteDialog}+ onConfirm={actions.delete}+ />+ </>+ );+};++const MenuBody = ({+ isPinned,+ onDelete,+ onDuplicate,+ onExport,+ onRename,+ onTogglePin,+ projectSearch,+}: {+ isPinned: boolean;+ projectSearch: { project: string };+ onDelete: () => void;+ onDuplicate: () => void;+ onExport: () => void;+ onRename: () => void;+ onTogglePin: () => void;+}) => {+ const { t } = useTranslation();++ return (+ <MenuContent minW="44">+ <Menu.Item asChild value="open">+ <Link search={projectSearch} to="/app">+ <Icon as={ArrowRightIcon} boxSize="3.5" />+ {t('common.open')}+ </Link>+ </Menu.Item>+ <Menu.Item value="pin" onClick={onTogglePin}>+ <Icon as={isPinned ? PinOffIcon : PinIcon} boxSize="3.5" />+ {isPinned ? t('projects.unpin') : t('projects.pin')}+ </Menu.Item>+ <Menu.Separator />+ <Menu.Item value="rename" onClick={onRename}>+ <Icon as={PencilIcon} boxSize="3.5" />+ {t('projects.renameWithEllipsis')}+ </Menu.Item>+ <Menu.Item value="duplicate" onClick={onDuplicate}>+ <Icon as={CopyIcon} boxSize="3.5" />+ {t('common.duplicate')}+ </Menu.Item>+ <Menu.Item value="export" onClick={onExport}>+ <Icon as={FileDownIcon} boxSize="3.5" />+ {t('common.export')}+ </Menu.Item>+ <Menu.Separator />+ <Menu.Item color="fg.error" value="delete" _hover={MENU_ITEM_DELETE_HOVER} onClick={onDelete}>+ <Icon as={Trash2Icon} boxSize="3.5" />+ {t('common.delete')}…+ </Menu.Item>+ </MenuContent>+ );+};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectCard.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectCard.tsxnew file mode 100644index 0000000000..da067cdd0e--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectCard.tsx@@ -0,0 +1,134 @@+import type { ProjectSummary } from '@workbench/projects/library';+import type { MouseEvent } from 'react';++import { Box, Flex, Icon, Menu, Stack, Text } from '@chakra-ui/react';+import { IconButton } from '@platform/ui/Button';+import { Link } from '@tanstack/react-router';+import { formatRelativeTime } from '@workbench/launchpad/formatRelativeTime';+import { EllipsisVerticalIcon, PinIcon } from 'lucide-react';+import { useCallback, useMemo, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { ProjectActionsMenu } from './ProjectActionsMenu';+import { ProjectCover } from './ProjectCover';+import { useProjectCardActions } from './useProjectCardActions';++/**+ * One saved project in the library grid. The whole card is a deep link into+ * the editor (`/app?project=…` — hovering preloads the editor chunk); the+ * corner menu and right-click carry the library actions.+ */++const CARD_HOVER = { bg: 'bg.muted', borderColor: 'border.emphasized' } as const;+const REVEAL_ON_HOVER = { opacity: 1 } as const;+const LINK_STYLE = { inset: 0, position: 'absolute' } as const;+const CARD_TRANSITION =+ 'border-color var(--wb-motion-duration-medium) ease, background var(--wb-motion-duration-medium) ease';++export const ProjectCard = ({+ isPinned,+ summary,+ onTogglePin,+}: {+ isPinned: boolean;+ summary: ProjectSummary;+ onTogglePin: (projectId: string) => void;+}) => {+ const { t } = useTranslation();+ const actions = useProjectCardActions(summary);+ const [isActionsOpen, setIsActionsOpen] = useState(false);+ const [contextMenuTarget, setContextMenuTarget] = useState<{ x: number; y: number } | null>(null);++ const projectSearch = useMemo(() => ({ project: summary.id }), [summary.id]);+ const handleContextMenu = useCallback((event: MouseEvent<HTMLDivElement>) => {+ event.preventDefault();+ setContextMenuTarget({ x: event.clientX, y: event.clientY });+ setIsActionsOpen(true);+ }, []);+ const handleOpenChange = useCallback((event: { open: boolean }) => {+ setIsActionsOpen(event.open);++ if (!event.open) {+ setContextMenuTarget(null);+ }+ }, []);+ const clearContextMenuTarget = useCallback(() => setContextMenuTarget(null), []);+ const handleTogglePin = useCallback(() => onTogglePin(summary.id), [onTogglePin, summary.id]);++ return (+ <Box+ bg="bg.subtle"+ borderColor="border.subtle"+ borderWidth="1px"+ className="group"+ overflow="hidden"+ position="relative"+ rounded="lg"+ transition={CARD_TRANSITION}+ _hover={CARD_HOVER}+ onContextMenu={handleContextMenu}+ >+ <Link+ aria-label={t('projects.openProjectLabel', { name: summary.name })}+ search={projectSearch}+ style={LINK_STYLE}+ to="/app"+ />+ <Box pointerEvents="none">+ <ProjectCover coverUrl={summary.coverUrl} />+ </Box>+ <Flex align="center" gap="2" p="3" pointerEvents="none">+ <Stack flex="1" gap="0" minW="0">+ <Text fontSize="xs" fontWeight="600" truncate>+ {summary.name}+ </Text>+ <Text color="fg.muted" fontSize="2xs">+ {t('projects.editedRelative', { time: formatRelativeTime(summary.updatedAt) })}+ </Text>+ </Stack>+ </Flex>++ <Box left="2" pointerEvents="auto" position="absolute" top="2" zIndex="1">+ <IconButton+ aria-label={isPinned ? t('projects.unpin') : t('projects.pin')}+ aria-pressed={isPinned}+ color={isPinned ? 'fg' : 'fg.muted'}+ opacity={isPinned ? 1 : 0}+ size="2xs"+ title={isPinned ? t('projects.unpin') : t('projects.pin')}+ variant="subtle"+ _focusVisible={REVEAL_ON_HOVER}+ _groupHover={REVEAL_ON_HOVER}+ onClick={handleTogglePin}+ >+ <Icon as={PinIcon} boxSize="3" fill={isPinned ? 'currentColor' : 'none'} />+ </IconButton>+ </Box>++ <Box bottom="2" pointerEvents="auto" position="absolute" right="2" zIndex="1">+ <ProjectActionsMenu+ actions={actions}+ contextMenuTarget={contextMenuTarget}+ isOpen={isActionsOpen}+ isPinned={isPinned}+ projectId={summary.id}+ projectName={summary.name}+ onOpenChange={handleOpenChange}+ onTogglePin={handleTogglePin}+ >+ <Menu.Trigger asChild>+ <IconButton+ aria-label={t('common.actions')}+ color="fg.muted"+ size="2xs"+ variant="ghost"+ onClick={clearContextMenuTarget}+ >+ <EllipsisVerticalIcon />+ </IconButton>+ </Menu.Trigger>+ </ProjectActionsMenu>+ </Box>+ </Box>+ );+};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectCover.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectCover.browser.test.tsxnew file mode 100644index 0000000000..14b58f962c--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectCover.browser.test.tsx@@ -0,0 +1,101 @@+import { ChakraProvider } from '@chakra-ui/react';+import { system } from '@theme/system';+import { act } from 'react';+import { createRoot, type Root } from 'react-dom/client';+import { afterEach, describe, expect, it } from 'vitest';++import { ProjectCover } from './ProjectCover';++/**+ * Nothing populates `coverUrl` until the `.invk` project-file work lands, so+ * these assertions are what keep the with-image branch from rotting in the+ * meantime — and what prove the box is reserved either way, which is the whole+ * reason the component exists now rather than later.+ */++// A 1x1 transparent GIF, so the success path needs no network.+const PIXEL = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';+const BROKEN = 'data:image/gif;base64,not-an-image';++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(() => root?.unmount());+ host?.remove();+ host = null;+ root = null;+});++const render = async (coverUrl?: string) => {+ host = document.createElement('div');+ host.style.width = '320px';+ document.body.append(host);+ root = createRoot(host);++ await act(() => {+ root?.render(+ <ChakraProvider value={system}>+ <ProjectCover coverUrl={coverUrl} />+ </ChakraProvider>+ );+ });++ return host;+};++const waitFor = async (predicate: () => boolean) => {+ for (let attempt = 0; attempt < 50; attempt += 1) {+ if (predicate()) {+ return;+ }++ await act(async () => {+ await new Promise((resolve) => {+ setTimeout(resolve, 20);+ });+ });+ }++ throw new Error('condition never became true');+};++describe('ProjectCover', () => {+ it('shows the folder glyph and no image when there is no cover', async () => {+ const container = await render();++ expect(container.querySelector('img')).toBeNull();+ expect(container.querySelector('svg')).not.toBeNull();+ });++ it('renders the cover as a decorative image when one is supplied', async () => {+ const container = await render(PIXEL);+ const image = container.querySelector('img');++ expect(image).not.toBeNull();+ // The name is always rendered beside the cover, so announcing it twice+ // would only add noise.+ expect(image?.getAttribute('alt')).toBe('');+ expect(image?.getAttribute('src')).toBe(PIXEL);+ });++ it('falls back to the glyph when the cover image fails to load', async () => {+ const container = await render(BROKEN);++ await waitFor(() => container.querySelector('img') === null);+ expect(container.querySelector('svg')).not.toBeNull();+ });++ it('reserves the same box whether or not a cover is present', async () => {+ const withoutCover = (await render()).firstElementChild?.getBoundingClientRect();++ await act(() => root?.unmount());+ host?.remove();++ const withCover = (await render(PIXEL)).firstElementChild?.getBoundingClientRect();++ expect(withoutCover?.height).toBeGreaterThan(0);+ expect(withCover?.height).toBe(withoutCover?.height);+ });+});diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectCover.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectCover.tsxnew file mode 100644index 0000000000..59c4d7cf8c--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectCover.tsx@@ -0,0 +1,40 @@+import { Box, Flex, Icon, Image } from '@chakra-ui/react';+import { FolderIcon } from 'lucide-react';+import { useCallback, useState } from 'react';++/**+ * A project's thumbnail.+ *+ * Nothing sets `coverUrl` yet — covers arrive with the `.invk` project-file+ * work, where a cover is just another entry in the archive. This exists now so+ * that landing them is a data change rather than a layout change: the box is+ * reserved unconditionally, so cards do not reflow when images appear.+ *+ * The glyph is not a placeholder awaiting an image. It is the permanent state+ * for a project that has produced nothing, and for a cover whose image has+ * since been deleted — a broken `<img>` reads worse than the glyph, so a load+ * failure falls back to it.+ *+ * The image is decorative (`alt=""`): every caller renders the project's name+ * beside it, and announcing it twice helps nobody.+ */++export const PROJECT_COVER_ASPECT_RATIO = 16 / 10;++export const ProjectCover = ({ coverUrl }: { coverUrl?: string }) => {+ const [hasFailed, setHasFailed] = useState(false);+ const handleError = useCallback(() => setHasFailed(true), []);+ const showImage = Boolean(coverUrl) && !hasFailed;++ return (+ <Box aspectRatio={PROJECT_COVER_ASPECT_RATIO} bg="bg.muted" overflow="hidden" position="relative" w="full">+ {showImage ? (+ <Image alt="" h="full" objectFit="cover" src={coverUrl} w="full" onError={handleError} />+ ) : (+ <Flex align="center" h="full" justify="center" w="full">+ <Icon aria-hidden as={FolderIcon} boxSize="7" color="fg.subtle" opacity={0.6} />+ </Flex>+ )}+ </Box>+ );+};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectRow.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectRow.tsxnew file mode 100644index 0000000000..91a6bc61da--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectRow.tsx@@ -0,0 +1,116 @@+import type { ProjectSummary } from '@workbench/projects/library';+import type { MouseEvent } from 'react';++import { Box, Flex, Icon, Menu, Text } from '@chakra-ui/react';+import { IconButton } from '@platform/ui/Button';+import { Row } from '@platform/ui/Row';+import { Link } from '@tanstack/react-router';+import { formatRelativeTime } from '@workbench/launchpad/formatRelativeTime';+import { EllipsisVerticalIcon, PinIcon } from 'lucide-react';+import { useCallback, useMemo, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { ProjectActionsMenu } from './ProjectActionsMenu';+import { ProjectCover } from './ProjectCover';+import { useProjectCardActions } from './useProjectCardActions';++/**+ * One saved project in the list view — the density a large library wants.+ * Carries the same link target and the same action menu as the grid card;+ * only the shape differs.+ */++const LINK_STYLE = { inset: 0, position: 'absolute' } as const;+const REVEAL_ON_HOVER = { opacity: 1 } as const;+const THUMBNAIL_WIDTH = '14';++export const ProjectRow = ({+ isPinned,+ summary,+ onTogglePin,+}: {+ isPinned: boolean;+ summary: ProjectSummary;+ onTogglePin: (projectId: string) => void;+}) => {+ const { t } = useTranslation();+ const actions = useProjectCardActions(summary);+ const [isActionsOpen, setIsActionsOpen] = useState(false);+ const [contextMenuTarget, setContextMenuTarget] = useState<{ x: number; y: number } | null>(null);++ const projectSearch = useMemo(() => ({ project: summary.id }), [summary.id]);+ const handleContextMenu = useCallback((event: MouseEvent<HTMLDivElement>) => {+ event.preventDefault();+ setContextMenuTarget({ x: event.clientX, y: event.clientY });+ setIsActionsOpen(true);+ }, []);+ const handleOpenChange = useCallback((event: { open: boolean }) => {+ setIsActionsOpen(event.open);++ if (!event.open) {+ setContextMenuTarget(null);+ }+ }, []);+ const clearContextMenuTarget = useCallback(() => setContextMenuTarget(null), []);+ const handleTogglePin = useCallback(() => onTogglePin(summary.id), [onTogglePin, summary.id]);++ return (+ <Row className="group" gap="3" position="relative" rounded="md" onContextMenu={handleContextMenu}>+ <Link+ aria-label={t('projects.openProjectLabel', { name: summary.name })}+ search={projectSearch}+ style={LINK_STYLE}+ to="/app"+ />+ <Box flexShrink={0} overflow="hidden" pointerEvents="none" rounded="sm" w={THUMBNAIL_WIDTH}>+ <ProjectCover coverUrl={summary.coverUrl} />+ </Box>+ <Flex flex="1" gap="3" minW="0" pointerEvents="none">+ <Text flex="1" fontSize="xs" fontWeight="600" minW="0" truncate>+ {summary.name}+ </Text>+ <Text color="fg.muted" flexShrink={0} fontSize="2xs">+ {t('projects.editedRelative', { time: formatRelativeTime(summary.updatedAt) })}+ </Text>+ </Flex>+ <Flex flexShrink={0} gap="0.5" pointerEvents="auto" zIndex="1">+ <IconButton+ aria-label={isPinned ? t('projects.unpin') : t('projects.pin')}+ aria-pressed={isPinned}+ color={isPinned ? 'fg' : 'fg.muted'}+ opacity={isPinned ? 1 : 0}+ size="2xs"+ title={isPinned ? t('projects.unpin') : t('projects.pin')}+ variant="ghost"+ _focusVisible={REVEAL_ON_HOVER}+ _groupHover={REVEAL_ON_HOVER}+ onClick={handleTogglePin}+ >+ <Icon as={PinIcon} boxSize="3" fill={isPinned ? 'currentColor' : 'none'} />+ </IconButton>+ <ProjectActionsMenu+ actions={actions}+ contextMenuTarget={contextMenuTarget}+ isOpen={isActionsOpen}+ isPinned={isPinned}+ projectId={summary.id}+ projectName={summary.name}+ onOpenChange={handleOpenChange}+ onTogglePin={handleTogglePin}+ >+ <Menu.Trigger asChild>+ <IconButton+ aria-label={t('common.actions')}+ color="fg.muted"+ size="2xs"+ variant="ghost"+ onClick={clearContextMenuTarget}+ >+ <EllipsisVerticalIcon />+ </IconButton>+ </Menu.Trigger>+ </ProjectActionsMenu>+ </Flex>+ </Row>+ );+};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectsBrowser.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectsBrowser.tsxnew file mode 100644index 0000000000..ef5c7b2e5d--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectsBrowser.tsx@@ -0,0 +1,311 @@+import type { SystemStyleObject } from '@chakra-ui/react';++import { Alert, Box, Flex, Icon, SimpleGrid, Skeleton, Stack, Text } from '@chakra-ui/react';+import { Button } from '@platform/ui/Button';+import { EmptyState } from '@platform/ui/EmptyState';+import { Scrollable } from '@platform/ui/Scrollable';+import { refreshProjectLibrary, useProjectLibrarySelector } from '@workbench/projects/library';+import { useOpenProjectsSelector } from '@workbench/projects/openProjects';+import { FolderIcon, SearchXIcon } from 'lucide-react';+import { useCallback, useEffectEvent, useLayoutEffect, useMemo, useRef } from 'react';+import { useVirtualizer } from 'react-hook-tanstack-virtual';+import { useTranslation } from 'react-i18next';++import type { ProjectGroupId, ProjectRowModel, ProjectSortId, ProjectsViewId } from './projectLibraryView';++import { NewProjectCard } from './NewProjectCard';+import { ProjectCard } from './ProjectCard';+import { PROJECT_COVER_ASPECT_RATIO } from './ProjectCover';+import { buildProjectGroups, flattenProjectGroupsToRows } from './projectLibraryView';+import { ProjectRow } from './ProjectRow';+import {+ getProjectsGridRowHeight,+ PROJECT_GROUP_HEADER_HEIGHT_PX,+ PROJECT_ROW_HEIGHT_PX,+ PROJECTS_GRID_GAP_PX,+ useProjectsMetrics,+} from './projectsMetrics';++/**+ * The library itself: grouped, virtualized, and in whichever layout was chosen+ * last.+ *+ * Rows are the virtualization unit in both layouts — a grid row holds+ * `columnCount` cards, a list row holds one — so headings and items share a+ * single flat index space and grouping costs nothing extra. Row heights are+ * derived rather than measured, which is what lets the virtualizer place+ * everything without a layout pass.+ */++const MEASURE_SX: SystemStyleObject = {+ maxW: '6xl',+ mx: 'auto',+ px: { base: 4, md: 8 },+ w: 'full',+};++const GROUP_LABEL_KEY: Record<ProjectGroupId, string> = {+ all: 'projects.groups.all',+ month: 'projects.groups.month',+ older: 'projects.groups.older',+ open: 'projects.groups.open',+ pinned: 'projects.groups.pinned',+ today: 'projects.groups.today',+ week: 'projects.groups.week',+};++const SKELETON_GRID_COLUMNS = { base: 1, lg: 3, sm: 2 } as const;+const NO_MATCHES_ICON = <Icon as={SearchXIcon} />;+const NO_PROJECTS_ICON = <Icon as={FolderIcon} />;++export interface ProjectsBrowserProps {+ /**+ * When "today" starts, captured once by the page rather than read here —+ * reading the clock during render is impure and would rebucket unstably+ * across re-renders.+ */+ now: number;+ pinnedIds: readonly string[];+ searchTerm: string;+ sort: ProjectSortId;+ view: ProjectsViewId;+ onClearSearch: () => void;+ onTogglePin: (projectId: string) => void;+}++export const ProjectsBrowser = ({+ now,+ onClearSearch,+ onTogglePin,+ pinnedIds,+ searchTerm,+ sort,+ view,+}: ProjectsBrowserProps) => {+ const { t } = useTranslation();+ const error = useProjectLibrarySelector((snapshot) => snapshot.error);+ const status = useProjectLibrarySelector((snapshot) => snapshot.status);+ const summaries = useProjectLibrarySelector((snapshot) => snapshot.summaries);+ const openProjectIds = useOpenProjectsSelector((snapshot) => snapshot.ids);++ const scrollRef = useRef<HTMLDivElement | null>(null);+ const { columnCount, measureRef, widthPx } = useProjectsMetrics(view);++ const rows = useMemo(+ () =>+ flattenProjectGroupsToRows(+ buildProjectGroups({+ now,+ openProjectIds: openProjectIds ?? [],+ pinnedIds,+ searchTerm,+ sort,+ summaries,+ }),+ columnCount+ ),+ [columnCount, now, openProjectIds, pinnedIds, searchTerm, sort, summaries]+ );++ const itemRowHeight =+ view === 'grid'+ ? getProjectsGridRowHeight({ aspectRatio: PROJECT_COVER_ASPECT_RATIO, columnCount, widthPx })+ : PROJECT_ROW_HEIGHT_PX;++ const estimateSize = useCallback(+ (index: number) => (rows[index]?.kind === 'header' ? PROJECT_GROUP_HEADER_HEIGHT_PX : itemRowHeight),+ [itemRowHeight, rows]+ );+ const getItemKey = useCallback(+ (index: number) => {+ const row = rows[index];++ if (!row) {+ return index;+ }++ return row.kind === 'header'+ ? `header:${row.group}`+ : `${row.group}:${row.projects.map((project) => project.id).join(',')}`;+ },+ [rows]+ );+ const getScrollElement = useCallback(() => scrollRef.current, []);++ const virtualizer = useVirtualizer({+ count: rows.length,+ estimateSize,+ getItemKey,+ getScrollElement,+ overscan: 4,+ });++ // The virtualizer caches measurements and will not re-read `estimateSize` on+ // its own, so switching layouts or resizing the panel has to invalidate it —+ // otherwise list rows keep the taller grid row's spacing.+ const measureVirtualizer = useEffectEvent(() => {+ virtualizer.measure();+ });++ useLayoutEffect(() => {+ measureVirtualizer();+ }, [itemRowHeight, view]);++ const handleRetry = useCallback(() => void refreshProjectLibrary(), []);+ const isFirstLoad = summaries.length === 0 && (status === 'idle' || status === 'loading');+ const isSearching = searchTerm.trim().length > 0;++ return (+ <Scrollable flex="1" h="full" label={t('launchpad.sections.projects')} minH="0" viewportRef={scrollRef}>+ <Box css={MEASURE_SX} pb="8" ref={measureRef}>+ {status === 'error' ? (+ <Alert.Root borderRadius="md" mb="4" size="sm" status="error">+ <Alert.Indicator />+ <Alert.Title flex="1" fontSize="xs">+ {error ?? t('projects.failedToLoad')}+ </Alert.Title>+ <Button size="2xs" variant="outline" onClick={handleRetry}>+ {t('common.retry')}+ </Button>+ </Alert.Root>+ ) : null}++ {isFirstLoad ? (+ <SimpleGrid columns={SKELETON_GRID_COLUMNS} gap="4">+ <Skeleton minH="52" rounded="lg" />+ <Skeleton minH="52" rounded="lg" />+ <Skeleton minH="52" rounded="lg" />+ </SimpleGrid>+ ) : rows.length === 0 ? (+ <ProjectsEmptyState isSearching={isSearching} searchTerm={searchTerm} onClearSearch={onClearSearch} />+ ) : (+ // No "new project" cell here: the page header already carries that+ // action, and a lone dashed tile in a four-column row reads as a+ // broken grid. The empty state, where it is the only thing to do,+ // still offers it.+ <Box height={`${virtualizer.totalSize}px`} position="relative" w="full">+ {virtualizer.virtualItems.map((virtualRow) => {+ const row = rows[virtualRow.index];++ if (!row) {+ return null;+ }++ return (+ <VirtualProjectsRow+ columnCount={columnCount}+ key={virtualRow.key}+ pinnedIds={pinnedIds}+ row={row}+ view={view}+ virtualStart={virtualRow.start}+ onTogglePin={onTogglePin}+ />+ );+ })}+ </Box>+ )}+ </Box>+ </Scrollable>+ );+};++const ABSOLUTE_ROW_SX: SystemStyleObject = { insetInline: 0, position: 'absolute', top: 0 };++const VirtualProjectsRow = ({+ columnCount,+ onTogglePin,+ pinnedIds,+ row,+ view,+ virtualStart,+}: {+ columnCount: number;+ pinnedIds: readonly string[];+ row: ProjectRowModel;+ view: ProjectsViewId;+ virtualStart: number;+ onTogglePin: (projectId: string) => void;+}) => {+ const { t } = useTranslation();+ const transform = `translateY(${virtualStart}px)`;++ if (row.kind === 'header') {+ return (+ <Flex align="baseline" css={ABSOLUTE_ROW_SX} gap="2" pb="2" pt="3" transform={transform}>+ <Text fontSize="xs" fontWeight="700">+ {t(GROUP_LABEL_KEY[row.group])}+ </Text>+ {/* `fg.subtle` only reaches 4.11:1 at this size — `fg.muted` clears 4.5:1. */}+ <Text color="fg.muted" fontSize="2xs">+ {row.count}+ </Text>+ </Flex>+ );+ }++ return (+ <Box css={ABSOLUTE_ROW_SX} transform={transform}>+ {view === 'grid' ? (+ <SimpleGrid columns={columnCount} gap={`${PROJECTS_GRID_GAP_PX}px`}>+ {row.projects.map((project) => (+ <ProjectCard+ isPinned={pinnedIds.includes(project.id)}+ key={project.id}+ summary={project}+ onTogglePin={onTogglePin}+ />+ ))}+ </SimpleGrid>+ ) : (+ row.projects.map((project) => (+ <ProjectRow+ isPinned={pinnedIds.includes(project.id)}+ key={project.id}+ summary={project}+ onTogglePin={onTogglePin}+ />+ ))+ )}+ </Box>+ );+};++const ProjectsEmptyState = ({+ isSearching,+ onClearSearch,+ searchTerm,+}: {+ isSearching: boolean;+ searchTerm: string;+ onClearSearch: () => void;+}) => {+ const { t } = useTranslation();++ if (isSearching) {+ return (+ <EmptyState+ description={t('projects.noSearchMatchesDescription')}+ icon={NO_MATCHES_ICON}+ title={t('projects.noSearchMatches', { search: searchTerm.trim() })}+ >+ <Button size="xs" variant="outline" onClick={onClearSearch}>+ {t('common.clearSearch')}+ </Button>+ </EmptyState>+ );+ }++ return (+ <Stack gap="4">+ <EmptyState+ description={t('projects.noSavedProjectsDescription')}+ icon={NO_PROJECTS_ICON}+ title={t('projects.noSavedProjects')}+ />+ <Box maxW="xs" mx="auto" w="full">+ <NewProjectCard />+ </Box>+ </Stack>+ );+};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectsToolbar.tsx b/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectsToolbar.tsxnew file mode 100644index 0000000000..7622826bf2--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/projects/ProjectsToolbar.tsx@@ -0,0 +1,135 @@+import { Flex, Icon, Input, InputGroup, Menu, Portal } from '@chakra-ui/react';+import { Button, IconButton } from '@platform/ui/Button';+import { MenuContent } from '@platform/ui/Menu';+import { Tooltip } from '@platform/ui/Tooltip';+import { ArrowUpDownIcon, CheckIcon, LayoutGridIcon, ListIcon, SearchIcon, XIcon } from 'lucide-react';+import { useCallback } from 'react';+import { useTranslation } from 'react-i18next';++/* eslint-disable react-perf/jsx-no-jsx-as-prop */+import type { ProjectSortId, ProjectsViewId } from './projectLibraryView';++import { PROJECT_SORT_IDS } from './projectLibraryView';++/** Search, ordering, and layout for the project library. */++const MENU_POSITIONING = { placement: 'bottom-end' } as const;+const SEARCH_ICON = <Icon as={SearchIcon} boxSize="3.5" color="fg.subtle" />;++const SORT_LABEL_KEY: Record<ProjectSortId, string> = {+ created: 'projects.sort.created',+ edited: 'projects.sort.edited',+ name: 'projects.sort.name',+};++export const ProjectsToolbar = ({+ searchTerm,+ sort,+ view,+ onSearchTermChange,+ onSortChange,+ onViewChange,+}: {+ searchTerm: string;+ sort: ProjectSortId;+ view: ProjectsViewId;+ onSearchTermChange: (value: string) => void;+ onSortChange: (sort: ProjectSortId) => void;+ onViewChange: (view: ProjectsViewId) => void;+}) => {+ const { t } = useTranslation();++ const handleSearchInput = useCallback(+ (event: React.ChangeEvent<HTMLInputElement>) => onSearchTermChange(event.target.value),+ [onSearchTermChange]+ );+ const handleClearSearch = useCallback(() => onSearchTermChange(''), [onSearchTermChange]);+ const handleSortSelect = useCallback(+ (details: { value: string }) => {+ if (PROJECT_SORT_IDS.includes(details.value as ProjectSortId)) {+ onSortChange(details.value as ProjectSortId);+ }+ },+ [onSortChange]+ );+ const handleGridView = useCallback(() => onViewChange('grid'), [onViewChange]);+ const handleListView = useCallback(() => onViewChange('list'), [onViewChange]);++ return (+ <Flex align="center" gap="2" wrap="wrap">+ <InputGroup+ endElement={+ searchTerm ? (+ <IconButton aria-label={t('common.clearSearch')} size="2xs" variant="ghost" onClick={handleClearSearch}>+ <Icon as={XIcon} boxSize="3" />+ </IconButton>+ ) : undefined+ }+ flex="1"+ maxW="xs"+ minW="3xs"+ startElement={SEARCH_ICON}+ >+ <Input+ aria-label={t('projects.searchLabel')}+ placeholder={t('projects.searchPlaceholder')}+ size="xs"+ type="search"+ value={searchTerm}+ onChange={handleSearchInput}+ />+ </InputGroup>++ <Menu.Root positioning={MENU_POSITIONING} onSelect={handleSortSelect}>+ <Menu.Trigger asChild>+ <Button size="xs" variant="outline">+ <Icon as={ArrowUpDownIcon} boxSize="3.5" />+ {t(SORT_LABEL_KEY[sort])}+ </Button>+ </Menu.Trigger>+ <Portal>+ <Menu.Positioner>+ <MenuContent minW="44">+ <Menu.ItemGroup>+ <Menu.ItemGroupLabel color="fg.subtle" fontSize="2xs" textTransform="uppercase">+ {t('projects.sort.label')}+ </Menu.ItemGroupLabel>+ {PROJECT_SORT_IDS.map((id) => (+ <Menu.Item key={id} value={id}>+ <Icon as={CheckIcon} boxSize="3.5" opacity={id === sort ? 1 : 0} />+ <Menu.ItemText>{t(SORT_LABEL_KEY[id])}</Menu.ItemText>+ </Menu.Item>+ ))}+ </Menu.ItemGroup>+ </MenuContent>+ </Menu.Positioner>+ </Portal>+ </Menu.Root>++ <Flex gap="0.5">+ <Tooltip content={t('projects.gridView')}>+ <IconButton+ aria-label={t('projects.gridView')}+ aria-pressed={view === 'grid'}+ size="xs"+ variant={view === 'grid' ? 'subtle' : 'ghost'}+ onClick={handleGridView}+ >+ <Icon as={LayoutGridIcon} boxSize="3.5" />+ </IconButton>+ </Tooltip>+ <Tooltip content={t('projects.listView')}>+ <IconButton+ aria-label={t('projects.listView')}+ aria-pressed={view === 'list'}+ size="xs"+ variant={view === 'list' ? 'subtle' : 'ghost'}+ onClick={handleListView}+ >+ <Icon as={ListIcon} boxSize="3.5" />+ </IconButton>+ </Tooltip>+ </Flex>+ </Flex>+ );+};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/projects/projectLibraryView.test.ts b/invokeai/frontend/webv2/src/workbench/launchpad/projects/projectLibraryView.test.tsnew file mode 100644index 0000000000..6218eb0af7--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/projects/projectLibraryView.test.ts@@ -0,0 +1,234 @@+import type { ProjectSummary } from '@workbench/projects/library';++import {+ buildProjectGroups,+ flattenProjectGroupsToRows,+ isProjectSortId,+ isProjectsViewId,+ matchesProjectSearch,+ prunePinnedProjectIds,+ toggleProjectPin,+ type ProjectLibraryViewInput,+} from '@workbench/launchpad/projects/projectLibraryView';+import { describe, expect, it } from 'vitest';++const NOW = Date.parse('2026-08-04T15:00:00.000Z');++const at = (isoOffsetDays: number, hour = 12): string =>+ new Date(+ new Date(NOW).setHours(0, 0, 0, 0) - isoOffsetDays * 24 * 60 * 60 * 1000 + hour * 60 * 60 * 1000+ ).toISOString();++const summary = (overrides: Partial<ProjectSummary> & { id: string }): ProjectSummary => ({+ createdAt: at(0),+ name: overrides.id,+ revision: 1,+ updatedAt: at(0),+ ...overrides,+});++const view = (overrides: Partial<ProjectLibraryViewInput> = {}): ProjectLibraryViewInput => ({+ now: NOW,+ openProjectIds: [],+ pinnedIds: [],+ searchTerm: '',+ sort: 'edited',+ summaries: [],+ ...overrides,+});++describe('matchesProjectSearch', () => {+ it('matches case-insensitively on a substring and ignores surrounding whitespace', () => {+ const project = summary({ id: 'a', name: 'Sunset Cabin' });++ expect(matchesProjectSearch(project, 'cabin')).toBe(true);+ expect(matchesProjectSearch(project, ' SUNSET ')).toBe(true);+ expect(matchesProjectSearch(project, 'lighthouse')).toBe(false);+ });++ it('treats an empty search as matching everything', () => {+ expect(matchesProjectSearch(summary({ id: 'a' }), ' ')).toBe(true);+ });+});++describe('buildProjectGroups', () => {+ it('buckets by calendar recency rather than a rolling 24 hours', () => {+ const groups = buildProjectGroups(+ view({+ summaries: [+ summary({ id: 'today', updatedAt: at(0, 1) }),+ summary({ id: 'week', updatedAt: at(3) }),+ summary({ id: 'month', updatedAt: at(20) }),+ summary({ id: 'older', updatedAt: at(400) }),+ ],+ })+ );++ expect(groups.map((group) => group.id)).toEqual(['today', 'week', 'month', 'older']);+ });++ it('puts pinned projects first and takes them out of their date bucket', () => {+ const groups = buildProjectGroups(+ view({+ pinnedIds: ['b'],+ summaries: [summary({ id: 'a', updatedAt: at(0) }), summary({ id: 'b', updatedAt: at(0) })],+ })+ );++ expect(groups.map((group) => group.id)).toEqual(['pinned', 'today']);+ expect(groups[0]?.projects.map((project) => project.id)).toEqual(['b']);+ expect(groups[1]?.projects.map((project) => project.id)).toEqual(['a']);+ });++ it('lists a project that is both pinned and open only under pinned', () => {+ const groups = buildProjectGroups(+ view({ openProjectIds: ['a'], pinnedIds: ['a'], summaries: [summary({ id: 'a' })] })+ );++ expect(groups).toHaveLength(1);+ expect(groups[0]?.id).toBe('pinned');+ });++ it('separates open projects from the date buckets', () => {+ const groups = buildProjectGroups(+ view({+ openProjectIds: ['open'],+ summaries: [summary({ id: 'open', updatedAt: at(20) }), summary({ id: 'other', updatedAt: at(20) })],+ })+ );++ expect(groups.map((group) => group.id)).toEqual(['open', 'month']);+ });++ it('collapses date buckets into one group while searching', () => {+ const groups = buildProjectGroups(+ view({+ searchTerm: 'cabin',+ summaries: [+ summary({ id: 'a', name: 'Cabin today', updatedAt: at(0) }),+ summary({ id: 'b', name: 'Cabin last year', updatedAt: at(400) }),+ summary({ id: 'c', name: 'Lighthouse', updatedAt: at(0) }),+ ],+ })+ );++ expect(groups.map((group) => group.id)).toEqual(['all']);+ expect(groups[0]?.projects.map((project) => project.id)).toEqual(['a', 'b']);+ });++ it('collapses date buckets when sorting by name, and orders naturally', () => {+ const groups = buildProjectGroups(+ view({+ sort: 'name',+ summaries: [+ summary({ id: 'c', name: 'Project 10' }),+ summary({ id: 'a', name: 'project 2' }),+ summary({ id: 'b', name: 'Project 1' }),+ ],+ })+ );++ expect(groups.map((group) => group.id)).toEqual(['all']);+ expect(groups[0]?.projects.map((project) => project.name)).toEqual(['Project 1', 'project 2', 'Project 10']);+ });++ it('buckets and orders on createdAt when sorting by created', () => {+ const groups = buildProjectGroups(+ view({+ sort: 'created',+ summaries: [+ summary({ createdAt: at(400), id: 'old-but-edited-today', updatedAt: at(0) }),+ summary({ createdAt: at(0), id: 'new', updatedAt: at(400) }),+ ],+ })+ );++ expect(groups.map((group) => group.id)).toEqual(['today', 'older']);+ expect(groups[0]?.projects.map((project) => project.id)).toEqual(['new']);+ });++ it('drops empty groups instead of emitting bare headings', () => {+ const groups = buildProjectGroups(view({ summaries: [summary({ id: 'a', updatedAt: at(400) })] }));++ expect(groups.map((group) => group.id)).toEqual(['older']);+ });++ it('returns nothing when the search matches nothing', () => {+ expect(buildProjectGroups(view({ searchTerm: 'zzz', summaries: [summary({ id: 'a', name: 'Cabin' })] }))).toEqual(+ []+ );+ });+});++describe('flattenProjectGroupsToRows', () => {+ it('chunks each group into rows of the given column count, under a heading', () => {+ const groups = buildProjectGroups(+ view({+ pinnedIds: ['a'],+ summaries: [+ summary({ id: 'a' }),+ summary({ id: 'b' }),+ summary({ id: 'c' }),+ summary({ id: 'd' }),+ summary({ id: 'e' }),+ ],+ })+ );++ expect(flattenProjectGroupsToRows(groups, 2)).toEqual([+ { count: 1, group: 'pinned', kind: 'header' },+ { group: 'pinned', kind: 'projects', projects: [expect.objectContaining({ id: 'a' })] },+ { count: 4, group: 'today', kind: 'header' },+ {+ group: 'today',+ kind: 'projects',+ projects: [expect.objectContaining({ id: 'b' }), expect.objectContaining({ id: 'c' })],+ },+ {+ group: 'today',+ kind: 'projects',+ projects: [expect.objectContaining({ id: 'd' }), expect.objectContaining({ id: 'e' })],+ },+ ]);+ });++ it('omits the heading for a lone unnamed group', () => {+ const groups = buildProjectGroups(view({ searchTerm: 'a', summaries: [summary({ id: 'a', name: 'Cabin' })] }));++ expect(flattenProjectGroupsToRows(groups, 3)).toEqual([+ { group: 'all', kind: 'projects', projects: [expect.objectContaining({ id: 'a' })] },+ ]);+ });++ it('treats a nonsensical column count as one column rather than looping forever', () => {+ const groups = buildProjectGroups(view({ summaries: [summary({ id: 'a' }), summary({ id: 'b' })] }));++ expect(flattenProjectGroupsToRows(groups, 0).filter((row) => row.kind === 'projects')).toHaveLength(2);+ });+});++describe('toggleProjectPin', () => {+ it('appends a new pin and removes an existing one', () => {+ expect(toggleProjectPin(['a'], 'b')).toEqual(['a', 'b']);+ expect(toggleProjectPin(['a', 'b'], 'a')).toEqual(['b']);+ });++ it('collapses a duplicated id to a single entry', () => {+ expect(toggleProjectPin(['a', 'a'], 'a')).toEqual([]);+ });+});++describe('prunePinnedProjectIds', () => {+ it('drops pins whose project is gone and keeps the rest in order', () => {+ expect(prunePinnedProjectIds(['a', 'gone', 'b'], [summary({ id: 'b' }), summary({ id: 'a' })])).toEqual(['a', 'b']);+ });+});++describe('identifier guards', () => {+ it('accepts known ids and rejects anything else', () => {+ expect(isProjectSortId('edited')).toBe(true);+ expect(isProjectSortId('sideways')).toBe(false);+ expect(isProjectsViewId('list')).toBe(true);+ expect(isProjectsViewId(null)).toBe(false);+ });+});diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/projects/projectLibraryView.ts b/invokeai/frontend/webv2/src/workbench/launchpad/projects/projectLibraryView.tsnew file mode 100644index 0000000000..c731535ab5--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/projects/projectLibraryView.ts@@ -0,0 +1,188 @@+import type { ProjectSummary } from '@workbench/projects/library';++/**+ * How the project library is presented: what matches the search, what order it+ * is in, and which bucket each project falls into.+ *+ * All of it is pure and takes `now` as an argument rather than reading the+ * clock, so the date bucketing is testable without freezing time.+ */++export type ProjectSortId = 'edited' | 'created' | 'name';++export type ProjectsViewId = 'grid' | 'list';++export const PROJECT_SORT_IDS: readonly ProjectSortId[] = ['edited', 'created', 'name'];++export const PROJECTS_VIEW_IDS: readonly ProjectsViewId[] = ['grid', 'list'];++export const isProjectSortId = (value: unknown): value is ProjectSortId =>+ typeof value === 'string' && PROJECT_SORT_IDS.includes(value as ProjectSortId);++export const isProjectsViewId = (value: unknown): value is ProjectsViewId =>+ typeof value === 'string' && PROJECTS_VIEW_IDS.includes(value as ProjectsViewId);++/**+ * `pinned` and `open` are cross-cutting: a project lands in one of them+ * instead of a date bucket, never in both. The rest are relative to `now`.+ * `all` is the flat bucket used when a search or an alphabetical sort makes+ * date headings meaningless.+ */+export type ProjectGroupId = 'pinned' | 'open' | 'today' | 'week' | 'month' | 'older' | 'all';++export interface ProjectGroup {+ id: ProjectGroupId;+ projects: ProjectSummary[];+}++export interface ProjectLibraryViewInput {+ summaries: readonly ProjectSummary[];+ searchTerm: string;+ sort: ProjectSortId;+ pinnedIds: readonly string[];+ openProjectIds: readonly string[];+ now: number;+}++const DAY_MS = 24 * 60 * 60 * 1000;++const getSortTimestamp = (summary: ProjectSummary, sort: ProjectSortId): number => {+ const value = Date.parse(sort === 'created' ? summary.createdAt : summary.updatedAt);++ return Number.isNaN(value) ? 0 : value;+};++const compareProjects = (a: ProjectSummary, b: ProjectSummary, sort: ProjectSortId): number => {+ if (sort === 'name') {+ return a.name.localeCompare(b.name, undefined, { numeric: true, sensitivity: 'base' });+ }++ return getSortTimestamp(b, sort) - getSortTimestamp(a, sort);+};++/** Local midnight, so "today" means the calendar day rather than 24 hours. */+const startOfLocalDay = (timestamp: number): number => {+ const date = new Date(timestamp);++ date.setHours(0, 0, 0, 0);++ return date.getTime();+};++const getDateGroupId = (summary: ProjectSummary, sort: ProjectSortId, now: number): ProjectGroupId => {+ const timestamp = getSortTimestamp(summary, sort);+ const todayStart = startOfLocalDay(now);++ if (timestamp >= todayStart) {+ return 'today';+ }++ if (timestamp >= todayStart - 6 * DAY_MS) {+ return 'week';+ }++ if (timestamp >= todayStart - 29 * DAY_MS) {+ return 'month';+ }++ return 'older';+};++export const matchesProjectSearch = (summary: ProjectSummary, searchTerm: string): boolean =>+ summary.name.toLowerCase().includes(searchTerm.trim().toLowerCase());++const DATE_GROUP_ORDER: readonly ProjectGroupId[] = ['today', 'week', 'month', 'older'];++/**+ * Group order is fixed: pinned, then what is already open, then recency. A+ * search or an alphabetical sort collapses the date buckets into one `all`+ * group — ranking twelve results under four date headings hides them.+ */+export const buildProjectGroups = ({+ now,+ openProjectIds,+ pinnedIds,+ searchTerm,+ sort,+ summaries,+}: ProjectLibraryViewInput): ProjectGroup[] => {+ const matched = summaries.filter((summary) => matchesProjectSearch(summary, searchTerm));+ const pinned = new Set(pinnedIds);+ const open = new Set(openProjectIds);+ const sorted = [...matched].sort((a, b) => compareProjects(a, b, sort));+ const isSearching = searchTerm.trim().length > 0;+ const buckets = new Map<ProjectGroupId, ProjectSummary[]>();+ const push = (id: ProjectGroupId, summary: ProjectSummary): void => {+ const bucket = buckets.get(id);++ if (bucket) {+ bucket.push(summary);+ } else {+ buckets.set(id, [summary]);+ }+ };++ for (const summary of sorted) {+ if (pinned.has(summary.id)) {+ push('pinned', summary);+ continue;+ }++ if (open.has(summary.id)) {+ push('open', summary);+ continue;+ }++ push(isSearching || sort === 'name' ? 'all' : getDateGroupId(summary, sort, now), summary);+ }++ const order: readonly ProjectGroupId[] = ['pinned', 'open', 'all', ...DATE_GROUP_ORDER];++ return order.flatMap((id) => {+ const projects = buckets.get(id);++ return projects ? [{ id, projects }] : [];+ });+};++export type ProjectRowModel =+ | { kind: 'header'; group: ProjectGroupId; count: number }+ | { kind: 'projects'; group: ProjectGroupId; projects: ProjectSummary[] };++/**+ * Flatten groups into virtualizer rows. `columnCount` is how many cards share+ * a row, so the grid virtualizes by row and the list is just the same shape+ * with one column.+ *+ * A single unnamed group (the search/alphabetical `all` case) renders without+ * a heading — there is nothing to distinguish it from.+ */+export const flattenProjectGroupsToRows = (groups: readonly ProjectGroup[], columnCount: number): ProjectRowModel[] => {+ const perRow = Math.max(1, columnCount);+ const showHeadings = groups.length > 1 || groups[0]?.id !== 'all';++ return groups.flatMap((group) => {+ const rows: ProjectRowModel[] = showHeadings+ ? [{ count: group.projects.length, group: group.id, kind: 'header' }]+ : [];++ for (let index = 0; index < group.projects.length; index += perRow) {+ rows.push({ group: group.id, kind: 'projects', projects: group.projects.slice(index, index + perRow) });+ }++ return rows;+ });+};++/** Toggle membership while preserving insertion order, so pins stay stable. */+export const toggleProjectPin = (pinnedIds: readonly string[], projectId: string): string[] =>+ pinnedIds.includes(projectId)+ ? pinnedIds.filter((id) => id !== projectId)+ : [...pinnedIds.filter((id) => id !== projectId), projectId];++/** Drop pins for projects that no longer exist, so the list cannot grow forever. */+export const prunePinnedProjectIds = (pinnedIds: readonly string[], summaries: readonly ProjectSummary[]): string[] => {+ const existing = new Set(summaries.map((summary) => summary.id));++ return pinnedIds.filter((id) => existing.has(id));+};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/projects/projectPins.test.ts b/invokeai/frontend/webv2/src/workbench/launchpad/projects/projectPins.test.tsnew file mode 100644index 0000000000..f5dd711190--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/projects/projectPins.test.ts@@ -0,0 +1,72 @@+import type { ProjectSummary } from '@workbench/projects/library';++import { beforeEach, describe, expect, it, vi } from 'vitest';++const getWorkbenchPreferences = vi.hoisted(() => vi.fn());+const patchWorkbenchPreferences = vi.hoisted(() => vi.fn(() => Promise.resolve()));++vi.mock('@workbench/settings/store', () => ({ getWorkbenchPreferences, patchWorkbenchPreferences }));++const { dropProjectPin, prunePinnedProjects, toggleProjectPinPreference } =+ await import('@workbench/launchpad/projects/projectPins');++const summary = (id: string): ProjectSummary => ({+ createdAt: '2026-08-01T00:00:00.000Z',+ id,+ name: id,+ revision: 1,+ updatedAt: '2026-08-01T00:00:00.000Z',+});++const withPins = (launchpadPinnedProjectIds: string[]) => {+ getWorkbenchPreferences.mockReturnValue({ launchpadPinnedProjectIds });+};++describe('project pin preferences', () => {+ beforeEach(() => {+ patchWorkbenchPreferences.mockClear();+ getWorkbenchPreferences.mockReset();+ });++ it('toggles against the live snapshot rather than a captured value', () => {+ withPins(['a']);+ toggleProjectPinPreference('b');++ expect(patchWorkbenchPreferences).toHaveBeenCalledWith({ launchpadPinnedProjectIds: ['a', 'b'] });+ });++ it('drops a pin when its project is deleted', () => {+ withPins(['a', 'b']);+ dropProjectPin('a');++ expect(patchWorkbenchPreferences).toHaveBeenCalledWith({ launchpadPinnedProjectIds: ['b'] });+ });++ it('does not write when the deleted project was never pinned', () => {+ withPins(['a']);+ dropProjectPin('zzz');++ expect(patchWorkbenchPreferences).not.toHaveBeenCalled();+ });++ it('prunes pins whose project no longer exists', () => {+ withPins(['a', 'gone', 'b']);+ prunePinnedProjects([summary('a'), summary('b')]);++ expect(patchWorkbenchPreferences).toHaveBeenCalledWith({ launchpadPinnedProjectIds: ['a', 'b'] });+ });++ it('stays silent when every pin still resolves, so a refresh is not a write', () => {+ withPins(['a', 'b']);+ prunePinnedProjects([summary('a'), summary('b')]);++ expect(patchWorkbenchPreferences).not.toHaveBeenCalled();+ });++ it('skips the snapshot comparison entirely when nothing is pinned', () => {+ withPins([]);+ prunePinnedProjects([]);++ expect(patchWorkbenchPreferences).not.toHaveBeenCalled();+ });+});diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/projects/projectPins.ts b/invokeai/frontend/webv2/src/workbench/launchpad/projects/projectPins.tsnew file mode 100644index 0000000000..4867bc9a51--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/projects/projectPins.ts@@ -0,0 +1,54 @@+import type { ProjectSummary } from '@workbench/projects/library';++import { getWorkbenchPreferences, patchWorkbenchPreferences } from '@workbench/settings/store';++import { prunePinnedProjectIds, toggleProjectPin } from './projectLibraryView';++/**+ * Pin writes, in one place.+ *+ * Pins live in account preferences, so they follow the user across devices —+ * which also means a stale id persists forever unless something removes it.+ * Home and the library both pin, and both now go through here rather than+ * each reimplementing the read-modify-write.+ *+ * Every write reads the live snapshot rather than a captured render value, so+ * two quick toggles cannot drop the first one.+ */++export const toggleProjectPinPreference = (projectId: string): void => {+ const current = getWorkbenchPreferences().launchpadPinnedProjectIds;++ void patchWorkbenchPreferences({ launchpadPinnedProjectIds: toggleProjectPin(current, projectId) });+};++export const dropProjectPin = (projectId: string): void => {+ const current = getWorkbenchPreferences().launchpadPinnedProjectIds;++ if (!current.includes(projectId)) {+ return;+ }++ void patchWorkbenchPreferences({+ launchpadPinnedProjectIds: current.filter((id) => id !== projectId),+ });+};++/**+ * Drop pins whose project no longer exists — deleted from another device or+ * another tab. Writes only when something actually changed, so this is safe to+ * call after every library refresh.+ */+export const prunePinnedProjects = (summaries: readonly ProjectSummary[]): void => {+ const current = getWorkbenchPreferences().launchpadPinnedProjectIds;++ if (current.length === 0) {+ return;+ }++ const pruned = prunePinnedProjectIds(current, summaries);++ if (pruned.length !== current.length) {+ void patchWorkbenchPreferences({ launchpadPinnedProjectIds: pruned });+ }+};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/projects/projectsMetrics.test.ts b/invokeai/frontend/webv2/src/workbench/launchpad/projects/projectsMetrics.test.tsnew file mode 100644index 0000000000..83551ae2f2--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/projects/projectsMetrics.test.ts@@ -0,0 +1,51 @@+import {+ getProjectsColumnCount,+ getProjectsGridRowHeight,+ PROJECT_CARD_META_HEIGHT_PX,+ PROJECTS_GRID_GAP_PX,+} from '@workbench/launchpad/projects/projectsMetrics';+import { describe, expect, it } from 'vitest';++const ASPECT_RATIO = 16 / 10;++describe('getProjectsColumnCount', () => {+ it('fits as many 240px cards as the width allows, up to four', () => {+ expect(getProjectsColumnCount(239)).toBe(1);+ expect(getProjectsColumnCount(480)).toBe(2);+ expect(getProjectsColumnCount(760)).toBe(3);+ expect(getProjectsColumnCount(4000)).toBe(4);+ });++ it('never returns zero for an unmeasured or collapsed container', () => {+ expect(getProjectsColumnCount(0)).toBe(1);+ expect(getProjectsColumnCount(-100)).toBe(1);+ });+});++describe('getProjectsGridRowHeight', () => {+ it('sizes a row from the column width, the cover ratio, and the meta block', () => {+ // Three 240px columns with two 16px gaps == 752px.+ const height = getProjectsGridRowHeight({ aspectRatio: ASPECT_RATIO, columnCount: 3, widthPx: 752 });++ expect(height).toBe(Math.round(240 / ASPECT_RATIO + PROJECT_CARD_META_HEIGHT_PX + PROJECTS_GRID_GAP_PX));+ });++ it('grows the row as the container widens', () => {+ const narrow = getProjectsGridRowHeight({ aspectRatio: ASPECT_RATIO, columnCount: 2, widthPx: 600 });+ const wide = getProjectsGridRowHeight({ aspectRatio: ASPECT_RATIO, columnCount: 2, widthPx: 1000 });++ expect(wide).toBeGreaterThan(narrow);+ });++ it('falls back to the meta height before the container has been measured', () => {+ expect(getProjectsGridRowHeight({ aspectRatio: ASPECT_RATIO, columnCount: 3, widthPx: 0 })).toBe(+ PROJECT_CARD_META_HEIGHT_PX + PROJECTS_GRID_GAP_PX+ );+ });++ it('treats a nonsensical column count as one column', () => {+ expect(getProjectsGridRowHeight({ aspectRatio: ASPECT_RATIO, columnCount: 0, widthPx: 400 })).toBe(+ getProjectsGridRowHeight({ aspectRatio: ASPECT_RATIO, columnCount: 1, widthPx: 400 })+ );+ });+});diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/projects/projectsMetrics.ts b/invokeai/frontend/webv2/src/workbench/launchpad/projects/projectsMetrics.tsnew file mode 100644index 0000000000..6f90bf921c--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/projects/projectsMetrics.ts@@ -0,0 +1,91 @@+import { useCallback, useRef, useState } from 'react';++import type { ProjectsViewId } from './projectLibraryView';++/**+ * The grid's measurements, as numbers rather than CSS breakpoints.+ *+ * The virtualizer needs both before anything is laid out: how many cards share+ * a row, and how tall a row is. Measuring the container rather than the window+ * keeps both honest when the panel is resized instead of the browser.+ */++const MIN_CARD_WIDTH_PX = 240;+const MAX_COLUMNS = 4;++/** `gap="4"` between cards and rows. */+export const PROJECTS_GRID_GAP_PX = 16;++/** `p="3"` around a name line and a timestamp line. */+export const PROJECT_CARD_META_HEIGHT_PX = 60;++export const PROJECT_ROW_HEIGHT_PX = 52;++export const PROJECT_GROUP_HEADER_HEIGHT_PX = 44;++export const getProjectsColumnCount = (widthPx: number): number => {+ if (widthPx <= 0) {+ return 1;+ }++ return Math.max(1, Math.min(MAX_COLUMNS, Math.floor(widthPx / MIN_CARD_WIDTH_PX)));+};++/**+ * A grid row is one card tall: a 16:10 cover over a fixed meta block, plus the+ * gap below it. Derived from the measured width because the cover's height+ * follows the column width.+ */+export const getProjectsGridRowHeight = ({+ aspectRatio,+ columnCount,+ widthPx,+}: {+ aspectRatio: number;+ columnCount: number;+ widthPx: number;+}): number => {+ const columns = Math.max(1, columnCount);+ const columnWidth = (widthPx - PROJECTS_GRID_GAP_PX * (columns - 1)) / columns;++ if (!Number.isFinite(columnWidth) || columnWidth <= 0) {+ return PROJECT_CARD_META_HEIGHT_PX + PROJECTS_GRID_GAP_PX;+ }++ return Math.round(columnWidth / aspectRatio + PROJECT_CARD_META_HEIGHT_PX + PROJECTS_GRID_GAP_PX);+};++export const useProjectsMetrics = (+ view: ProjectsViewId+): { columnCount: number; measureRef: (node: HTMLDivElement | null) => void; widthPx: number } => {+ const [widthPx, setWidthPx] = useState(0);+ const observerRef = useRef<ResizeObserver | null>(null);++ const measureRef = useCallback((node: HTMLDivElement | null) => {+ observerRef.current?.disconnect();+ observerRef.current = null;++ if (!node) {+ return;+ }++ setWidthPx(node.clientWidth);++ if (typeof ResizeObserver === 'undefined') {+ return;+ }++ const observer = new ResizeObserver((entries) => {+ const entry = entries[0];++ if (entry) {+ setWidthPx(entry.contentRect.width);+ }+ });++ observer.observe(node);+ observerRef.current = observer;+ }, []);++ return { columnCount: view === 'list' ? 1 : getProjectsColumnCount(widthPx), measureRef, widthPx };+};diff --git a/invokeai/frontend/webv2/src/workbench/launchpad/projects/useProjectCardActions.ts b/invokeai/frontend/webv2/src/workbench/launchpad/projects/useProjectCardActions.tsnew file mode 100644index 0000000000..85ac037e75--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/launchpad/projects/useProjectCardActions.ts@@ -0,0 +1,92 @@+import { toaster } from '@platform/ui';+import {+ deleteLibraryProject,+ duplicateLibraryProject,+ renameLibraryProject,+ type ProjectSummary,+} from '@workbench/projects/library';+import { exportLibraryProject } from '@workbench/projects/projectFile';+import { useCallback } from 'react';+import { useTranslation } from 'react-i18next';++import { dropProjectPin } from './projectPins';++/**+ * The library actions a single project offers, shared by the grid card and the+ * list row so the two cannot drift. Every one runs against the server without+ * mounting the editor.+ */+export interface ProjectCardActions {+ rename: (name: string) => Promise<void>;+ duplicate: () => Promise<void>;+ export: () => Promise<void>;+ delete: () => Promise<void>;+}++export const useProjectCardActions = (summary: ProjectSummary): ProjectCardActions => {+ const { t } = useTranslation();++ const rename = useCallback(+ async (name: string) => {+ try {+ await renameLibraryProject(summary.id, name);+ } catch (error) {+ toaster.create({+ description: error instanceof Error ? error.message : undefined,+ title: t('projects.renameFailed'),+ type: 'error',+ });+ // The rename dialog stays open on a rejection, so the user keeps their input.+ throw error;+ }+ },+ [summary.id, t]+ );++ const duplicate = useCallback(async () => {+ try {+ const copy = await duplicateLibraryProject(summary.id);++ toaster.create({+ description: t('projects.projectDuplicatedDescription', { name: copy.name }),+ title: t('projects.projectDuplicated'),+ type: 'success',+ });+ } catch (error) {+ toaster.create({+ description: error instanceof Error ? error.message : undefined,+ title: t('projects.duplicateFailed'),+ type: 'error',+ });+ }+ }, [summary.id, t]);++ const exportProject = useCallback(async () => {+ try {+ await exportLibraryProject(summary.id);+ } catch (error) {+ toaster.create({+ description: error instanceof Error ? error.message : undefined,+ title: t('projects.exportFailed'),+ type: 'error',+ });+ }+ }, [summary.id, t]);++ const deleteProject = useCallback(async () => {+ try {+ await deleteLibraryProject(summary.id);+ // Pins are persisted per account, so a deleted project would otherwise+ // leave a dead id in preferences forever.+ dropProjectPin(summary.id);+ } catch (error) {+ toaster.create({+ description: error instanceof Error ? error.message : undefined,+ title: t('projects.deleteFailed'),+ type: 'error',+ });+ }+ }, [summary.id, t]);++ return { delete: deleteProject, duplicate, export: exportProject, rename };+};diff --git a/invokeai/frontend/webv2/src/workbench/projects/library.ts b/invokeai/frontend/webv2/src/workbench/projects/library.tsindex 53603fb657..d5a924af92 100644--- a/invokeai/frontend/webv2/src/workbench/projects/library.ts+++ b/invokeai/frontend/webv2/src/workbench/projects/library.ts@@ -37,6 +37,13 @@ export interface ProjectSummary {revision: number;createdAt: string;updatedAt: string;+ /**+ * Thumbnail for the library grid. Nothing populates this yet — covers land+ * with the `.invk` project-file work. Consumers must already handle its+ * absence, which is also the permanent state for a project that has produced+ * no images.+ */+ coverUrl?: string;}export type ProjectLibraryStatus = 'idle' | 'loading' | 'ready' | 'error';diff --git a/invokeai/frontend/webv2/src/workbench/projects/openProjects.test.ts b/invokeai/frontend/webv2/src/workbench/projects/openProjects.test.tsnew file mode 100644index 0000000000..9fb1d690ca--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/projects/openProjects.test.ts@@ -0,0 +1,73 @@+import { SESSION_STATE_KEY } from '@workbench/projects/session';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';++const getClientStateValue = vi.hoisted(() => vi.fn<(key: string, signal?: AbortSignal) => Promise<string | null>>());++vi.mock('@workbench/projects/api', () => ({ getClientStateValue }));++const importStore = () => {+ vi.resetModules();++ return import('@workbench/projects/openProjects');+};++describe('openProjects store', () => {+ beforeEach(() => {+ getClientStateValue.mockReset();+ });++ afterEach(() => {+ vi.resetModules();+ });++ it('reports a saved open set and the active project', async () => {+ getClientStateValue.mockResolvedValue(+ JSON.stringify({ account: {}, activeProjectId: 'b', openProjectIds: ['a', 'b'] })+ );++ const { getOpenProjects, refreshOpenProjects } = await importStore();++ await refreshOpenProjects();++ expect(getOpenProjects()).toEqual({ activeId: 'b', ids: ['a', 'b'], status: 'ready' });+ // The read is account-scoped, so it carries that scope's abort signal.+ expect(getClientStateValue).toHaveBeenCalledWith(SESSION_STATE_KEY, expect.any(AbortSignal));+ });++ it('distinguishes a definitely-empty session from an unknown one', async () => {+ getClientStateValue.mockResolvedValue(JSON.stringify({ account: {}, activeProjectId: '', openProjectIds: [] }));++ const empty = await importStore();++ await empty.refreshOpenProjects();+ expect(empty.getOpenProjects().ids).toEqual([]);++ // A blob written before the open set existed carries no `openProjectIds`.+ getClientStateValue.mockResolvedValue(JSON.stringify({ account: {}, activeProjectId: 'a' }));++ const legacy = await importStore();++ await legacy.refreshOpenProjects();+ expect(legacy.getOpenProjects().ids).toBeNull();+ });++ it('treats an unreachable backend as unknown rather than empty', async () => {+ getClientStateValue.mockRejectedValue(new Error('offline'));++ const { getOpenProjects, refreshOpenProjects } = await importStore();++ await refreshOpenProjects();++ expect(getOpenProjects()).toEqual({ activeId: null, ids: null, status: 'ready' });+ });++ it('shares one request between concurrent refreshes', async () => {+ getClientStateValue.mockResolvedValue(JSON.stringify({ account: {}, activeProjectId: 'a', openProjectIds: ['a'] }));++ const { refreshOpenProjects } = await importStore();++ await Promise.all([refreshOpenProjects(), refreshOpenProjects(), refreshOpenProjects()]);++ expect(getClientStateValue).toHaveBeenCalledTimes(1);+ });+});diff --git a/invokeai/frontend/webv2/src/workbench/projects/openProjects.ts b/invokeai/frontend/webv2/src/workbench/projects/openProjects.tsnew file mode 100644index 0000000000..5c5dfebe16--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/projects/openProjects.ts@@ -0,0 +1,73 @@+import {+ captureAccountScope,+ isAccountScopeCurrent,+ registerAccountOwnedResource,+} from '@platform/state/accountLifecycle';+import { createExternalStore } from '@platform/state/externalStore';+import { createSingleFlight } from '@platform/state/singleFlight';++import { fetchSessionBlob } from './session';++/**+ * Which projects the editor currently has open, read from the saved session.+ *+ * The Launchpad asks this from two places — the top bar's way back in, and the+ * library's "open" grouping — so it lives in one store with one request rather+ * than a fetch per component.+ *+ * `ids: null` means *unknown*, not empty: a first run, a session blob written+ * before the open set existed, or an unreachable backend all land there. The+ * `/app` guard makes the same distinction and declines to redirect on it, so+ * callers must not treat unknown as "nothing is open".+ */++export interface OpenProjectsSnapshot {+ status: 'idle' | 'loading' | 'ready';+ ids: string[] | null;+ activeId: string | null;+}++const EMPTY_OPEN_PROJECTS: OpenProjectsSnapshot = { activeId: null, ids: null, status: 'idle' };+const store = createExternalStore<OpenProjectsSnapshot>(EMPTY_OPEN_PROJECTS);++registerAccountOwnedResource({+ clear: () => {+ store.setSnapshot(EMPTY_OPEN_PROJECTS);+ },+ name: 'open-projects',+});++export const useOpenProjectsSelector = store.useSelector;++export const getOpenProjects = (): OpenProjectsSnapshot => store.getSnapshot();++const refreshFlight = createSingleFlight<void>();++/** Re-read the session blob; concurrent calls share one request. */+export const refreshOpenProjects = (): Promise<void> => {+ const owner = captureAccountScope();++ if (store.getSnapshot().status === 'idle') {+ store.patchSnapshot({ status: 'loading' });+ }++ return refreshFlight.run(`open-projects:${owner.epoch}`, () =>+ fetchSessionBlob(owner.signal)+ .then((blob) => {+ if (!isAccountScopeCurrent(owner)) {+ return;+ }++ store.setSnapshot({+ activeId: blob?.activeProjectId ?? null,+ ids: blob?.openProjectIds ?? null,+ status: 'ready',+ });+ })+ .catch(() => {+ if (isAccountScopeCurrent(owner)) {+ store.setSnapshot({ activeId: null, ids: null, status: 'ready' });+ }+ })+ );+};diff --git a/invokeai/frontend/webv2/src/workbench/projects/session.ts b/invokeai/frontend/webv2/src/workbench/projects/session.tsindex 72fd320b5e..15bcda6c63 100644--- a/invokeai/frontend/webv2/src/workbench/projects/session.ts+++ b/invokeai/frontend/webv2/src/workbench/projects/session.ts@@ -1,3 +1,4 @@+import type { LaunchpadIntentId } from '@workbench/launchpad/intents';import type { AccountState, WorkbenchState } from '@workbench/projectContracts';import type { WorkbenchPreferences } from '@workbench/settings/contracts';@@ -19,11 +20,13 @@ export const SESSION_STATE_KEY = 'webv2:workbench-account';/*** Search params understood by the /app route: `project` deep-links a library- * project into the session; `new` opens the editor with a fresh draft.+ * project into the session; `new` opens the editor with a fresh draft, and+ * `intent` says how that draft should be arranged (see `launchpad/intents`).*/export interface WorkbenchSearch {new?: true;project?: string;+ intent?: LaunchpadIntentId;}export interface WorkbenchSessionBlob {diff --git a/invokeai/frontend/webv2/src/workbench/settings/contracts.ts b/invokeai/frontend/webv2/src/workbench/settings/contracts.tsindex 5e9859712b..af37329410 100644--- a/invokeai/frontend/webv2/src/workbench/settings/contracts.ts+++ b/invokeai/frontend/webv2/src/workbench/settings/contracts.ts@@ -1,6 +1,9 @@import type { WorkbenchLanguage } from '@platform/i18n/languages';import type { WorkbenchThemeId } from '@theme/themes';import type { DeveloperLogLevel, DeveloperLogNamespace } from '@workbench/diagnostics/contracts';+import type { ProjectSortId, ProjectsViewId } from '@workbench/launchpad/projects/projectLibraryView';++export type { ProjectSortId, ProjectsViewId } from '@workbench/launchpad/projects/projectLibraryView';export type { WorkbenchLanguage } from '@platform/i18n/languages';@@ -57,6 +60,12 @@ export interface WorkbenchPreferences {customHotkeys: Record<string, string[]>;/** Generate panel section open/closed overrides keyed by section id; absent = section default. */generateSectionsOpen: Record<string, boolean>;+ /** How the Launchpad's project library is laid out. */+ launchpadProjectsView: ProjectsViewId;+ /** What the Launchpad's project library is ordered and bucketed by. */+ launchpadProjectsSort: ProjectSortId;+ /** Projects pinned to the top of the library, oldest pin first. */+ launchpadPinnedProjectIds: string[];/** User-saved Krea-2 conditioning rebalance curves, in the order they were saved. */krea2RebalancePresets: StoredRebalancePreset[];}diff --git a/invokeai/frontend/webv2/src/workbench/settings/store.ts b/invokeai/frontend/webv2/src/workbench/settings/store.tsindex 55c58ee9a1..515323b0a5 100644--- a/invokeai/frontend/webv2/src/workbench/settings/store.ts+++ b/invokeai/frontend/webv2/src/workbench/settings/store.ts@@ -1,5 +1,11 @@import type { DeveloperLogLevel, DeveloperLogNamespace } from '@workbench/diagnostics/contracts';-import type { ProjectSettings, StoredRebalancePreset, WorkbenchPreferences } from '@workbench/settings/contracts';+import type {+ ProjectSettings,+ ProjectSortId,+ ProjectsViewId,+ StoredRebalancePreset,+ WorkbenchPreferences,+} from '@workbench/settings/contracts';import { getUserStorageScope } from '@features/identity';import { normalizeWorkbenchLanguage } from '@platform/i18n/languages';@@ -61,6 +67,9 @@ export const DEFAULT_PREFERENCES: WorkbenchPreferences = {generateSectionsOpen: {},krea2RebalancePresets: [],language: 'en',+ launchpadPinnedProjectIds: [],+ launchpadProjectsSort: 'edited',+ launchpadProjectsView: 'grid',queueJobsScope: 'all',reduceMotion: false,showFocusRegionHighlight: true,@@ -133,6 +142,20 @@ const normalizeDeveloperLogNamespaces = (values: unknown): DeveloperLogNamespacereturn DEVELOPER_LOG_NAMESPACES.filter((namespace) => enabled.has(namespace));};+/**+ * Guards for the Launchpad library's view state. Deliberately local rather+ * than imported from the Launchpad: these settings load on every route, and a+ * value import would put launchpad view code in the editor's bundle too. The+ * types come from `contracts`, which is type-only and therefore free.+ */+const isProjectsViewId = (value: unknown): value is ProjectsViewId => value === 'grid' || value === 'list';++const isProjectSortId = (value: unknown): value is ProjectSortId =>+ value === 'edited' || value === 'created' || value === 'name';++const normalizePinnedProjectIds = (values: unknown): string[] =>+ Array.isArray(values) ? [...new Set(values.filter((value): value is string => typeof value === 'string'))] : [];+const normalizeCustomHotkeys = (values: unknown): Record<string, string[]> => {if (!values || typeof values !== 'object' || Array.isArray(values)) {return {};@@ -227,7 +250,12 @@ export const normalizeProjectSettings = (settings?: Partial<ProjectSettings>): PuseCpuNoise: typeof settings?.useCpuNoise === 'boolean' ? settings.useCpuNoise : DEFAULT_PROJECT_SETTINGS.useCpuNoise,});-type WorkbenchPreferencesInput = Omit<Partial<WorkbenchPreferences>, 'queueJobsScope' | 'workflowEdgeStyle'> & {+type WorkbenchPreferencesInput = Omit<+ Partial<WorkbenchPreferences>,+ 'launchpadProjectsSort' | 'launchpadProjectsView' | 'queueJobsScope' | 'workflowEdgeStyle'+> & {+ launchpadProjectsSort?: unknown;+ launchpadProjectsView?: unknown;queueJobsScope?: unknown;workflowEdgeStyle?: unknown;};@@ -265,6 +293,13 @@ export const normalizeWorkbenchPreferences = (preferences?: WorkbenchPreferencesgenerateSectionsOpen: normalizeGenerateSectionsOpen(preferences?.generateSectionsOpen),krea2RebalancePresets: normalizeRebalancePresets(preferences?.krea2RebalancePresets),language: normalizeWorkbenchLanguage(preferences?.language) ?? DEFAULT_PREFERENCES.language,+ launchpadPinnedProjectIds: normalizePinnedProjectIds(preferences?.launchpadPinnedProjectIds),+ launchpadProjectsSort: isProjectSortId(preferences?.launchpadProjectsSort)+ ? preferences.launchpadProjectsSort+ : DEFAULT_PREFERENCES.launchpadProjectsSort,+ launchpadProjectsView: isProjectsViewId(preferences?.launchpadProjectsView)+ ? preferences.launchpadProjectsView+ : DEFAULT_PREFERENCES.launchpadProjectsView,queueJobsScope:preferences?.queueJobsScope === 'all-projects'? 'all'diff --git a/invokeai/frontend/webv2/vite.config.mts b/invokeai/frontend/webv2/vite.config.mtsindex 17c46de42b..fb394b032d 100644--- a/invokeai/frontend/webv2/vite.config.mts+++ b/invokeai/frontend/webv2/vite.config.mts@@ -27,6 +27,10 @@ const ROUTE_SHARED_MODULES = ['/workbench/components/WorkbenchSplashScreen.tsx','/workbench/hotkeys/catalog.ts','/workbench/launchpad/formatRelativeTime.ts',+ // The Launchpad writes `?intent=` and the editor's session controller reads+ // it. Without this the editor pulls the whole Launchpad chunk for a lookup+ // table — a 66 KB, one-extra-request regression on the editor route.+ '/workbench/launchpad/intents.ts','/workbench/palette/settingsEntryDeps.ts','/workbench/projects/ids.ts','/workbench/projects/library.ts',