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";
|
2020-03-13 15:06:40 -06:00
|
|
|
import { DevSettings } from "../../../account/dev/dev_support";
|
2017-06-29 12:54:02 -06:00
|
|
|
|
|
|
|
export function DangerZone(props: DangerZoneProps) {
|
|
|
|
|
2020-03-13 15:06:40 -06:00
|
|
|
const { dispatch, onReset, botOnline } = props;
|
2018-03-09 02:34:24 -07:00
|
|
|
const { danger_zone } = props.controlPanelState;
|
2020-03-13 15:06:40 -06:00
|
|
|
const newFormat = DevSettings.futureFeaturesEnabled();
|
2020-02-18 12:21:09 -07:00
|
|
|
return <Highlight className={"section"}
|
|
|
|
settingName={DeviceSetting.dangerZone}>
|
2017-06-29 12:54:02 -06:00
|
|
|
<Header
|
2018-06-18 15:12:00 -06:00
|
|
|
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}>
|
2020-03-13 15:06:40 -06:00
|
|
|
<Highlight settingName={DeviceSetting.resetHardwareParams}>
|
|
|
|
<Row>
|
|
|
|
<Col xs={newFormat ? 8 : 4}>
|
2020-02-18 12:21:09 -07:00
|
|
|
<label>
|
|
|
|
{t(DeviceSetting.resetHardwareParams)}
|
|
|
|
</label>
|
|
|
|
</Col>
|
2020-03-13 15:06:40 -06:00
|
|
|
{!newFormat &&
|
|
|
|
<Col xs={6}>
|
|
|
|
<p>
|
|
|
|
{t(Content.RESTORE_DEFAULT_HARDWARE_SETTINGS)}
|
|
|
|
</p>
|
|
|
|
</Col>}
|
|
|
|
<Col xs={newFormat ? 4 : 2} className={"centered-button-div"}>
|
2020-02-18 12:21:09 -07:00
|
|
|
<button
|
|
|
|
className="fb-button red"
|
2020-03-13 15:06:40 -06:00
|
|
|
disabled={!botOnline}
|
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>
|
2020-03-13 15:06:40 -06:00
|
|
|
</Row>
|
|
|
|
{newFormat &&
|
|
|
|
<Row><p>{t(Content.RESTORE_DEFAULT_HARDWARE_SETTINGS)}</p></Row>}
|
|
|
|
</Highlight>
|
2017-06-29 12:54:02 -06:00
|
|
|
</Collapse>
|
2020-02-18 12:21:09 -07:00
|
|
|
</Highlight>;
|
2017-06-29 12:54:02 -06:00
|
|
|
}
|