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

66 lines
2.2 KiB
TypeScript
Raw Normal View History

2018-01-11 23:18:26 -07:00
import * as React from "react";
import { Row, Col, Markdown } from "../../../ui/index";
import { OsUpdateButton } from "./os_update_button";
import { Popover, Position } from "@blueprintjs/core";
import { ColWidth } from "../farmbot_os_settings";
2018-07-10 20:37:50 -06:00
import { FarmbotOsRowProps } from "./interfaces";
import { FbosDetails } from "./fbos_details";
2019-04-02 13:59:37 -06:00
import { t } from "../../../i18next_wrapper";
2018-01-11 23:18:26 -07:00
const getVersionString =
2019-01-13 16:33:43 -07:00
(fbosVersion: string | undefined, onBeta: boolean | undefined): string => {
const needsExtension = fbosVersion && !fbosVersion.includes("-") && onBeta;
const extension = needsExtension ? "-beta" : "";
return fbosVersion ? fbosVersion + extension : t(" unknown (offline)");
};
2018-01-11 23:18:26 -07:00
export function FarmbotOsRow(props: FarmbotOsRowProps) {
const { sourceFbosConfig, dispatch, bot, osReleaseNotes, botOnline } = props;
const { controller_version, currently_on_beta
} = bot.hardware.informational_settings;
const version = getVersionString(controller_version, currently_on_beta);
2018-01-11 23:18:26 -07:00
return <Row>
<Col xs={ColWidth.label}>
<label>
{t("FARMBOT OS")}
</label>
</Col>
<Col xs={3}>
2018-09-10 14:51:40 -06:00
<Popover position={Position.BOTTOM_LEFT}>
2018-01-11 23:18:26 -07:00
<p>
{t("Version {{ version }}", { version })}
</p>
2018-01-27 02:29:13 -07:00
<FbosDetails
2018-07-10 20:37:50 -06:00
botInfoSettings={bot.hardware.informational_settings}
2018-01-27 02:29:13 -07:00
dispatch={dispatch}
2018-11-26 20:39:35 -07:00
shouldDisplay={props.shouldDisplay}
2019-06-07 18:26:12 -06:00
sourceFbosConfig={sourceFbosConfig}
botToMqttLastSeen={props.botToMqttLastSeen}
timeSettings={props.timeSettings}
deviceAccount={props.deviceAccount} />
2018-01-11 23:18:26 -07:00
</Popover>
</Col>
<Col xs={3}>
<Popover position={Position.BOTTOM}>
<p className="release-notes-button">
{t("Release Notes")}&nbsp;
<i className="fa fa-caret-down" />
</p>
<div className="release-notes">
2018-09-14 12:54:14 -06:00
<h1>{props.osReleaseNotesHeading}</h1>
2018-01-11 23:18:26 -07:00
<Markdown>
2018-01-27 02:29:13 -07:00
{osReleaseNotes}
2018-01-11 23:18:26 -07:00
</Markdown>
</div>
</Popover>
</Col>
<Col xs={3}>
<OsUpdateButton
bot={bot}
sourceFbosConfig={sourceFbosConfig}
2019-01-04 12:26:31 -07:00
shouldDisplay={props.shouldDisplay}
botOnline={botOnline} />
2018-01-11 23:18:26 -07:00
</Col>
2019-09-23 12:56:35 -06:00
</Row>;
2018-01-11 23:18:26 -07:00
}