import * as React from "react"; import { Row, Col, DropDownItem, FBSelect } from "../../../ui"; import { info } from "../../../toast/toast"; import { ColWidth } from "../farmbot_os_settings"; import { updateConfig } from "../../actions"; import { BoardTypeProps } from "./interfaces"; import { t } from "../../../i18next_wrapper"; import { FirmwareHardwareStatus } from "./firmware_hardware_status"; import { isFwHardwareValue, getFirmwareChoices, FIRMWARE_CHOICES_DDI, } from "../firmware_hardware_support"; import { Highlight } from "../maybe_highlight"; import { DeviceSetting } from "../../../constants"; import { DevSettings } from "../../../account/dev/dev_support"; interface BoardTypeState { sending: boolean } export class BoardType extends React.Component { state = { sending: this.sending }; UNSAFE_componentWillReceiveProps() { this.setState({ sending: this.sending }); } get sending() { return !this.props.sourceFbosConfig("firmware_hardware").consistent; } get selectedBoard(): DropDownItem | undefined { return this.props.firmwareHardware ? FIRMWARE_CHOICES_DDI[this.props.firmwareHardware] : undefined; } sendOffConfig = (selectedItem: DropDownItem) => { const firmware_hardware = selectedItem.value; if (selectedItem && isFwHardwareValue(firmware_hardware)) { info(t("Sending firmware configuration..."), t("Sending")); this.props.dispatch(updateConfig({ firmware_hardware })); this.setState({ sending: true }); this.forceUpdate(); } } FirmwareSelection = () => render() { const newFormat = DevSettings.futureFeaturesEnabled(); return {!newFormat && } {newFormat && } ; } }