import * as React from "react"; import { BlurableInput, Row, Col, FBSelect, NULL_CHOICE, DropDownItem } from "../../ui/index"; import { SettingsMenuProps } from "./interfaces"; import { SPECIAL_VALUE_DDI, CALIBRATION_DROPDOWNS, ORIGIN_DROPDOWNS } from "./constants"; import { WD_ENV } from "./remote_env/interfaces"; import { envGet } from "./remote_env/selectors"; import { SPECIAL_VALUES } from "./remote_env/constants"; import { isNumber } from "lodash"; import { t } from "../../i18next_wrapper"; export class WeedDetectorConfig extends React.Component { NumberBox = ({ conf, label }: { conf: keyof WD_ENV; label: string; }) => { return
this.props.onChange(conf, parseFloat(e.currentTarget.value))} placeholder={label} />
; }; setDDI = (k: keyof WD_ENV) => (d: DropDownItem) => { if (isNumber(d.value)) { this.props.onChange(k, d.value); } else { throw new Error("Weed detector got a non-numeric value"); } }; find = (needle: keyof WD_ENV): DropDownItem => { const wow = envGet(needle, this.props.values); const ok = SPECIAL_VALUE_DDI[wow]; return ok || NULL_CHOICE; }; render() { return
this.props.onChange("CAMERA_CALIBRATION_invert_hue_selection", e.currentTarget.checked ? SPECIAL_VALUES.TRUE : SPECIAL_VALUES.FALSE)} />
; } }