From 094eae3cf52302f7d50b6976b4637c1ab650de5b Mon Sep 17 00:00:00 2001 From: Jimmy Ben Klieve Date: Fri, 6 Mar 2026 21:13:14 +0800 Subject: [PATCH] refactor(ui): adjust dataset page styles (#13452) ### What problem does this PR solve? - Adjust UI styles in **Dataset** pages. - Adjust several shared components styles - Modify files and directory structure in `src/layouts` ### Type of change - [x] Refactoring --- web/src/components/bulk-operate-bar.tsx | 108 ++++++------ .../dynamic-page-range.tsx | 22 ++- .../components/chunk-method-dialog/index.tsx | 91 +++++----- web/src/components/empty/empty.tsx | 19 ++- web/src/components/empty/interface.ts | 2 +- web/src/components/home-card.tsx | 83 +++++---- web/src/components/list-filter-bar/index.tsx | 6 +- web/src/components/more-button.tsx | 6 +- web/src/components/ragflow-avatar.tsx | 93 ++++------- web/src/components/svg-icon.tsx | 4 +- .../admin => }/components/theme-switch.tsx | 0 web/src/components/theme-toggle.tsx | 48 ------ web/src/components/ui/avatar.tsx | 2 +- web/src/components/ui/button.tsx | 14 +- web/src/components/ui/card.tsx | 34 ++-- web/src/components/ui/dialog.tsx | 7 +- web/src/components/ui/hover-card.tsx | 8 +- web/src/components/ui/radio.tsx | 37 +++- web/src/components/ui/segmented.tsx | 13 +- .../layouts/{ => components}/bell-button.tsx | 0 .../{ => components}/global-navbar.tsx | 0 .../header.tsx} | 0 .../{ => components}/page-container.tsx | 2 +- .../layouts/{ => components}/theme-button.tsx | 0 web/src/layouts/{next.tsx => root-layout.tsx} | 10 +- web/src/locales/en.ts | 3 +- .../pages/admin/layouts/navigation-layout.tsx | 2 +- web/src/pages/admin/login.tsx | 2 +- .../dataset/dataset/dataset-action-cell.tsx | 38 ++--- .../dataset/generate-button/generate.tsx | 38 +++-- web/src/pages/dataset/dataset/index.tsx | 42 +++-- .../pages/dataset/dataset/parsing-card.tsx | 5 +- .../dataset/dataset/parsing-status-cell.tsx | 158 +++++++++--------- .../dataset/use-bulk-operate-dataset.tsx | 24 +-- .../dataset/use-dataset-table-columns.tsx | 81 ++++++--- web/src/pages/datasets/dataset-card.tsx | 2 +- web/src/pages/home/application-card.tsx | 15 +- web/src/pages/home/applications.tsx | 34 ++-- web/src/pages/home/banner.tsx | 8 +- web/src/pages/home/datasets.tsx | 34 ++-- web/src/pages/home/index.tsx | 14 +- web/src/pages/next-chats/chat/index.tsx | 6 +- web/src/pages/user-setting/sidebar/index.tsx | 13 +- web/src/routes.tsx | 4 +- 44 files changed, 589 insertions(+), 543 deletions(-) rename web/src/{pages/admin => }/components/theme-switch.tsx (100%) delete mode 100644 web/src/components/theme-toggle.tsx rename web/src/layouts/{ => components}/bell-button.tsx (100%) rename web/src/layouts/{ => components}/global-navbar.tsx (100%) rename web/src/layouts/{next-header.tsx => components/header.tsx} (100%) rename web/src/layouts/{ => components}/page-container.tsx (81%) rename web/src/layouts/{ => components}/theme-button.tsx (100%) rename web/src/layouts/{next.tsx => root-layout.tsx} (60%) diff --git a/web/src/components/bulk-operate-bar.tsx b/web/src/components/bulk-operate-bar.tsx index ea71b50525..6c9ceaf2c1 100644 --- a/web/src/components/bulk-operate-bar.tsx +++ b/web/src/components/bulk-operate-bar.tsx @@ -1,8 +1,7 @@ import { Button } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; -import { cn } from '@/lib/utils'; import { BrushCleaning } from 'lucide-react'; -import { ReactNode, useCallback } from 'react'; +import { ReactNode, useId } from 'react'; import { useTranslation } from 'react-i18next'; import { ConfirmDeleteDialog, @@ -30,58 +29,69 @@ export function BulkOperateBar({ className, unit, }: BulkOperateBarProps) { - const isDeleteItem = useCallback((id: string) => { - return id === 'delete'; - }, []); const { t } = useTranslation(); + const ariaDescriptionId = useId(); return ( - - -
- - {t('common.selected')}: {count}{' '} - {unit ?? t('knowledgeDetails.files')} - - -
- + + +

+ {t('common.selected')}: {count} {unit ?? t('knowledgeDetails.files')} + +

+ + +
    - {list.map((x) => ( -
  • - -
  • - ))} + {x.icon} {x.label} + + ); + + return ( +
  • + {isDeleteItem ? ( + + ), + }} + > + {buttonEl} + + ) : ( + buttonEl + )} +
  • + ); + })}
diff --git a/web/src/components/chunk-method-dialog/dynamic-page-range.tsx b/web/src/components/chunk-method-dialog/dynamic-page-range.tsx index 0e9863b13f..6775d38a26 100644 --- a/web/src/components/chunk-method-dialog/dynamic-page-range.tsx +++ b/web/src/components/chunk-method-dialog/dynamic-page-range.tsx @@ -10,7 +10,7 @@ import { FormMessage, } from '@/components/ui/form'; import { Input } from '@/components/ui/input'; -import { Plus, X } from 'lucide-react'; +import { LucidePlus, LucideTrash2 } from 'lucide-react'; import { useFieldArray, useFormContext } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import { Separator } from '../ui/separator'; @@ -51,7 +51,9 @@ export function DynamicPageRange() { )} /> + + )} /> - ); })} + diff --git a/web/src/components/chunk-method-dialog/index.tsx b/web/src/components/chunk-method-dialog/index.tsx index a4291eea71..c845fda35e 100644 --- a/web/src/components/chunk-method-dialog/index.tsx +++ b/web/src/components/chunk-method-dialog/index.tsx @@ -42,7 +42,6 @@ import { DataFlowSelect } from '../data-pipeline-select'; import { DelimiterFormField } from '../delimiter-form-field'; import { EntityTypesFormField } from '../entity-types-form-field'; import { ExcelToHtmlFormField } from '../excel-to-html-form-field'; -import { FormContainer } from '../form-container'; import { LayoutRecognizeFormField } from '../layout-recognize-form-field'; import { MaxTokenNumberFormField } from '../max-token-number-from-field'; import { MinerUOptionsFormField } from '../mineru-options-form-field'; @@ -293,22 +292,16 @@ export function ChunkMethodDialog({ {t('knowledgeDetails.chunkMethod')} +
- +
- {parseType === 1 && } - {parseType === 2 && ( - - )} + {parseType === 1 && } {/* )} /> */} - {showPages && parseType === 1 && ( - - )} + + {showPages && parseType === 1 && } + {showPages && parseType === 1 && layoutRecognize && ( - + )} /> )} - +
+ {parseType === 1 && ( <> - +
{showOne && ( <> {isMineruSelected && } )} + {showMaxTokenNumber && ( <> - + /> + )} - - +
+ +
{selectedTag === DocumentParserType.Naive && ( <> )} + {showAutoKeywords(selectedTag) && ( <> )} + {showExcelToHtml && ( )} - +
{/* {showRaptorParseConfiguration( - selectedTag as DocumentParserType, - ) && ( - - - - )} */} - {/* {showGraphRagItems(selectedTag as DocumentParserType) && - useGraphRag && ( + selectedTag as DocumentParserType, + ) && ( - + )} */} - {showEntityTypes && ( - - )} + {/* {showGraphRagItems(selectedTag as DocumentParserType) && + useGraphRag && ( + + + + )} */} +
+ {showEntityTypes && } +
)} + +
+ {parseType === 2 && ( + + )} +
diff --git a/web/src/components/empty/empty.tsx b/web/src/components/empty/empty.tsx index fbb97506f6..f9f54b460f 100644 --- a/web/src/components/empty/empty.tsx +++ b/web/src/components/empty/empty.tsx @@ -53,22 +53,24 @@ const Empty = (props: EmptyProps) => { export default Empty; export const EmptyCard = (props: EmptyCardProps) => { - const { icon, className, children, title, description, style } = props; + const { icon, className, children, title, description, style, ...restProps } = + props; return ( -
{icon} - {title &&
{title}
} + {title &&
{title}
} {description && ( -
{description}
+

{description}

)} {children} -
+ ); }; @@ -104,11 +106,14 @@ export const EmptyAppCard = (props: { break; } return ( -
+
diff --git a/web/src/components/empty/interface.ts b/web/src/components/empty/interface.ts index 73fef1d606..87b7531289 100644 --- a/web/src/components/empty/interface.ts +++ b/web/src/components/empty/interface.ts @@ -15,4 +15,4 @@ export type EmptyCardProps = { title?: string; description?: string; style?: React.CSSProperties; -}; +} & Omit, 'title'>; diff --git a/web/src/components/home-card.tsx b/web/src/components/home-card.tsx index d8ec97d749..7320960b95 100644 --- a/web/src/components/home-card.tsx +++ b/web/src/components/home-card.tsx @@ -1,5 +1,5 @@ import { RAGFlowAvatar } from '@/components/ragflow-avatar'; -import { Card, CardContent } from '@/components/ui/card'; +import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { formatDate } from '@/utils/date'; import { ReactNode } from 'react'; @@ -26,48 +26,61 @@ export function HomeCard({ }: IProps) { return ( { // navigateToSearch(data?.id); onClick?.(); }} + tabIndex={0} + className="px-2.5 py-4 flex gap-2 items-start group h-full w-full hover:shadow-md" > - -
- -
-
-
-
-
- {data.name} -
- {icon} -
- {moreDropdown} -
+
+ +
-
-
- {data.description} -
-
-

- {formatDate(data.update_time)} -

- {sharedBadge} -
-
-
-
+
+ + +

+ {data.name} +

+ + {icon} +
+ +
{moreDropdown}
+
+ + +
+
+ +
+
+ {data.description} +
+
+

+ {formatDate(data.update_time)} +

+ {sharedBadge} +
+
+
+
+
); } diff --git a/web/src/components/list-filter-bar/index.tsx b/web/src/components/list-filter-bar/index.tsx index 3ee505220b..e0b69a2353 100644 --- a/web/src/components/list-filter-bar/index.tsx +++ b/web/src/components/list-filter-bar/index.tsx @@ -91,7 +91,7 @@ export default function ListFilterBar({ }, [value]); return ( -
+
{typeof icon === 'string' ? ( // @@ -101,7 +101,8 @@ export default function ListFilterBar({ )} {leftPanel || title}
-
+ +
{preChildren} {showFilter && ( {children}
diff --git a/web/src/components/more-button.tsx b/web/src/components/more-button.tsx index d9234a71a9..a73dad2eb8 100644 --- a/web/src/components/more-button.tsx +++ b/web/src/components/more-button.tsx @@ -9,10 +9,10 @@ export const MoreButton = React.forwardRef( - ); -}; - -export default ThemeToggle; diff --git a/web/src/components/ui/avatar.tsx b/web/src/components/ui/avatar.tsx index 9b47c4ecd6..567b9e0062 100644 --- a/web/src/components/ui/avatar.tsx +++ b/web/src/components/ui/avatar.tsx @@ -39,7 +39,7 @@ const AvatarFallback = React.forwardRef< ; + export type ButtonProps = { asChild?: boolean; asLink?: boolean; @@ -114,7 +120,7 @@ export type ButtonProps = { block?: boolean; disabled?: boolean; dot?: boolean; -} & VariantProps & +} & ButtonVariants & (IsAnchor extends true ? LinkProps : React.ButtonHTMLAttributes); @@ -144,7 +150,7 @@ const Button = React.forwardRef( ->(({ className, ...props }, ref) => ( -
& { as?: React.ElementType } +>(({ as: As = 'div', className, ...props }, ref) => ( + ->(({ className, ...props }, ref) => ( -
& { as?: React.ElementType } +>(({ as: As = 'div', className, ...props }, ref) => ( + & { as?: React.ElementType } ->(({ className, as: As = 'div', ...props }, ref) => ( +>(({ as: As = 'div', className, ...props }, ref) => ( ->(({ className, ...props }, ref) => ( -
& { as?: React.ElementType } +>(({ as: As = 'div', className, ...props }, ref) => ( + ->(({ className, ...props }, ref) => ( -
& { as?: React.ElementType } +>(({ as: As = 'div', className, ...props }, ref) => ( + ->(({ className, ...props }, ref) => ( -
& { as?: React.ElementType } +>(({ as: As = 'div', className, ...props }, ref) => ( + void; disabled?: boolean; @@ -50,30 +51,46 @@ function Radio({ return (
diff --git a/web/src/routes.tsx b/web/src/routes.tsx index 5bad48793c..fb57d93e53 100644 --- a/web/src/routes.tsx +++ b/web/src/routes.tsx @@ -146,7 +146,7 @@ const routeConfigOptions = [ { path: Routes.Root, layout: false, - Component: () => import('@/layouts/next'), + Component: () => import('@/layouts/root-layout'), loader: ({ request }) => { const url = new URL(request.url); const auth = url.searchParams.get('auth'); @@ -170,7 +170,7 @@ const routeConfigOptions = [ }, { path: Routes.Root, - Component: () => import('@/layouts/next'), + Component: () => import('@/layouts/root-layout'), children: [ { path: Routes.Datasets,