goalStatus.ts 711 B

123456789101112131415161718192021222324252627282930313233
  1. import type { Goal } from "../../types/goal";
  2. export type GoalStatusPresentation = {
  3. label: string;
  4. fill: string;
  5. stroke: string;
  6. text: string;
  7. };
  8. const PRESENTATIONS: Partial<Record<Goal["status"], GoalStatusPresentation>> = {
  9. waiting_children: {
  10. label: "等待子任务",
  11. fill: "#fffbeb",
  12. stroke: "#f59e0b",
  13. text: "#92400e",
  14. },
  15. pending_review: {
  16. label: "待审核",
  17. fill: "#f5f3ff",
  18. stroke: "#8b5cf6",
  19. text: "#6d28d9",
  20. },
  21. failed: {
  22. label: "失败",
  23. fill: "#fef2f2",
  24. stroke: "#ef4444",
  25. text: "#b91c1c",
  26. },
  27. };
  28. export const goalStatusPresentation = (
  29. status: Goal["status"],
  30. ): GoalStatusPresentation | undefined => PRESENTATIONS[status];