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
fix(webv2): separate starred gallery section
joshistoasta96092eace38
diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.browser.test.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.browser.test.tsxindex afc4664844..bcc3b1bb2a 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.browser.test.tsx@@ -33,6 +33,7 @@ import { userEvent } from 'vitest/browser';import type { GalleryStateView } from './galleryStateView';import type { GalleryActions, GalleryWidgetContextValue } from './GalleryWidgetContext';+import { GALLERY_GRID_GAP_PX } from './galleryGridLayout';import { GalleryImageGrid } from './GalleryImageGrid';import { GalleryWidgetContext } from './GalleryWidgetContext';@@ -500,6 +501,18 @@ describe('GalleryImageGrid mixed item cells', () => {expect(getComputedStyle(trigger).backgroundColor).toBe('rgba(0, 0, 0, 0)');});+ it('adds a compact section gap after the last starred row', async () => {+ await renderGallery(+ createGallery({+ items: [createItem('image', 'starred.png', { starred: true }), createItem('image', 'regular.png')],+ })+ );++ const options = mocks.virtualizerOptions.at(-1);++ expect(options?.estimateSize(1)).toBe((options?.estimateSize(2) ?? 0) + GALLERY_GRID_GAP_PX);+ });+it('collapses only the starred items and omits the disclosure when no stars are loaded', async () => {await renderGallery(createGallery({diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsxindex 23ec1315a8..1db794e594 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx@@ -143,7 +143,22 @@ export const GalleryImageGrid = () => {const cellSizePx = getGalleryCellSizePx({ columnCount, widthPx: viewportWidth });const rowHeightPx = cellSizePx + GALLERY_GRID_GAP_PX;const estimateRowSize = useCallback(- (index: number) => (rows[index]?.kind === 'starred-header' ? STARRED_HEADER_HEIGHT_PX : rowHeightPx),+ (index: number) => {+ const row = rows[index];++ if (row?.kind === 'starred-header') {+ return STARRED_HEADER_HEIGHT_PX;+ }++ const nextRow = rows[index + 1];+ const endsStarredSection =+ row?.kind === 'cells' &&+ row.section === 'starred' &&+ nextRow?.kind === 'cells' &&+ nextRow.section === 'regular';++ return rowHeightPx + (endsStarredSection ? GALLERY_GRID_GAP_PX : 0);+ },[rowHeightPx, rows]);const getScrollElement = useCallback(() => viewportRef.current, []);