diagnosis-result.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { CheckCircle, XCircle, Loader2 } from "lucide-react";
  2. import { useEffect } from "react";
  3. export const checks = [
  4. { label: "VRM", key: "vrm" },
  5. { label: "LLM", key: "chatbot" },
  6. { label: "TTS", key: "tts" },
  7. { label: "STT", key: "stt" },
  8. { label: "Vision", key: "vision" },
  9. { label: "AmicaLife", key: "amicaLife" },
  10. ] as const;
  11. export type CheckKey = typeof checks[number]["key"];
  12. export type Status = { status: "idle" | "loading" | "pass" | "fail", score: number };
  13. export type DiagnosisResultType = {
  14. [key in CheckKey]: Status;
  15. } & {
  16. overall?: string;
  17. };
  18. interface DiagnosisResultProps {
  19. label: string;
  20. status: Status;
  21. }
  22. export const DiagnosisResult = ({ label, status }: DiagnosisResultProps) => {
  23. const statusIcon = {
  24. pass: <CheckCircle className="text-green-500" size={20} />,
  25. fail: <XCircle className="text-red-500" size={20} />,
  26. loading: <Loader2 className="animate-spin text-gray-400" size={20} />,
  27. idle: <div className="w-5 h-5 rounded-full bg-gray-200" />,
  28. };
  29. const statusColor = {
  30. pass: "text-green-600",
  31. fail: "text-red-600",
  32. loading: "text-gray-500",
  33. idle: "text-gray-400",
  34. };
  35. return (
  36. <div className="flex items-center gap-3 bg-gray-50 border border-gray-100 p-4 rounded-xl shadow-sm">
  37. {statusIcon[status.status]}
  38. <div className="justify-between">
  39. {/* Label and status */}
  40. <div className="flex flex-col">
  41. <span className="font-medium text-sm text-gray-700">{label}</span>
  42. <span className={`text-xs ${statusColor[status.status]}`}>
  43. {status.status === "idle" ? "Not checked" : status.score >= 0 ? `Score: ${status.score}` : "N/A"}
  44. </span>
  45. </div>
  46. {/* Each evaluation criteria */}
  47. <div className="flex flex-col">
  48. </div>
  49. </div>
  50. </div>
  51. );
  52. };