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

33 lines
963 B
TypeScript
Raw Normal View History

2017-11-09 10:42:06 -07:00
import * as React from "react";
import { Row, Col } from "../../../ui/index";
import { ToggleButton } from "../../../controls/toggle_button";
import { Content } from "../../../constants";
import { updateConfig } from "../../actions";
import { ColWidth } from "../farmbot_os_settings";
2018-01-27 02:29:13 -07:00
import { AutoSyncRowProps } from "./interfaces";
2019-04-02 13:59:37 -06:00
import { t } from "../../../i18next_wrapper";
2017-11-09 10:42:06 -07:00
export function AutoSyncRow(props: AutoSyncRowProps) {
2018-01-27 02:29:13 -07:00
const autoSync = props.sourceFbosConfig("auto_sync");
2017-11-09 10:42:06 -07:00
return <Row>
<Col xs={ColWidth.label}>
2017-11-09 10:42:06 -07:00
<label>
{t("AUTO SYNC")}
</label>
</Col>
<Col xs={ColWidth.description}>
2017-11-09 10:42:06 -07:00
<p>
{t(Content.AUTO_SYNC)}
</p>
</Col>
<Col xs={ColWidth.button}>
2018-01-27 02:29:13 -07:00
<ToggleButton
toggleValue={autoSync.value}
dim={!autoSync.consistent}
2017-11-20 12:44:46 -07:00
toggleAction={() => {
2018-01-27 02:29:13 -07:00
props.dispatch(updateConfig({ auto_sync: !autoSync.value }));
2017-11-20 12:44:46 -07:00
}} />
2017-11-09 10:42:06 -07:00
</Col>
</Row>;
}