import { Row, Col, FBSelect, DropDownItem } from "../../ui/index"; import { StepParams } from "../interfaces"; import { StepWrapper, StepHeader, StepContent } from "../step_ui/index"; import { ToolTips } from "../../constants"; import * as React from "react"; import { unpackStep } from "./mark_as/unpack_step"; import { ResourceUpdate } from "farmbot"; import { resourceList } from "./mark_as/resource_list"; import { actionList } from "./mark_as/action_list"; import { commitStepChanges } from "./mark_as/commit_step_changes"; import { t } from "../../i18next_wrapper"; interface MarkAsState { nextResource: DropDownItem | undefined } const NONE = (): DropDownItem => ({ label: t("Select one"), value: 0 }); export class MarkAs extends React.Component { state: MarkAsState = { nextResource: undefined }; className = "resource-update-step"; commitSelection = (nextAction: DropDownItem) => { this.props.dispatch(commitStepChanges({ index: this.props.index, nextAction, nextResource: this.state.nextResource, sequence: this.props.currentSequence, step: this.props.currentStep as ResourceUpdate, })); this.setState({ nextResource: undefined }); }; render() { const step = this.props.currentStep as ResourceUpdate; const { rightSide, leftSide } = unpackStep({ step, resourceIndex: this.props.resources }); return this.setState({ nextResource })} allowEmpty={false} selectedItem={this.state.nextResource || leftSide} /> ; } }