AgentEvalTool/frontend/web/src/components/SectionHeader.tsx
sinohqb 47804f2df3
All checks were successful
CI / test (push) Successful in 3m57s
refactor(ui): extract SectionHeader + drop deprecated CronPoolMonitor (audit P2)
UI/UX 盘点 P2 + 清理:
- 新增 SectionHeader 共享组件,替换 DecisionProcess/ConfigSnapshots(主列表+快照
  对比)/EvalReport 自管 header 的重复(返回+标题+右侧操作区)
- 删除已 DEPRECATED 的 CronPoolMonitor 页面及其测试(导航早已移除,监控职责
  已由 TaskQueueMonitor 承担)
tsc 0 错误 vitest 16 passed(CronPoolMonitor 3 测试随之删除)
2026-08-17 23:51:40 +08:00

30 lines
1.1 KiB
TypeScript

import { Button } from 'antd'
import { ArrowLeftOutlined } from '@ant-design/icons'
import type { ReactNode } from 'react'
import { colors } from '../tokens'
interface SectionHeaderProps {
title: ReactNode
/** 提供时显示"返回"按钮(子视图/抽屉 tab 环境可省)。 */
onBack?: () => void
/** 返回按钮文案(默认"返回")。 */
backLabel?: string
/** 右侧操作区(筛选/刷新/导出等)。 */
actions?: ReactNode
}
/**
* 内容区子视图的标准横排头部:可选返回按钮 + 标题 + 右侧操作区。
* 供智能评估等 Drawer/Tabs 内容组件复用,消除各自手写 header 的重复。
*/
export default function SectionHeader({ title, onBack, backLabel = '返回', actions }: SectionHeaderProps) {
return (
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 12 }}>
{onBack && <Button icon={<ArrowLeftOutlined />} onClick={onBack}>{backLabel}</Button>}
<span style={{ fontSize: 16, fontWeight: 600, color: colors.text }}>{title}</span>
<div style={{ flex: 1 }} />
{actions}
</div>
)
}