StatusBadge.tsx 837 B

1234567891011121314151617181920212223242526272829
  1. import { Circle, Database, FileJson } from "lucide-react";
  2. import type { DataOrigin } from "@/lib/api/types";
  3. import { statusLabel } from "@/lib/status/status";
  4. export function StatusBadge({ status }: { status: unknown }) {
  5. const value = String(status || "unknown");
  6. return (
  7. <span className={`badge ${value}`}>
  8. <Circle size={10} fill="currentColor" />
  9. {statusLabel(value)}
  10. </span>
  11. );
  12. }
  13. export function DataOriginBadge({ origin }: { origin: DataOrigin | string }) {
  14. const label =
  15. origin === "production_db"
  16. ? "生产事实"
  17. : origin === "mixed_with_runtime_export"
  18. ? "混合回放"
  19. : "回放导出";
  20. const Icon = origin === "production_db" ? Database : FileJson;
  21. return (
  22. <span className={`badge ${origin}`}>
  23. <Icon size={13} />
  24. {label}
  25. </span>
  26. );
  27. }