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(gallery): enlarge the header controls and gather board visibility into one menu
joshistoastdd2d505c0d1e
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.jsonindex f16e86bf45..dc75834c2e 100644--- a/invokeai/frontend/webv2/public/locales/en.json+++ b/invokeai/frontend/webv2/public/locales/en.json@@ -2781,10 +2781,12 @@},"gallery": {"alwaysShowDimensions": "Always show dimensions",+ "archivedBoards": "Archived boards","archiveBoard": "Archive Board","assetCount_one": "{{count}} asset","assetCount_other": "{{count}} assets","boardActionsForBoard": "Board actions for {{name}}",+ "boardVisibility": "Board visibility","boardArchived": "Archived board \"{{name}}\"","boardArchivePreparing_one": "Preparing an image archive of \"{{name}}\". {{count}} video will be omitted.","boardArchivePreparing_other": "Preparing an image archive of \"{{name}}\". {{count}} videos will be omitted.",@@ -2813,6 +2815,7 @@"createBoard": "Create board","createBoardNamed": "Create board \"{{name}}\"","collapseStarredItems": "Collapse starred items",+ "dateBoards": "Date boards","dateFilterDay": "{{date}}","dateFilterFrom": "From {{date}}","dateFilterInvalid": "Unrecognized date “{{value}}” — use YYYY-MM-DD, today, yesterday, 7d, 2w, 1m",@@ -2848,8 +2851,6 @@"expandStarredItems": "Expand starred items","generationProgress": "Generation progress","generationProgressPercent": "Generation {{percentage}}%",- "hideArchivedBoards": "Hide archived boards",- "hideDateBoards": "Hide date boards","imageCount_one": "{{count}} image","imageCount_other": "{{count}} images","imageSize": "Image size",@@ -2901,6 +2902,7 @@"preparingDownload": "Preparing download","renameBoard": "Rename board","resizeBoardPanel": "Resize board panel",+ "otherProjectBoards": "Other projects' boards","searchHelpDate": "A single day.","searchHelpFrom": "On or after this day.","searchHelpIntro": "Combine plain text with date tokens. Values accept YYYY-MM-DD, today, yesterday, or relative values such as 7d, 2w, and 1m.",@@ -2923,8 +2925,6 @@"settings": "Gallery settings","settingsGridSize": "Grid Size","settingsThumbnails": "Thumbnails",- "showArchivedBoards": "Show archived boards",- "showDateBoards": "Show date boards","showPendingItems": "Show pending items","sortBoards": "Sort boards","sortBoardsAscending": "Sort boards ascending",diff --git a/invokeai/frontend/webv2/src/features/gallery/core/settings.ts b/invokeai/frontend/webv2/src/features/gallery/core/settings.tsindex f8e312abb3..7c2ed21156 100644--- a/invokeai/frontend/webv2/src/features/gallery/core/settings.ts+++ b/invokeai/frontend/webv2/src/features/gallery/core/settings.ts@@ -34,6 +34,12 @@ export interface GallerySettings {showArchivedBoards: boolean;showDateBoards: boolean;showImageDimensions: boolean;+ /**+ * Boards owned by another project. They are readable and already labelled+ * with a project badge; this hides them for anyone who wants the panel to+ * be about the project they have open.+ */+ showOtherProjectBoards: boolean;showPendingItems: boolean;starredFirst: boolean;thumbnailFit: GalleryThumbnailFit;@@ -52,6 +58,7 @@ export const DEFAULT_GALLERY_SETTINGS: GallerySettings = {showArchivedBoards: false,showDateBoards: false,showImageDimensions: false,+ showOtherProjectBoards: true,showPendingItems: true,starredFirst: true,thumbnailFit: 'square',@@ -113,6 +120,10 @@ export const getGallerySettings = (values: Record<string, unknown>): GallerySetttypeof values.showImageDimensions === 'boolean'? values.showImageDimensions: DEFAULT_GALLERY_SETTINGS.showImageDimensions,+ showOtherProjectBoards:+ typeof values.showOtherProjectBoards === 'boolean'+ ? values.showOtherProjectBoards+ : DEFAULT_GALLERY_SETTINGS.showOtherProjectBoards,showPendingItems:typeof values.showPendingItems === 'boolean' ? values.showPendingItems : DEFAULT_GALLERY_SETTINGS.showPendingItems,// Starred items have a dedicated section, so the backing window must alwaysdiff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardFilters.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardFilters.tsxindex 55c125febc..70a179317f 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardFilters.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardFilters.tsx@@ -1,10 +1,19 @@import type { GalleryBoardOrderBy, GalleryOrderDir } from '@features/gallery/core/types';import { HStack, Icon, Input, InputGroup, Menu, Portal } from '@chakra-ui/react';-import { CloseButton, IconButton, ToggleIconButton } from '@platform/ui/Button';+import { CloseButton, IconButton } from '@platform/ui/Button';import { MenuContent } from '@platform/ui/Menu';import { Tooltip } from '@platform/ui/Tooltip';-import { ArchiveIcon, ArrowUpDownIcon, CalendarIcon, SearchIcon } from 'lucide-react';+import {+ ArchiveIcon,+ ArrowUpDownIcon,+ CalendarIcon,+ CheckIcon,+ EyeIcon,+ FolderIcon,+ SearchIcon,+ type LucideIcon,+} from 'lucide-react';import { useCallback, useMemo, type ChangeEvent, type KeyboardEvent, type Ref } from 'react';import { useTranslation } from 'react-i18next';@@ -15,10 +24,15 @@ const SEARCH_START_ELEMENT = <Icon as={SearchIcon} size="xs" />;const SORT_MENU_POSITIONING = { placement: 'bottom-end' } as const;/**- * Board search plus the three list controls. All three are icon-only in both- * layouts — the wide sidebar has no room for labels, and giving the stacked- * layout labelled variants would be exactly the size-conditional behaviour this- * redesign exists to remove.+ * Board search plus the two list controls: what the panel shows, and how it is+ * ordered. Both are icon-only in both layouts — the wide sidebar has no room+ * for labels, and giving the stacked layout labelled variants would be exactly+ * the size-conditional behaviour this redesign exists to remove.+ *+ * Visibility is one menu rather than a toggle button per group. Two buttons+ * was already a row of unlabelled icons whose meaning you had to hover for,+ * and other-project boards make three; a menu names each one and has room for+ * the next.*/export const GalleryBoardFilters = ({ref,@@ -35,8 +49,12 @@ export const GalleryBoardFilters = ({}) => {const { t } = useTranslation();const { actions, gallery } = useGalleryWidget();- const { boardOrderBy, boardOrderDir, showArchivedBoards, showDateBoards } = gallery.settings;+ const { boardOrderBy, boardOrderDir, showArchivedBoards, showDateBoards, showOtherProjectBoards } = gallery.settings;const sortTriggerIds = useMenuTriggerIds();+ const visibilityTriggerIds = useMenuTriggerIds();+ // Any non-default lifts the trigger out of `fg.muted`, so a filtered panel is+ // legible without opening the menu.+ const isVisibilityFiltered = showArchivedBoards || showDateBoards || !showOtherProjectBoards;const handleSearchChange = useCallback((event: ChangeEvent<HTMLInputElement>) => onSearchChange(event.currentTarget.value),@@ -58,13 +76,18 @@ export const GalleryBoardFilters = ({);const handleToggleDateBoards = useCallback(- (showDateBoards: boolean) => actions.updateSettings({ showDateBoards }),- [actions]+ () => actions.updateSettings({ showDateBoards: !showDateBoards }),+ [actions, showDateBoards]);const handleToggleArchivedBoards = useCallback(- (showArchivedBoards: boolean) => actions.updateSettings({ showArchivedBoards }),- [actions]+ () => actions.updateSettings({ showArchivedBoards: !showArchivedBoards }),+ [actions, showArchivedBoards]+ );++ const handleToggleOtherProjectBoards = useCallback(+ () => actions.updateSettings({ showOtherProjectBoards: !showOtherProjectBoards }),+ [actions, showOtherProjectBoards]);const handleOrderByChange = useCallback(@@ -98,20 +121,50 @@ export const GalleryBoardFilters = ({onKeyDown={handleSearchKeyDown}/></InputGroup>- <ToggleIconButton- checked={showDateBoards}- icon={CalendarIcon}- size="xs"- label={showDateBoards ? t('widgets.gallery.hideDateBoards') : t('widgets.gallery.showDateBoards')}- onCheckedChange={handleToggleDateBoards}- />- <ToggleIconButton- checked={showArchivedBoards}- icon={ArchiveIcon}- size="xs"- label={showArchivedBoards ? t('widgets.gallery.hideArchivedBoards') : t('widgets.gallery.showArchivedBoards')}- onCheckedChange={handleToggleArchivedBoards}- />+ <Menu.Root closeOnSelect={false} ids={visibilityTriggerIds} positioning={SORT_MENU_POSITIONING}>+ <Tooltip content={t('widgets.gallery.boardVisibility')} ids={visibilityTriggerIds}>+ <Menu.Trigger asChild>+ <IconButton+ aria-label={t('widgets.gallery.boardVisibility')}+ color={isVisibilityFiltered ? 'fg' : 'fg.muted'}+ size="xs"+ variant="ghost"+ >+ <Icon as={EyeIcon} boxSize="3.5" />+ </IconButton>+ </Menu.Trigger>+ </Tooltip>+ <Portal>+ <Menu.Positioner>+ <MenuContent minW="12rem">+ <Menu.ItemGroup>+ <Menu.ItemGroupLabel>{t('widgets.gallery.boardVisibility')}</Menu.ItemGroupLabel>+ <BoardVisibilityItem+ icon={CalendarIcon}+ isChecked={showDateBoards}+ label={t('widgets.gallery.dateBoards')}+ value="date-boards"+ onSelect={handleToggleDateBoards}+ />+ <BoardVisibilityItem+ icon={ArchiveIcon}+ isChecked={showArchivedBoards}+ label={t('widgets.gallery.archivedBoards')}+ value="archived-boards"+ onSelect={handleToggleArchivedBoards}+ />+ <BoardVisibilityItem+ icon={FolderIcon}+ isChecked={showOtherProjectBoards}+ label={t('widgets.gallery.otherProjectBoards')}+ value="other-project-boards"+ onSelect={handleToggleOtherProjectBoards}+ />+ </Menu.ItemGroup>+ </MenuContent>+ </Menu.Positioner>+ </Portal>+ </Menu.Root><Menu.Root ids={sortTriggerIds} positioning={SORT_MENU_POSITIONING}><Tooltip content={t('widgets.gallery.sortBoards')} ids={sortTriggerIds}><Menu.Trigger asChild>@@ -156,3 +209,29 @@ export const GalleryBoardFilters = ({</HStack>);};++/**+ * A checkable visibility row. Chakra ships no `Menu.CheckboxItem`, and the+ * codebase expresses checked state either as a radio group or as a zero-opacity+ * check that holds its own gutter; these are independent toggles, so it is the+ * latter.+ */+const BoardVisibilityItem = ({+ icon,+ isChecked,+ label,+ onSelect,+ value,+}: {+ icon: LucideIcon;+ isChecked: boolean;+ label: string;+ onSelect: () => void;+ value: string;+}) => (+ <Menu.Item aria-checked={isChecked} closeOnSelect={false} role="menuitemcheckbox" value={value} onClick={onSelect}>+ <Icon as={CheckIcon} boxSize="3" opacity={isChecked ? 1 : 0} />+ <Icon as={icon} boxSize="3.5" color="fg.subtle" />+ <Menu.ItemText fontSize="xs">{label}</Menu.ItemText>+ </Menu.Item>+);diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.browser.test.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.browser.test.tsxindex a55a35a7a3..773d252963 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.browser.test.tsx@@ -272,17 +272,28 @@ describe('GalleryBoardsPanel', () => {expect(actions.updateSettings).toHaveBeenCalledWith({ collapsedBoardSections: ['boards'] });});- it('toggles the date and archived board queries from the filter row', async () => {+ it('toggles every board group from the visibility menu', async () => {await renderPanel();- const dateToggle = host?.querySelector<HTMLElement>('button[aria-label="widgets.gallery.hideDateBoards"]');+ const openMenu = async () => {+ const trigger = host?.querySelector<HTMLElement>('button[aria-label="widgets.gallery.boardVisibility"]');- await click(dateToggle!);- expect(actions.updateSettings).toHaveBeenCalledWith({ showDateBoards: false });+ await click(trigger!);+ };++ // Each row stays a checkbox rather than closing the menu, so the three+ // groups can be set in one visit.+ await openMenu();- const archiveToggle = host?.querySelector<HTMLElement>('button[aria-label="widgets.gallery.hideArchivedBoards"]');+ const row = (value: string) => document.querySelector<HTMLElement>(`[data-scope="menu"] [data-value="${value}"]`);- await click(archiveToggle!);+ await click(row('date-boards')!);+ expect(actions.updateSettings).toHaveBeenCalledWith({ showDateBoards: false });++ await click(row('archived-boards')!);expect(actions.updateSettings).toHaveBeenCalledWith({ showArchivedBoards: false });++ await click(row('other-project-boards')!);+ expect(actions.updateSettings).toHaveBeenCalledWith({ showOtherProjectBoards: false });});});diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.tsxindex 9784f51f9e..d1c99564a0 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryBoardsPanel.tsx@@ -40,7 +40,7 @@ export const GalleryBoardsPanel = () => {// container that stops being rendered loses its offset outright.usePreservedScrollOffset(boardsViewportRef);- const { collapsedBoardSections, showArchivedBoards, showDateBoards } = gallery.settings;+ const { collapsedBoardSections, showArchivedBoards, showDateBoards, showOtherProjectBoards } = gallery.settings;const groups = useMemo(() =>@@ -51,9 +51,19 @@ export const GalleryBoardsPanel = () => {searchTerm,showArchived: showArchivedBoards,showDates: showDateBoards,+ showOtherProjects: showOtherProjectBoards,t,}),- [gallery.boards, gallery.projectBoardId, projectName, searchTerm, showArchivedBoards, showDateBoards, t]+ [+ gallery.boards,+ gallery.projectBoardId,+ projectName,+ searchTerm,+ showArchivedBoards,+ showDateBoards,+ showOtherProjectBoards,+ t,+ ]);const loadedItemBoardIds = useMemo(diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryItemSortMenu.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryItemSortMenu.tsxindex b6e96cc665..ee3318c12f 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryItemSortMenu.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryItemSortMenu.tsx@@ -34,7 +34,7 @@ export const GalleryItemSortMenu = () => {flexShrink={0}fontSize="xs"gap="1"- size="2xs"+ size="xs"variant="ghost">{imageOrderDir === 'DESC' ? t('widgets.gallery.newest') : t('widgets.gallery.oldest')}diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryUploadButton.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryUploadButton.tsxindex 3fb4308807..4ff1366476 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryUploadButton.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryUploadButton.tsx@@ -38,7 +38,7 @@ export const GalleryUploadButton = ({aria-label={label}color="fg.muted"disabled={isVirtualTarget}- size="2xs"+ size="xs"variant="ghost"onClick={openPicker}>diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryViewTabs.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryViewTabs.tsxindex 5c20339fa2..1f2f9a1c34 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryViewTabs.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryViewTabs.tsx@@ -39,8 +39,7 @@ export const GalleryViewTabs = () => {return (<SegmentGroup.Rootaria-label={t('common.view')}- // `2xs` is a repo recipe extension the generated Chakra types don't know.- size={'2xs' as 'xs'}+ size="xs"value={gallery.galleryView}onValueChange={handleViewChange}>diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.test.ts b/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.test.tsindex d0e53301bf..753ab804d1 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.test.ts+++ b/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.test.ts@@ -19,16 +19,19 @@ const dogs = createBoard({ id: 'dogs', name: 'dogs' });const cats = createBoard({ id: 'cats', name: 'Cats' });const archived = createBoard({ archived: true, id: 'gorl', name: 'GORL' });const dateBoard = createBoard({ id: 'by_date:2026-07-28', kind: 'date', name: '28 July' });+const otherProject = createBoard({ id: 'other', name: 'Someone else', projectId: 'project-2' });+const ownProject = createBoard({ id: 'mine', name: 'My project', projectId: 'project-1' });const t = (key: string) => (key === 'widgets.gallery.uncategorized' ? 'Uncategorized' : key);const groupsOf = (overrides: Partial<Parameters<typeof getGalleryBoardGroups>[0]> = {}) =>getGalleryBoardGroups({- boards: [uncategorized, dogs, cats, archived, dateBoard],+ boards: [uncategorized, dogs, cats, archived, dateBoard, otherProject, ownProject],projectBoardId: null,projectName: 'Project',searchTerm: '',showArchived: true,showDates: true,+ showOtherProjects: true,t,...overrides,});@@ -37,14 +40,14 @@ describe('getGalleryBoardGroups', () => {it('splits archived boards into their own section instead of the main list', () => {const groups = groupsOf();- expect(groups.yourBoards.map((board) => board.id)).toEqual(['dogs', 'cats', 'none']);+ expect(groups.yourBoards.map((board) => board.id)).toEqual(['dogs', 'cats', 'other', 'mine', 'none']);expect(groups.archivedBoards.map((board) => board.id)).toEqual(['gorl']);});it('puts Uncategorized last and hoists the project board first', () => {const groups = groupsOf({ projectBoardId: 'cats' });- expect(groups.yourBoards.map((board) => board.id)).toEqual(['cats', 'dogs', 'none']);+ expect(groups.yourBoards.map((board) => board.id)).toEqual(['cats', 'dogs', 'other', 'mine', 'none']);});it('hides the date and archived sections when their toggles are off', () => {@@ -52,9 +55,21 @@ describe('getGalleryBoardGroups', () => {expect(groups.archivedBoards).toEqual([]);expect(groups.dateBoards).toEqual([]);+ expect(groups.yourBoards.map((board) => board.id)).toEqual(['dogs', 'cats', 'other', 'mine', 'none']);+ });++ it('drops boards owned by another project when they are hidden', () => {+ const groups = groupsOf({ showOtherProjects: false });+expect(groups.yourBoards.map((board) => board.id)).toEqual(['dogs', 'cats', 'none']);});+ it('keeps the open project own board even while other projects are hidden', () => {+ const groups = groupsOf({ projectBoardId: 'mine', showOtherProjects: false });++ expect(groups.yourBoards.map((board) => board.id)).toEqual(['mine', 'dogs', 'cats', 'none']);+ });+it('filters every section by a case-insensitive substring match', () => {const groups = groupsOf({ searchTerm: 'DOG' });diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.ts b/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.tsindex 593abb37b6..8be176f476 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.ts+++ b/invokeai/frontend/webv2/src/features/gallery/ui/galleryBoardGroups.ts@@ -17,9 +17,11 @@ export interface GalleryBoardGroups {/*** Splits the flat board list into the panel's three sections.*- * Pure and total: it filters on `showArchived`/`showDates` itself rather than- * trusting the query to have excluded them, so grouping can be reasoned about- * (and tested) without a fetch in the picture.+ * Pure and total: it filters on `showArchived`/`showDates`/`showOtherProjects`+ * itself rather than trusting the query to have excluded them, so grouping can+ * be reasoned about (and tested) without a fetch in the picture. The+ * other-projects filter has to happen here in any case — `GET /boards/` takes+ * no project parameter, so the list always arrives complete.*/export const getGalleryBoardGroups = ({boards,@@ -28,6 +30,7 @@ export const getGalleryBoardGroups = ({searchTerm,showArchived,showDates,+ showOtherProjects,t,}: {boards: readonly GalleryBoard[];@@ -36,6 +39,7 @@ export const getGalleryBoardGroups = ({searchTerm: string;showArchived: boolean;showDates: boolean;+ showOtherProjects: boolean;t: GalleryBoardTranslate;}): GalleryBoardGroups => {const normalizedSearchTerm = searchTerm.trim().toLowerCase();@@ -46,8 +50,16 @@ export const getGalleryBoardGroups = ({const projectRowName = projectBoard?.name ?? projectName;const matchesBoardSearch = (board: GalleryBoard) => matchesSearch(getGalleryBoardLabel(board, t));+ // The open project's own board is never "another project's", whatever the+ // setting says — hiding the board you are working in would be nonsense.+ const belongsToVisibleProject = (board: GalleryBoard) =>+ showOtherProjects || board.projectId === null || board.id === projectBoard?.id;const regularBoards = boards.filter(- (board) => board.kind === 'board' && board.id !== projectBoard?.id && matchesBoardSearch(board)+ (board) =>+ board.kind === 'board' &&+ board.id !== projectBoard?.id &&+ belongsToVisibleProject(board) &&+ matchesBoardSearch(board));const dateBoards = showDates ? boards.filter((board) => board.kind === 'date' && matchesBoardSearch(board)) : [];const archivedBoards = showArchived ? regularBoards.filter((board) => board.archived) : [];diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.test.ts b/invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.test.tsindex 6352b09bd8..b5181dbc67 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.test.ts+++ b/invokeai/frontend/webv2/src/features/gallery/ui/galleryStateView.test.ts@@ -196,6 +196,7 @@ describe('gallery state view', () => {showArchivedBoards: false,showDateBoards: false,showImageDimensions: false,+ showOtherProjectBoards: true,showPendingItems: true,starredFirst: true,thumbnailFit: 'square',