Farmbot-Web-App/frontend/sequences/step_tiles/tile_assertion.tsx

51 lines
1.5 KiB
TypeScript
Raw Normal View History

import { StepParams } from "../interfaces";
import React from "react";
2019-08-22 13:42:35 -06:00
import { Row, Col } from "../../ui";
import { StepHeader } from "../step_ui/step_header";
2019-08-22 11:35:01 -06:00
import { StepContent, StepWrapper } from "../step_ui";
2019-08-22 13:42:35 -06:00
import { TypePart } from "./tile_assertion/type_part";
import { LuaPart } from "./tile_assertion/lua_part";
import { SequencePart } from "./tile_assertion/sequence_part";
2019-08-23 08:21:18 -06:00
import { Assertion } from "farmbot/dist/corpus";
2020-04-28 08:18:04 -06:00
import { ToolTips } from "../../constants";
2019-08-23 08:21:18 -06:00
export interface AssertionStepProps extends StepParams {
currentStep: Assertion;
}
2019-09-09 10:10:08 -06:00
const CLASS_NAME = "assertion-step";
2019-08-22 11:35:01 -06:00
export function TileAssertion(props: StepParams) {
const step = props.currentStep;
if (step.kind !== "assertion") { throw new Error("Not an assertion"); }
2019-08-22 13:42:35 -06:00
const p = props as AssertionStepProps;
2019-08-22 11:35:01 -06:00
return <StepWrapper>
<StepHeader
className={CLASS_NAME}
2020-04-28 08:18:04 -06:00
helpText={ToolTips.ASSERTION}
2019-08-22 11:35:01 -06:00
currentSequence={p.currentSequence}
currentStep={p.currentStep}
dispatch={p.dispatch}
index={p.index}
confirmStepDeletion={props.confirmStepDeletion} />
<StepContent className={CLASS_NAME}>
<Row>
<Col xs={12}>
<LuaPart {...p} />
</Col>
</Row>
2019-09-09 10:10:08 -06:00
<Row>
<Col xs={6}>
2020-04-14 00:38:49 -06:00
<TypePart key={JSON.stringify(props.currentSequence)} {...p} />
2019-09-09 10:10:08 -06:00
</Col>
<Col xs={6}>
2020-04-14 00:38:49 -06:00
<SequencePart key={JSON.stringify(props.currentSequence)} {...p} />
2019-09-09 10:10:08 -06:00
</Col>
2019-08-22 11:35:01 -06:00
</Row>
</StepContent>
</StepWrapper>;
}