- consoles/admin/ → layouts/admin-layout/ - consoles/workbench/ → layouts/workbench-layout/ + features/chat/ - pages/ → features/ (dashboard, models, projects, not-found) - components/ → shared/components/ - hooks/ → shared/hooks/ - utils/ → shared/utils/ - 更新所有 import 路径 (src/web/ + tests/web/) - 更新开发文档 (README.md, frontend.md, architecture.md)
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import { PlusOutlined } from "@ant-design/icons";
|
|
import { Button, Flex, Input, Space, Tabs } from "antd";
|
|
import { useState } from "react";
|
|
|
|
import type { ProjectStatus } from "../../../../shared/api";
|
|
|
|
interface ProjectToolbarProps {
|
|
activeTab: ProjectStatus;
|
|
keyword: string;
|
|
onSearch: (value: string) => void;
|
|
onSearchClear: () => void;
|
|
onTabChange: (key: string) => void;
|
|
openCreateDialog: () => void;
|
|
}
|
|
|
|
const STATUS_TAB_ITEMS = [
|
|
{ key: "active", label: "进行中" },
|
|
{ key: "archived", label: "已归档" },
|
|
];
|
|
|
|
export function ProjectToolbar({
|
|
activeTab,
|
|
keyword,
|
|
onSearch,
|
|
onSearchClear,
|
|
onTabChange,
|
|
openCreateDialog,
|
|
}: ProjectToolbarProps) {
|
|
const [draftKeyword, setDraftKeyword] = useState(keyword);
|
|
|
|
return (
|
|
<Flex align="center" gap="large" justify="space-between" wrap="wrap">
|
|
<Tabs activeKey={activeTab} items={STATUS_TAB_ITEMS} onChange={onTabChange} />
|
|
<Space size="small">
|
|
<Input.Search
|
|
allowClear
|
|
enterButton="搜索"
|
|
onChange={(event) => setDraftKeyword(event.target.value)}
|
|
onClear={() => {
|
|
setDraftKeyword("");
|
|
onSearchClear();
|
|
}}
|
|
onSearch={(value) => onSearch(value)}
|
|
placeholder="搜索名称或描述"
|
|
value={draftKeyword}
|
|
/>
|
|
{activeTab === "active" && (
|
|
<Button icon={<PlusOutlined />} onClick={openCreateDialog} type="primary">
|
|
新建项目
|
|
</Button>
|
|
)}
|
|
</Space>
|
|
</Flex>
|
|
);
|
|
}
|