status.ts 1.45 KB
import {
  CheckCircle2,
  Clock,
  Loader2,
  XCircle,
  Ban,
  Code2,
  Layers,
  FileBarChart2,
  type LucideIcon,
} from 'lucide-react';
import type { JobStatus, ValidationMode } from './types';

export type Tone =
  | 'brand'
  | 'neutral'
  | 'success'
  | 'warning'
  | 'danger'
  | 'info';

export const statusMeta: Record<
  JobStatus,
  { label: string; tone: Tone; icon: LucideIcon; spin?: boolean }
> = {
  queued: { label: '排队中', tone: 'neutral', icon: Clock },
  running: { label: '生成中', tone: 'info', icon: Loader2, spin: true },
  done: { label: '已完成', tone: 'success', icon: CheckCircle2 },
  cancelled: { label: '已取消', tone: 'neutral', icon: Ban },
  error: { label: '失败', tone: 'danger', icon: XCircle },
};

export const modeMeta: Record<
  ValidationMode,
  { label: string; short: string; desc: string; icon: LucideIcon; tone: Tone }
> = {
  code: {
    label: '仅代码',
    short: 'Code',
    desc: 'Figma → React 代码,最快交付',
    icon: Code2,
    tone: 'brand',
  },
  full: {
    label: '完整流程',
    short: 'Full',
    desc: '代码 + 自动化校验与自修复',
    icon: Layers,
    tone: 'info',
  },
  'with-report': {
    label: '带报告',
    short: 'Report',
    desc: '完整流程并产出可视化报告',
    icon: FileBarChart2,
    tone: 'warning',
  },
};

export const modeLabel: Record<ValidationMode, string> = {
  full: '完整流程',
  code: '仅代码',
  'with-report': '带报告',
};