feat: enhance dataset management features with improved tag handling, download functionality, and UI updates

This commit is contained in:
chenghh-9609
2025-10-23 10:33:42 +08:00
parent add6998601
commit a6d4b51601
10 changed files with 88 additions and 55 deletions

View File

@@ -1,4 +1,4 @@
import { Button, Input, Popover, theme, Tag } from "antd";
import { Button, Input, Popover, theme, Tag, Empty } from "antd";
import { PlusOutlined } from "@ant-design/icons";
import { useEffect, useMemo, useState } from "react";
@@ -70,24 +70,28 @@ export default function AddTagPopover({
</h4>
{/* Available Tags */}
<div className="space-y-2">
<h5 className="text-sm"></h5>
<div className="max-h-32 overflow-y-auto space-y-1">
{availableTags.map((tag) => (
<span
key={tag.id}
className="h-7 w-full justify-start text-xs cursor-pointer flex items-center px-2 rounded hover:bg-gray-100"
onClick={() => {
onAddTag?.(tag.name);
setShowPopover(false);
}}
>
<PlusOutlined className="w-3 h-3 mr-1" />
{tag.name}
</span>
))}
{availableTags?.length ? (
<div className="space-y-2">
<h5 className="text-sm"></h5>
<div className="max-h-32 overflow-y-auto space-y-1">
{availableTags.map((tag) => (
<span
key={tag.id}
className="h-7 w-full justify-start text-xs cursor-pointer flex items-center px-2 rounded hover:bg-gray-100"
onClick={() => {
onAddTag?.(tag.name);
setShowPopover(false);
}}
>
<PlusOutlined className="w-3 h-3 mr-1" />
{tag.name}
</span>
))}
</div>
</div>
</div>
) : (
<Empty description="没有可用标签,请先创建标签。" />
)}
{/* Create New Tag */}
<div className="space-y-2 border-t border-gray-100 pt-3">

View File

@@ -103,8 +103,8 @@ function DetailHeader<T>({
<Dropdown
key={op.key}
menu={{
items: op.items as ItemType[],
onClick: op.onMenuClick,
items: op?.items as ItemType[],
onClick: op?.onMenuClick,
}}
>
<Tooltip title={op.label}>
@@ -115,16 +115,7 @@ function DetailHeader<T>({
}
return (
<Tooltip key={op.key} title={op.label}>
<Button
key={op.key}
onClick={op.onClick}
className={
op.danger
? "text-red-600 border-red-200 bg-transparent"
: ""
}
icon={op.icon}
/>
<Button {...op} />
</Tooltip>
);
})}