2017-06-29 12:54:02 -06:00
|
|
|
import * as React from "react";
|
2019-04-02 13:59:37 -06:00
|
|
|
|
2017-12-07 21:05:22 -07:00
|
|
|
import { getDevice } from "../../../device";
|
|
|
|
import { Axis } from "../../interfaces";
|
|
|
|
import { LockableButton } from "../lockable_button";
|
|
|
|
import { axisTrackingStatus } from "../axis_tracking_status";
|
|
|
|
import { ToolTips } from "../../../constants";
|
|
|
|
import { Row, Col } from "../../../ui/index";
|
|
|
|
import { CalibrationRowProps } from "../interfaces";
|
2018-05-01 18:55:41 -06:00
|
|
|
import { commandErr } from "../../actions";
|
2019-04-02 13:59:37 -06:00
|
|
|
import { t } from "../../../i18next_wrapper";
|
2017-06-29 12:54:02 -06:00
|
|
|
|
2018-05-01 18:55:41 -06:00
|
|
|
const calibrate = (axis: Axis) => getDevice()
|
|
|
|
.calibrate({ axis })
|
|
|
|
.catch(commandErr("Calibration"));
|
2017-06-29 12:54:02 -06:00
|
|
|
|
|
|
|
export function CalibrationRow(props: CalibrationRowProps) {
|
|
|
|
|
2018-03-09 02:34:24 -07:00
|
|
|
const { hardware, botDisconnected } = props;
|
2017-06-29 12:54:02 -06:00
|
|
|
|
|
|
|
return <Row>
|
|
|
|
<Col xs={6}>
|
|
|
|
<label>
|
|
|
|
{t("CALIBRATION")}
|
|
|
|
</label>
|
|
|
|
<div className="help">
|
|
|
|
<i className="fa fa-question-circle help-icon" />
|
|
|
|
<div className="help-text">
|
|
|
|
{t(ToolTips.CALIBRATION)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Col>
|
|
|
|
{axisTrackingStatus(hardware)
|
|
|
|
.map(row => {
|
2017-08-28 05:49:13 -06:00
|
|
|
const { axis, disabled } = row;
|
2018-01-29 11:32:32 -07:00
|
|
|
return <Col xs={2} key={axis} className={"centered-button-div"}>
|
2017-06-29 12:54:02 -06:00
|
|
|
<LockableButton
|
2018-03-09 02:34:24 -07:00
|
|
|
disabled={disabled || botDisconnected}
|
2017-06-29 12:54:02 -06:00
|
|
|
onClick={() => calibrate(axis)}>
|
|
|
|
{t("CALIBRATE {{axis}}", { axis })}
|
|
|
|
</LockableButton>
|
2017-07-28 19:58:24 -06:00
|
|
|
</Col>;
|
2017-06-29 12:54:02 -06:00
|
|
|
})}
|
|
|
|
</Row>;
|
|
|
|
}
|