import clsx from "clsx"; import {useEffect, useState} from "react"; import useFlowStore from "../VisProgStores.tsx"; import { warningSummary, type WarningSeverity, type EditorWarning } from "./EditorWarnings.tsx"; import styles from "./WarningSidebar.module.css"; export function WarningsSidebar() { const warnings = useFlowStore.getState().getWarnings(); const [severityFilter, setSeverityFilter] = useState('ALL'); useEffect(() => {}, [warnings]); const filtered = severityFilter === 'ALL' ? warnings : warnings.filter(w => w.severity === severityFilter); return ( ); } function WarningsHeader({ severityFilter, onChange, }: { severityFilter: WarningSeverity | 'ALL'; onChange: (severity: WarningSeverity | 'ALL') => void; }) { const summary = warningSummary(); return (

Warnings

{(['ALL', 'ERROR', 'WARNING', 'INFO'] as const).map(severity => ( ))}
); } function WarningsList(props: { warnings: EditorWarning[] }) { if (props.warnings.length === 0) { return (
No warnings!
) } return (
{props.warnings.map((warning) => ( ))}
); } function WarningListItem(props: { warning: EditorWarning }) { return (
{props.warning.description}
{props.warning.scope.id} {props.warning.scope.handleId && ( @{props.warning.scope.handleId} )}
); }