import clsx from 'clsx'; import React, { useMemo, useState } from 'react'; import { MonitorHealthBar } from './MonitorHealthBar'; export const MonitorListItem: React.FC<{ className?: string; workspaceId: string; monitorId: string; monitorName: string; onClick?: () => void; }> = React.memo((props) => { const { className, workspaceId, monitorId, monitorName, onClick } = props; const [beats, setBeats] = useState< ({ value: number; createdAt: string | Date; } | null)[] >([]); const upPercent = useMemo(() => { let up = 0; beats.forEach((b) => { if (!b) { return; } if (b.value >= 0) { up++; } }); return parseFloat(((up / beats.length) * 100).toFixed(1)); }, [beats]); return (