Farmbot-Web-App/frontend/devices/components/fbos_settings/auto_update_row.tsx

39 lines
1.4 KiB
TypeScript
Raw Normal View History

2017-11-09 09:45:11 -07:00
import * as React from "react";
import { Row, Col } from "../../../ui/index";
import { ColWidth } from "../farmbot_os_settings";
2018-01-10 17:37:36 -07:00
import { ToggleButton } from "../../../controls/toggle_button";
import { updateConfig } from "../../actions";
2020-02-18 12:21:09 -07:00
import { Content, DeviceSetting } from "../../../constants";
2018-01-27 02:29:13 -07:00
import { AutoUpdateRowProps } from "./interfaces";
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-11-09 09:45:11 -07:00
export function AutoUpdateRow(props: AutoUpdateRowProps) {
2018-01-27 02:29:13 -07:00
const osAutoUpdate = props.sourceFbosConfig("os_auto_update");
2020-03-13 15:06:40 -06:00
const newFormat = DevSettings.futureFeaturesEnabled();
return <Highlight settingName={DeviceSetting.farmbotOSAutoUpdate}>
<Row>
<Col xs={newFormat ? 9 : ColWidth.label}>
2020-02-26 13:08:49 -07:00
<label>
{t(DeviceSetting.farmbotOSAutoUpdate)}
</label>
</Col>
2020-03-13 15:06:40 -06:00
{!newFormat &&
<Col xs={ColWidth.description}>
<p>
{t(Content.OS_AUTO_UPDATE)}
</p>
</Col>}
<Col xs={newFormat ? 3 : ColWidth.button}>
2020-02-26 13:08:49 -07:00
<ToggleButton toggleValue={osAutoUpdate.value}
dim={!osAutoUpdate.consistent}
toggleAction={() => props.dispatch(updateConfig({
os_auto_update: !osAutoUpdate.value
}))} />
</Col>
2020-03-13 15:06:40 -06:00
</Row>
{newFormat && <Row><p>{t(Content.OS_AUTO_UPDATE)}</p></Row>}
</Highlight>;
2017-11-09 09:45:11 -07:00
}