From f593b610ec94af71cae895488ec277ea12432122 Mon Sep 17 00:00:00 2001 From: huangzhuang_3rd Date: Wed, 12 Aug 2026 13:31:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20AI=20Worker=20=E5=B9=B3=E5=8F=B0=20MVP?= =?UTF-8?q?=20v1.0.0=20-=20=E5=A4=9A=E7=A7=9F=E6=88=B7/=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86/AI=20Worker/=E4=BB=BB=E5=8A=A1=E7=BC=96?= =?UTF-8?q?=E6=8E=92/HITL=E5=AE=A1=E6=A0=B8/=E6=88=90=E6=9C=AC=E6=B2=BB?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/constants.tsx | 75 +++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 frontend/src/components/constants.tsx diff --git a/frontend/src/components/constants.tsx b/frontend/src/components/constants.tsx new file mode 100644 index 0000000..e3dbe9f --- /dev/null +++ b/frontend/src/components/constants.tsx @@ -0,0 +1,75 @@ +import type { TaskStatus, ProjectStatus, TaskPriority } from '@/types'; +import { Tag } from 'antd'; +import type { ReactNode } from 'react'; + +export const taskStatusConfig: Record< + TaskStatus, + { label: string; color: string; tagColor: string } +> = { + pending: { label: '待处理', color: '#8c8c8c', tagColor: 'default' }, + assigned: { label: '已分配', color: '#1677ff', tagColor: 'blue' }, + in_progress: { label: '进行中', color: '#fa8c16', tagColor: 'orange' }, + review: { label: '待审核', color: '#722ed1', tagColor: 'purple' }, + done: { label: '已完成', color: '#52c41a', tagColor: 'green' }, + rejected: { label: '已拒绝', color: '#f5222d', tagColor: 'red' }, + cancelled: { label: '已取消', color: '#8c8c8c', tagColor: 'default' }, +}; + +export const taskStatusList: TaskStatus[] = [ + 'pending', + 'assigned', + 'in_progress', + 'review', + 'done', + 'rejected', + 'cancelled', +]; + +export const projectStatusConfig: Record< + ProjectStatus, + { label: string; color: string } +> = { + planning: { label: '规划中', color: 'default' }, + active: { label: '进行中', color: 'processing' }, + paused: { label: '已暂停', color: 'warning' }, + completed: { label: '已完成', color: 'success' }, + cancelled: { label: '已取消', color: 'error' }, +}; + +export const priorityConfig: Record = { + low: { label: '低', color: 'default' }, + medium: { label: '中', color: 'blue' }, + high: { label: '高', color: 'orange' }, + urgent: { label: '紧急', color: 'red' }, +}; + +export function TaskStatusTag({ status }: { status: TaskStatus }) { + const cfg = taskStatusConfig[status]; + return {cfg.label}; +} + +export function ProjectStatusTag({ status }: { status: ProjectStatus }) { + const cfg = projectStatusConfig[status]; + return {cfg.label}; +} + +export function PriorityTag({ priority }: { priority: TaskPriority }) { + const cfg = priorityConfig[priority]; + return {cfg.label}; +} + +export function StatusDot({ status }: { status: TaskStatus }): ReactNode { + const cfg = taskStatusConfig[status]; + return ( + + ); +}