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): align starred gallery disclosure
joshistoastb1fa318ac0b0
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 f04ffd9d58..afc4664844 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@@ -481,6 +481,25 @@ describe('GalleryImageGrid mixed item cells', () => {).toEqual(['starred', 'regular']);});+ it('matches board disclosure chrome while retaining the star marker', async () => {+ await renderGallery(+ createGallery({+ items: [createItem('image', 'starred.png', { starred: true }), createItem('image', 'regular.png')],+ })+ );++ const trigger = getButton('Collapse starred items');+ const header = trigger.parentElement;++ expect(header?.getBoundingClientRect().height).toBe(24);+ expect(trigger.querySelector('svg.lucide-star')).not.toBeNull();+ expect(getComputedStyle(trigger).transitionProperty).toBe('color');++ await act(() => userEvent.hover(trigger));++ expect(getComputedStyle(trigger).backgroundColor).toBe('rgba(0, 0, 0, 0)');+ });+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 f92b0ecbf2..f07a68c108 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryImageGrid.tsx@@ -1,7 +1,7 @@import { Box, Flex, HStack, Icon, ScrollArea, Spinner, Text } from '@chakra-ui/react';import { getGalleryBoardLabel } from '@features/gallery/core/boardLabels';import { toGalleryItemKey, type GalleryItem } from '@features/gallery/core/items';-import { Button, DropZone } from '@platform/ui';+import { DropZone } from '@platform/ui';import { ChevronRightIcon, StarIcon, UploadIcon } from 'lucide-react';import {useCallback,@@ -33,7 +33,8 @@ import { useGalleryGridSelection } from './useGalleryGridSelection';* tiles before the ResizeObserver reports.*/const viewportWidthCache = new Map<string, number>();-const STARRED_HEADER_HEIGHT_PX = 28;+const STARRED_HEADER_HEIGHT_PX = 24;+const STARRED_TRIGGER_HOVER_STYLES = { color: 'fg' } as const;const dragEventContainsFiles = (event: DragEvent): boolean => Array.from(event.dataTransfer.types).includes('Files');@@ -314,24 +315,29 @@ export const GalleryImageGrid = () => {h={`${STARRED_HEADER_HEIGHT_PX}px`}left="0"position="absolute"+ px="1"top="0"transform={`translateY(${virtualRow.start}px)`}w="full">- <Button+ <Box+ as="button"aria-expanded={isStarredOpen}aria-label={t(isStarredOpen? 'widgets.gallery.collapseStarredItems': 'widgets.gallery.expandStarredItems')}+ alignItems="center"color="fg.muted"- h="6"- justifyContent="flex-start"- px="1"- size="xs"- variant="ghost"- w="full"+ cursor="pointer"+ display="flex"+ flex="1"+ gap="1"+ minW="0"+ transition="color var(--wb-motion-duration-fast) ease"+ type="button"+ _hover={STARRED_TRIGGER_HOVER_STYLES}onClick={handleToggleStarredSection}><Icon@@ -347,15 +353,23 @@ export const GalleryImageGrid = () => {fontSize="2xs"fontWeight="600"letterSpacing="wide"+ lineHeight="1"textTransform="uppercase"+ truncate>{t('widgets.gallery.starredItems')}</Text>- <Text as="span" color="fg.subtle" fontSize="2xs" fontVariantNumeric="tabular-nums">+ <Text+ as="span"+ color="fg.subtle"+ fontSize="2xs"+ fontVariantNumeric="tabular-nums"+ lineHeight="1"+ >{row.itemCount}</Text></HStack>- </Button>+ </Box></Flex>);}