Farmbot-Web-App/frontend/devices/components/hardware_settings/danger_zone.tsx

49 lines
1.5 KiB
TypeScript
Raw Normal View History

2017-06-29 12:54:02 -06:00
import * as React from "react";
import { DangerZoneProps } from "../interfaces";
import { Row, Col } from "../../../ui/index";
import { Header } from "./header";
import { Collapse } from "@blueprintjs/core";
2020-02-18 12:21:09 -07:00
import { Content, DeviceSetting } from "../../../constants";
2019-04-02 13:59:37 -06:00
import { t } from "../../../i18next_wrapper";
2020-02-18 12:21:09 -07:00
import { Highlight } from "../maybe_highlight";
2017-06-29 12:54:02 -06:00
export function DangerZone(props: DangerZoneProps) {
2018-03-09 02:34:24 -07:00
const { dispatch, onReset, botDisconnected } = props;
const { danger_zone } = props.controlPanelState;
2017-06-29 12:54:02 -06:00
2020-02-18 12:21:09 -07:00
return <Highlight className={"section"}
settingName={DeviceSetting.dangerZone}>
2017-06-29 12:54:02 -06:00
<Header
expanded={danger_zone}
2020-02-18 12:21:09 -07:00
title={DeviceSetting.dangerZone}
panel={"danger_zone"}
2017-08-23 16:26:09 -06:00
dispatch={dispatch} />
2017-06-29 12:54:02 -06:00
<Collapse isOpen={!!danger_zone}>
<Row>
2020-02-18 12:21:09 -07:00
<Highlight settingName={DeviceSetting.resetHardwareParams}>
<Col xs={4}>
<label>
{t(DeviceSetting.resetHardwareParams)}
</label>
</Col>
<Col xs={6}>
<p>
{t(Content.RESTORE_DEFAULT_HARDWARE_SETTINGS)}
</p>
</Col>
<Col xs={2} className={"centered-button-div"}>
<button
className="fb-button red"
disabled={botDisconnected}
2020-02-28 09:34:28 -07:00
title={t("RESET")}
2020-02-18 12:21:09 -07:00
onClick={onReset}>
{t("RESET")}
</button>
</Col>
</Highlight>
2017-06-29 12:54:02 -06:00
</Row>
</Collapse>
2020-02-18 12:21:09 -07:00
</Highlight>;
2017-06-29 12:54:02 -06:00
}