Feature (web): Optimize dataset pages and segmented components #3221 (#9605)

### What problem does this PR solve?

Feature (web): Optimize dataset pages and segmented components #3221
-Add the activeClassName property to Segmented components to customize
the selected state style
-Update the icons and captions of the relevant components on the dataset
page
-Modify the parsing status column title of the dataset table
-Optimize the Segmented component style of the homepage application
section

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
chanx
2025-08-21 09:32:04 +08:00
committed by GitHub
parent 09570c7eef
commit 4080f6a54a
5 changed files with 14 additions and 8 deletions

View File

@ -23,6 +23,7 @@ export interface SegmentedProps
prefixCls?: string; prefixCls?: string;
direction?: 'ltr' | 'rtl'; direction?: 'ltr' | 'rtl';
motionName?: string; motionName?: string;
activeClassName?: string;
} }
export function Segmented({ export function Segmented({
@ -30,6 +31,7 @@ export function Segmented({
value, value,
onChange, onChange,
className, className,
activeClassName,
}: SegmentedProps) { }: SegmentedProps) {
const [selectedValue, setSelectedValue] = React.useState< const [selectedValue, setSelectedValue] = React.useState<
SegmentedValue | undefined SegmentedValue | undefined
@ -60,6 +62,9 @@ export function Segmented({
'text-bg-base bg-metallic-gradient border-b-[#00BEB4] border-b-2': 'text-bg-base bg-metallic-gradient border-b-[#00BEB4] border-b-2':
selectedValue === actualValue, selectedValue === actualValue,
}, },
activeClassName && selectedValue === actualValue
? activeClassName
: '',
)} )}
onClick={() => handleOnChange(actualValue)} onClick={() => handleOnChange(actualValue)}
> >

View File

@ -70,7 +70,7 @@ export default {
review: 'from 500+ reviews', review: 'from 500+ reviews',
}, },
header: { header: {
knowledgeBase: 'Knowledge Base', knowledgeBase: 'Dataset',
chat: 'Chat', chat: 'Chat',
register: 'Register', register: 'Register',
signin: 'Sign in', signin: 'Sign in',
@ -86,7 +86,7 @@ export default {
knowledgeList: { knowledgeList: {
welcome: 'Welcome back', welcome: 'Welcome back',
description: 'Which knowledge bases will you use today?', description: 'Which knowledge bases will you use today?',
createKnowledgeBase: 'Create knowledge base', createKnowledgeBase: 'Create Dataset',
name: 'Name', name: 'Name',
namePlaceholder: 'Please input name!', namePlaceholder: 'Please input name!',
doc: 'Docs', doc: 'Docs',

View File

@ -11,7 +11,7 @@ import { IDocumentInfo } from '@/interfaces/database/document';
import { formatFileSize } from '@/utils/common-util'; import { formatFileSize } from '@/utils/common-util';
import { formatDate } from '@/utils/date'; import { formatDate } from '@/utils/date';
import { downloadDocument } from '@/utils/file-util'; import { downloadDocument } from '@/utils/file-util';
import { ArrowDownToLine, FolderPen, ScrollText, Trash2 } from 'lucide-react'; import { Download, Eye, PenLine, Trash2 } from 'lucide-react';
import { useCallback } from 'react'; import { useCallback } from 'react';
import { UseRenameDocumentShowType } from './use-rename-document'; import { UseRenameDocumentShowType } from './use-rename-document';
import { isParserRunning } from './utils'; import { isParserRunning } from './utils';
@ -57,12 +57,12 @@ export function DatasetActionCell({
disabled={isRunning} disabled={isRunning}
onClick={handleRename} onClick={handleRename}
> >
<FolderPen /> <PenLine />
</Button> </Button>
<HoverCard> <HoverCard>
<HoverCardTrigger> <HoverCardTrigger>
<Button variant="ghost" disabled={isRunning} size={'sm'}> <Button variant="ghost" disabled={isRunning} size={'sm'}>
<ScrollText /> <Eye />
</Button> </Button>
</HoverCardTrigger> </HoverCardTrigger>
<HoverCardContent className="w-[40vw] max-h-[40vh] overflow-auto"> <HoverCardContent className="w-[40vw] max-h-[40vh] overflow-auto">
@ -93,7 +93,7 @@ export function DatasetActionCell({
disabled={isRunning} disabled={isRunning}
size={'sm'} size={'sm'}
> >
<ArrowDownToLine /> <Download />
</Button> </Button>
)} )}
<ConfirmDeleteDialog onOk={handleRemove}> <ConfirmDeleteDialog onOk={handleRemove}>

View File

@ -141,7 +141,7 @@ export function useDatasetTableColumns({
}, },
{ {
accessorKey: 'run', accessorKey: 'run',
header: t('parsingStatus'), header: t('Parse'),
// meta: { cellClassName: 'min-w-[20vw]' }, // meta: { cellClassName: 'min-w-[20vw]' },
cell: ({ row }) => { cell: ({ row }) => {
return ( return (

View File

@ -51,7 +51,8 @@ export function Applications() {
options={options} options={options}
value={val} value={val}
onChange={handleChange} onChange={handleChange}
className="bg-transparent" className="bg-bg-card border border-border-button rounded-full"
activeClassName="bg-text-primary border-none"
></Segmented> ></Segmented>
</div> </div>
<div className="flex flex-wrap gap-4"> <div className="flex flex-wrap gap-4">