From b5982927de939f05966303f0e9dcd8a1983696b6 Mon Sep 17 00:00:00 2001 From: yyh <92089059+lyzno1@users.noreply.github.com> Date: Mon, 24 Aug 2026 09:04:30 +0000 Subject: [PATCH] fix: align main navigation card grids (#41167) --- .../components/apps/__tests__/list.spec.tsx | 23 ------ web/app/components/apps/app-list-catalog.tsx | 3 +- web/app/components/apps/constants.ts | 6 +- .../apps/first-empty-state/index.tsx | 9 ++- .../components/explore/learn-dify/index.tsx | 3 +- .../__tests__/card-grid.browser.spec.tsx | 72 +++++++++++++++++++ web/app/components/main-nav/app-card-grid.ts | 2 + .../home/continue-work/continue-work.tsx | 3 +- .../__tests__/home-content.spec.tsx | 2 +- .../home/home-content/home-content.tsx | 8 +-- .../home/home-content/style.module.css | 23 ------ web/features/home/home-skeleton.tsx | 6 +- 12 files changed, 101 insertions(+), 59 deletions(-) create mode 100644 web/app/components/main-nav/__tests__/card-grid.browser.spec.tsx create mode 100644 web/app/components/main-nav/app-card-grid.ts delete mode 100644 web/features/home/home-content/style.module.css diff --git a/web/app/components/apps/__tests__/list.spec.tsx b/web/app/components/apps/__tests__/list.spec.tsx index 8ade51a73a3..79816ab08a8 100644 --- a/web/app/components/apps/__tests__/list.spec.tsx +++ b/web/app/components/apps/__tests__/list.spec.tsx @@ -899,29 +899,6 @@ describe('List', () => { ) }) - it('should lay out first empty state placeholder cards with auto-fill grid columns', () => { - mockAppData = { pages: [{ data: [], total: 0 }] } - - const { container } = renderList() - const placeholderGrid = Array.from(container.querySelectorAll('.pointer-events-none')).find( - (element) => element.className.includes('grid-rows-4'), - ) - - if (!placeholderGrid) throw new Error('Expected first empty state placeholder grid to render') - - expect(placeholderGrid).toHaveClass( - 'grid', - 'grid-cols-[repeat(auto-fill,minmax(296px,1fr))]', - 'grid-rows-4', - ) - expect(placeholderGrid).not.toHaveClass( - 'grid-cols-1', - 'sm:grid-cols-2', - 'lg:grid-cols-3', - 'xl:grid-cols-4', - ) - }) - it('should hide learn dify in first empty state when learn app is disabled', () => { mockAppData = { pages: [{ data: [], total: 0 }] } diff --git a/web/app/components/apps/app-list-catalog.tsx b/web/app/components/apps/app-list-catalog.tsx index 1b7dc2df745..3d3ba81e0b3 100644 --- a/web/app/components/apps/app-list-catalog.tsx +++ b/web/app/components/apps/app-list-catalog.tsx @@ -15,6 +15,7 @@ import { keepPreviousData, useInfiniteQuery, useQuery } from '@tanstack/react-qu import { useMemo } from 'react' import { useTranslation } from 'react-i18next' import { InfiniteScrollSentinel } from '@/app/components/base/infinite-scroll-sentinel' +import { MAIN_NAV_APP_CARD_GRID_CLASS_NAME } from '@/app/components/main-nav/app-card-grid' import { STEP_BY_STEP_TOUR_TARGETS } from '@/app/components/step-by-step-tour/target-registry' import { systemFeaturesQueryOptions } from '@/features/system-features/client' import { consoleQuery } from '@/service/client' @@ -217,7 +218,7 @@ function AppListCatalogContent({ preloadDistance={getPreloadDistance} scrollContainerRef={scrollViewportRef} /> -