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"; import { FarmbotOsRowProps } from "./interfaces"; import { FbosDetails } from "./fbos_details"; import { t } from "../../../i18next_wrapper"; import { ErrorBoundary } from "../../../error_boundary"; import { Highlight } from "../maybe_highlight"; import { DeviceSetting } from "../../../constants"; import { DevSettings } from "../../../account/dev/dev_support"; import { getLastSeenNumber } from "./last_seen_row"; export const getOsReleaseNotesForVersion = ( osReleaseNotes: string | undefined, version: string | undefined, ) => { const fallback = globalConfig.FBOS_END_OF_LIFE_VERSION || "9"; const majorVersion = (version || fallback).split(".")[0]; const allReleaseNotes = osReleaseNotes || ""; const thisReleaseNotes = allReleaseNotes.split("# v") .filter(x => x.startsWith(majorVersion))[0] || ""; const notes = thisReleaseNotes.split("\n\n").slice(1).join("\n") || t("Could not get release notes."); const heading = "FarmBot OS v" + majorVersion; return { heading, notes }; }; const getVersionString = (fbosVersion: string | undefined, onBeta: boolean | undefined): string => { const needsExtension = fbosVersion && !fbosVersion.includes("-") && onBeta; const extension = needsExtension ? "-beta" : ""; return fbosVersion ? fbosVersion + extension : t(" unknown (offline)"); }; export class FarmbotOsRow extends React.Component { Version = () => { const { controller_version, currently_on_beta } = this.props.bot.hardware.informational_settings; const version = getVersionString(controller_version, currently_on_beta); return

{t("Version {{ version }}", { version })}

; } ReleaseNotes = () => { const { osReleaseNotes, hardware } = this.props.bot; const { controller_version } = hardware.informational_settings; const releaseNotes = getOsReleaseNotesForVersion(osReleaseNotes, controller_version); return

{t("Release Notes")} 

{releaseNotes.heading}

{releaseNotes.notes}
; } render() { const { sourceFbosConfig, bot, botOnline } = this.props; const newFormat = DevSettings.futureFeaturesEnabled(); return {!newFormat && } {!newFormat && } {newFormat && } {newFormat && } ; } }