Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(web): align agent knowledge grid with the main nav app grid (#44977)

yyh45f784a97c54
diff --git a/web/app/components/datasets/list/dataset-card-skeleton.tsx b/web/app/components/datasets/list/dataset-card-skeleton.tsx
index 8e29f7278c8..54ce48e9b8c 100644
--- a/web/app/components/datasets/list/dataset-card-skeleton.tsx
+++ b/web/app/components/datasets/list/dataset-card-skeleton.tsx
@@ -9,7 +9,7 @@ const DatasetCardSkeleton = ({ count = 6 }: DatasetCardSkeletonProps) => (
{Array.from({ length: count }, (_, index) => (
<li
key={index}
- className="h-47.5 rounded-xl border-[0.5px] border-components-card-border bg-components-card-bg p-4 shadow-xs shadow-shadow-shadow-3"
+ className="h-41.5 rounded-xl border-[0.5px] border-components-card-border bg-components-card-bg p-4 shadow-xs shadow-shadow-shadow-3"
>
<SkeletonContainer className="h-full">
<SkeletonRow>
diff --git a/web/features/new-rag/list/new-knowledge-list.tsx b/web/features/new-rag/list/new-knowledge-list.tsx
index d65c53c3caf..514dfcfa1ff 100644
--- a/web/features/new-rag/list/new-knowledge-list.tsx
+++ b/web/features/new-rag/list/new-knowledge-list.tsx
@@ -25,6 +25,7 @@ import { CreatorFilter } from '@/app/components/datasets/creator-filter'
import { creatorIdsParser } from '@/app/components/datasets/creator-filter-query'
import ExternalAPIPanel from '@/app/components/datasets/external-api/external-api-panel'
import { ServiceApi } from '@/app/components/datasets/extra-info/service-api'
+import { MAIN_NAV_APP_CARD_GRID_CLASS_NAME } from '@/app/components/main-nav/app-card-grid'
import { useDocLink } from '@/context/i18n'
import { workspacePermissionKeysAtom } from '@/context/permission-state'
import { knowledgeFsUploadEnabledAtom } from '@/features/knowledge-fs-availability/state'
@@ -41,12 +42,7 @@ import { useKnowledgeUpgrade } from '../upgrade/knowledge-upgrade-context-value'
import { matchesKnowledgeUpgradeFilters } from '../upgrade/knowledge-upgrade-filters'
import { KnowledgeSpaceCard } from './knowledge-space-card'
import { KnowledgeViewSwitcher } from './knowledge-view-switcher'
-import {
- KNOWLEDGE_SPACE_GRID_CLASS_NAME,
- NewKnowledgeEmptyState,
- NewKnowledgeLoadingState,
- NewKnowledgePageState,
-} from './states'
+import { NewKnowledgeEmptyState, NewKnowledgeLoadingState, NewKnowledgePageState } from './states'
const PAGE_SIZE = 30
const UPGRADE_DATASET_BATCH_SIZE = 50
@@ -419,7 +415,7 @@ export function NewKnowledgeList({
// Safari list semantics: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/list-style#accessibility
// oxlint-disable-next-line jsx-a11y/no-redundant-roles -- Dify's preflight removes list markers.
role="list"
- className={KNOWLEDGE_SPACE_GRID_CLASS_NAME}
+ className={cn('gap-2.5', MAIN_NAV_APP_CARD_GRID_CLASS_NAME)}
aria-label={t(($) => $.knowledge, { ns: 'dataset' })}
>
{pendingUpgradeCards.map((upgrade) => (
diff --git a/web/features/new-rag/list/states.tsx b/web/features/new-rag/list/states.tsx
index 363eab4e0a3..83333871fa8 100644
--- a/web/features/new-rag/list/states.tsx
+++ b/web/features/new-rag/list/states.tsx
@@ -6,6 +6,7 @@ import { useId } from 'react'
import { useTranslation } from 'react-i18next'
import CornerLabel from '@/app/components/base/corner-label'
import { SkeletonContainer, SkeletonRectangle } from '@/app/components/base/skeleton'
+import { MAIN_NAV_APP_CARD_GRID_CLASS_NAME } from '@/app/components/main-nav/app-card-grid'
import Link from '@/next/link'
import { newKnowledgeCreatePathWithStartMode } from '../routes'
@@ -22,22 +23,19 @@ const LOADING_CARD_IDS = [
const EMPTY_GHOST_CARD_IDS = Array.from({ length: 16 }, (_, index) => `empty-ghost-card-${index}`)
-export const KNOWLEDGE_SPACE_GRID_CLASS_NAME =
- 'grid grid-cols-[repeat(auto-fill,minmax(min(100%,296px),1fr))] gap-3'
-
export function NewKnowledgeLoadingState() {
const { t } = useTranslation(['common'])
return (
<div
- className={KNOWLEDGE_SPACE_GRID_CLASS_NAME}
+ className={cn('gap-2.5', MAIN_NAV_APP_CARD_GRID_CLASS_NAME)}
role="status"
aria-label={t(($) => $.loading, { ns: 'common' })}
>
{LOADING_CARD_IDS.map((id) => (
<div
key={id}
- className="h-41.5 rounded-xl border border-components-card-border bg-components-card-bg p-4 shadow-xs"
+ className="h-41.5 rounded-xl border-[0.5px] border-components-card-border bg-components-card-bg p-4 shadow-xs"
>
<SkeletonContainer className="h-full">
<div className="flex gap-3">
@@ -184,9 +182,11 @@ function ButtonOrLink({
function EmptyGhostGrid() {
return (
<div aria-hidden className="pointer-events-none absolute inset-0 z-0 overflow-hidden">
- <div className="absolute inset-x-8 inset-y-2 grid grid-cols-4 gap-3">
+ <div
+ className={cn('absolute inset-x-8 inset-y-2 gap-2.5', MAIN_NAV_APP_CARD_GRID_CLASS_NAME)}
+ >
{EMPTY_GHOST_CARD_IDS.map((id) => (
- <div key={id} className="h-52.25 rounded-xl bg-background-default-lighter opacity-75" />
+ <div key={id} className="h-41.5 rounded-xl bg-background-default-lighter opacity-75" />
))}
</div>
<div className="absolute inset-0 bg-linear-to-b from-background-body-transparent to-background-body" />