// jshint esversion: 6 import { connect } from "react-redux"; import React from "react"; import * as globals from "../../globals"; import actions from "../../actions"; @connect(state => { return { categoricalAsBooleansMap: state.controls.categoricalAsBooleansMap, colorScale: state.controls.colorScale, colorAccessor: state.controls.colorAccessor }; }) class CategoryValue extends React.Component { toggleOff() { this.props.dispatch({ type: "categorical metadata filter deselect", metadataField: this.props.metadataField, value: this.props.value }); } toggleOn() { this.props.dispatch({ type: "categorical metadata filter select", metadataField: this.props.metadataField, value: this.props.value }); } render() { if (!this.props.categoricalAsBooleansMap) return null; const selected = this.props.categoricalAsBooleansMap[ this.props.metadataField ][this.props.value]; const c = this.props.metadataField === this.props .colorAccessor; /* this is the color scale, so add swatches below */ return (

{this.props.value}

{this.props.count}

); } } export default CategoryValue; // toggleOnlyThis() { // this.props.dispatch({ // type: "categorical metadata filter none of these", // metadataField: this.props.metadataField, // value: this.props.value // }) // } // // {"only"} // // onClick={selected ? this.toggleOff.bind(this) : this.toggleOn.bind(this)} // toggleOn() { // this.props.dispatch( // actions.attemptCategoricalMetadataSelection( // this.props.metadataField, // this.props.value // )) // } // toggleOff() { // this.props.dispatch( // actions.attemptCategoricalMetadataDeselection( // this.props.metadataField, // this.props.value // )) // }