import React from "react"; import styles from "../App.module.css"; import cx from "../utils/cx"; import Feature from "./Feature"; import Spinner from "./Spinner"; import LabelButton from "./LabelButton"; import Contributions from "./Contributions"; import { VisualizationOutput } from "../models/visualizationOutput"; interface VisualizationProps { data: VisualizationOutput; instance: number; onTargetClick: ( labelIndex: number, inputIndex: number, modelIndex: number, callback: () => void ) => void; } interface VisualizationState { loading: boolean; } class Visualization extends React.Component< VisualizationProps, VisualizationState > { constructor(props: VisualizationProps) { super(props); this.state = { loading: false, }; } onTargetClick = ( labelIndex: number, inputIndex: number, modelIndex: number ) => { this.setState({ loading: true }); this.props.onTargetClick(labelIndex, inputIndex, modelIndex, () => this.setState({ loading: false }) ); }; //TODO: Refactor the visualization table as a