All files / src/pages/flowsheet-page/flowsheet/Diagnostics DiagnosticsIcon.tsx

84.21% Statements 16/19
71.42% Branches 5/7
100% Functions 1/1
92.3% Lines 12/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29          2066x 2066x   2066x 94x     2160x 2160x   2066x     100x 100x       2166x 2066x 2166x      
import { Stethoscope } from "lucide-react";
import { Badge } from "@/ahuora-design-system/ui/badge";
import { useDiagnosticsEvaluateFlowsheetPropertyRulesQuery } from "@/api/apiStore.gen";
import { useProjectId } from "../../../../hooks/project";
 
export function DiagnosticsIcon(props) {
  const flowsheetId = useProjectId();
 
  const { data } = useDiagnosticsEvaluateFlowsheetPropertyRulesQuery(
    {
      flowsheetId,
      flowsheet: flowsheetId,
    },
    { skip: !flowsheetId },
  );
  const num_findings = data?.findings?.length ?? 0;
 
  return (
    <div>
      {num_findings > 0 && (
        <Badge size="xs" variant="pending">
          {num_findings}
        </Badge>
      )}
      <Stethoscope className="icon-ls" />
    </div>
  );
}