From 2ea0fc2e3021583aeeaf9f32de851b848d6796e4 Mon Sep 17 00:00:00 2001 From: gabrielburnworth Date: Fri, 14 Sep 2018 11:32:31 -0700 Subject: [PATCH 1/3] updates to constants --- webpack/constants.ts | 37 ++++++++++++------- .../farm_designer/plants/select_plants.tsx | 5 +-- webpack/front_page/create_account.tsx | 2 +- webpack/sequences/step_tiles/mark_as.tsx | 2 +- webpack/tos_update/component.tsx | 6 +-- 5 files changed, 31 insertions(+), 21 deletions(-) diff --git a/webpack/constants.ts b/webpack/constants.ts index 19ca30c30..a6fe7646c 100644 --- a/webpack/constants.ts +++ b/webpack/constants.ts @@ -37,7 +37,8 @@ export namespace ToolTips { few sequences to verify that everything works as expected.`); export const PIN_BINDINGS = - trim(`Assign a sequence to execute when a Raspberry Pi GPIO pin is activated.`); + trim(`Assign a sequence to execute when a Raspberry Pi GPIO pin is + activated.`); export const PIN_BINDING_WARNING = trim(`Warning: Binding to a pin without a physical button and @@ -49,10 +50,10 @@ export namespace ToolTips { // Hardware Settings: Homing and Calibration export const HOMING = - trim(`(Alpha) If encoders or end-stops are enabled, home axis (find zero).`); + trim(`If encoders or end-stops are enabled, home axis (find zero).`); export const CALIBRATION = - trim(`(Alpha) If encoders or end-stops are enabled, home axis and determine + trim(`If encoders or end-stops are enabled, home axis and determine maximum.`); export const SET_ZERO_POSITION = @@ -107,8 +108,8 @@ export namespace ToolTips { trim(`The number of motor steps required to move the axis one millimeter.`); export const ALWAYS_POWER_MOTORS = - trim(`Keep power applied to motors. Prevents slipping from gravity in certain - situations.`); + trim(`Keep power applied to motors. Prevents slipping from gravity in + certain situations.`); export const INVERT_MOTORS = trim(`Invert direction of motor during calibration.`); @@ -118,23 +119,23 @@ export namespace ToolTips { // Hardware Settings: Encoders and Endstops export const ENABLE_ENCODERS = - trim(`(Alpha) Enable use of rotary encoders during calibration and homing.`); + trim(`Enable use of rotary encoders during calibration and homing.`); export const ENCODER_POSITIONING = - trim(`[EXPERIMENTAL] Use encoders for positioning.`); + trim(`Use encoders for positioning.`); export const INVERT_ENCODERS = - trim(`(Alpha) Reverse the direction of encoder position reading.`); + trim(`Reverse the direction of encoder position reading.`); export const MAX_MISSED_STEPS = - trim(`(Alpha) Number of steps missed (determined by encoder) before motor is + trim(`Number of steps missed (determined by encoder) before motor is considered to have stalled.`); export const ENCODER_MISSED_STEP_DECAY = - trim(`(Alpha) Reduction to missed step total for every good step.`); + trim(`Reduction to missed step total for every good step.`); export const ENCODER_SCALING = - trim(`(Alpha) encoder scaling factor = 10000 * (motor resolution * microsteps) + trim(`encoder scaling factor = 10000 * (motor resolution * microsteps) / (encoder resolution).`); export const ENABLE_ENDSTOPS = @@ -254,6 +255,12 @@ export namespace ToolTips { trim(`Snaps a photo using the device camera. Select the camera type on the Device page.`); + export const MARK_AS = + trim(`The Mark As step allows FarmBot to programmatically edit the + properties of the UTM, plants, and weeds from within a sequence. + For example, you can mark a plant as "planted" during a seeding + sequence or delete a weed after removing it.`); + // Regimens export const BULK_SCHEDULER = trim(`Add sequences to your regimen by selecting a sequence from the @@ -522,8 +529,8 @@ export namespace Content { click "+" in the Regimens panel to create a new one.`); export const NO_PARAMETERS = trim(`Can't directly use this sequence in a - regimen. Consider wrapping it in a parent sequence that calls it via "execute" - instead."`); + regimen. Consider wrapping it in a parent sequence that calls it via + "execute" instead.`); // Farm Designer export const OUTSIDE_PLANTING_AREA = @@ -538,6 +545,10 @@ export namespace Content { trim(`Click and drag to draw a point or use the inputs and press update. Press CREATE POINT to save, or the back arrow to exit.`); + export const BOX_SELECT_DESCRIPTION = + trim(`Drag a box around the plants you would like to select. + Press the back arrow to exit.`); + // Farm Events export const REGIMEN_TODAY_SKIPPED_ITEM_RISK = trim(`You are scheduling a regimen to run today. Be aware that diff --git a/webpack/farm_designer/plants/select_plants.tsx b/webpack/farm_designer/plants/select_plants.tsx index 05150dca3..69593e671 100644 --- a/webpack/farm_designer/plants/select_plants.tsx +++ b/webpack/farm_designer/plants/select_plants.tsx @@ -7,7 +7,7 @@ import { PlantInventoryItem } from "./plant_inventory_item"; import { destroy } from "../../api/crud"; import { BackArrow } from "../../ui/index"; import { unselectPlant } from "../actions"; -import { Actions } from "../../constants"; +import { Actions, Content } from "../../constants"; import { TaggedPlant } from "../map/interfaces"; import { getPlants } from "../state_to_props"; @@ -113,8 +113,7 @@ export class SelectPlants
- {t("Drag a box around the plants you would like to select. " + - "Press the back arrow to exit.")} + {t(Content.BOX_SELECT_DESCRIPTION)}
diff --git a/webpack/front_page/create_account.tsx b/webpack/front_page/create_account.tsx index a7018d8f0..f3d164f7d 100644 --- a/webpack/front_page/create_account.tsx +++ b/webpack/front_page/create_account.tsx @@ -121,7 +121,7 @@ export function CreateAccount(props: CreateAccountProps) { const RelevantForm = props.sent ? DidRegister : MustRegister; return - + ; diff --git a/webpack/sequences/step_tiles/mark_as.tsx b/webpack/sequences/step_tiles/mark_as.tsx index 0f0eb71c7..6bcd86e99 100644 --- a/webpack/sequences/step_tiles/mark_as.tsx +++ b/webpack/sequences/step_tiles/mark_as.tsx @@ -35,7 +35,7 @@ export class MarkAs extends React.Component { return > { logInit(); const body = t("Before logging in, you must agree to our latest Terms" + " of Service and Privacy Policy"); - log(body, "New Terms of Service"); + log(body, t("New Terms of Service")); } render() { @@ -110,8 +110,8 @@ export class TosUpdate extends React.Component> { + ? t("Agree to Terms of Service") + : t("Problem Loading Terms of Service")} /> {this.tosForm()} From 3e1f11484bd80b998a316616fb084e6dc536f974 Mon Sep 17 00:00:00 2001 From: gabrielburnworth Date: Fri, 14 Sep 2018 11:54:14 -0700 Subject: [PATCH 2/3] fix heading issues --- webpack/css/global.scss | 6 +++++- .../components/__tests__/farmbot_os_settings_test.tsx | 4 +++- webpack/devices/components/farmbot_os_settings.tsx | 11 ++++++----- .../fbos_settings/__tests__/farmbot_os_row_test.tsx | 1 + .../components/fbos_settings/farmbot_os_row.tsx | 1 + .../devices/components/fbos_settings/interfaces.ts | 1 + webpack/devices/interfaces.ts | 1 + webpack/farmware/farmware_list.tsx | 2 +- 8 files changed, 19 insertions(+), 8 deletions(-) diff --git a/webpack/css/global.scss b/webpack/css/global.scss index f2c411aea..85996af4c 100644 --- a/webpack/css/global.scss +++ b/webpack/css/global.scss @@ -194,6 +194,9 @@ a { cursor: pointer !important; &.fa-gear { color: $white; + &.dark { + color: $dark_gray; + } } } @@ -808,7 +811,8 @@ ul { max-width: 250px; h1 { font-weight: 300; - font-size: 1.5rem; + font-size: 1.4rem; + line-height: 2rem; } li:before { content: "• "; diff --git a/webpack/devices/components/__tests__/farmbot_os_settings_test.tsx b/webpack/devices/components/__tests__/farmbot_os_settings_test.tsx index 4d471f417..e4c4cced3 100644 --- a/webpack/devices/components/__tests__/farmbot_os_settings_test.tsx +++ b/webpack/devices/components/__tests__/farmbot_os_settings_test.tsx @@ -50,8 +50,10 @@ describe("", () => { {...fakeProps()} />); await expect(axios.get).toHaveBeenCalledWith( expect.stringContaining("RELEASE_NOTES.md")); + expect(osSettings.instance().state.osReleaseNotesHeading) + .toEqual("FarmBot OS v6"); expect(osSettings.instance().state.osReleaseNotes) - .toEqual("# FarmBot OS v6\n* note"); + .toEqual("* note"); }); it("doesn't fetch OS release notes", async () => { diff --git a/webpack/devices/components/farmbot_os_settings.tsx b/webpack/devices/components/farmbot_os_settings.tsx index d95fe6bde..58fc8fd76 100644 --- a/webpack/devices/components/farmbot_os_settings.tsx +++ b/webpack/devices/components/farmbot_os_settings.tsx @@ -37,7 +37,7 @@ const OS_RELEASE_NOTES_URL = export class FarmbotOsSettings extends React.Component { - state = { osReleaseNotes: "" }; + state = { osReleaseNotesHeading: "", osReleaseNotes: "" }; componentDidMount() { this.fetchReleaseNotes(OS_RELEASE_NOTES_URL, @@ -49,12 +49,12 @@ export class FarmbotOsSettings axios .get(url) .then(resp => { - const notes = resp.data + const osReleaseNotes = resp.data .split("# v") .filter(x => x.startsWith(osMajorVersion))[0] - .split("\n\n").join("\n"); - const osReleaseNotes = "# FarmBot OS v" + notes; - this.setState({ osReleaseNotes }); + .split("\n\n").slice(1).join("\n"); + const osReleaseNotesHeading = "FarmBot OS v" + osMajorVersion; + this.setState({ osReleaseNotesHeading, osReleaseNotes }); }) .catch(() => this.setState({ osReleaseNotes: "Could not get release notes." })); @@ -142,6 +142,7 @@ export class FarmbotOsSettings || this.props.isValidFbosConfig}> ", () => { const fakeProps = (): FarmbotOsRowProps => { return { bot, + osReleaseNotesHeading: "", osReleaseNotes: "", dispatch: jest.fn(x => x(jest.fn(), fakeState)), sourceFbosConfig: (x) => { diff --git a/webpack/devices/components/fbos_settings/farmbot_os_row.tsx b/webpack/devices/components/fbos_settings/farmbot_os_row.tsx index 4fceb90a1..1b4619723 100644 --- a/webpack/devices/components/fbos_settings/farmbot_os_row.tsx +++ b/webpack/devices/components/fbos_settings/farmbot_os_row.tsx @@ -40,6 +40,7 @@ export function FarmbotOsRow(props: FarmbotOsRowProps) {

+

{props.osReleaseNotesHeading}

{osReleaseNotes} diff --git a/webpack/devices/components/fbos_settings/interfaces.ts b/webpack/devices/components/fbos_settings/interfaces.ts index 90adee7a1..657c8ff2f 100644 --- a/webpack/devices/components/fbos_settings/interfaces.ts +++ b/webpack/devices/components/fbos_settings/interfaces.ts @@ -45,6 +45,7 @@ export interface FactoryResetRowProps { export interface FarmbotOsRowProps { bot: BotState; + osReleaseNotesHeading: string; osReleaseNotes: string; dispatch: Function; sourceFbosConfig: SourceFbosConfig; diff --git a/webpack/devices/interfaces.ts b/webpack/devices/interfaces.ts index 31502ce91..f4758ac14 100644 --- a/webpack/devices/interfaces.ts +++ b/webpack/devices/interfaces.ts @@ -160,6 +160,7 @@ export interface FarmbotOsProps { } export interface FarmbotOsState { + osReleaseNotesHeading: string; osReleaseNotes: string; } diff --git a/webpack/farmware/farmware_list.tsx b/webpack/farmware/farmware_list.tsx index c00aa13cc..c3f7dda31 100644 --- a/webpack/farmware/farmware_list.tsx +++ b/webpack/farmware/farmware_list.tsx @@ -91,7 +91,7 @@ export class FarmwareList return
- + Date: Fri, 14 Sep 2018 13:02:29 -0700 Subject: [PATCH 3/3] fix controls page widget buttons --- webpack/controls/peripherals/index.tsx | 2 +- webpack/controls/sensors/index.tsx | 2 +- webpack/controls/webcam/__tests__/index_test.tsx | 2 +- webpack/controls/webcam/edit.tsx | 13 +++++++------ 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/webpack/controls/peripherals/index.tsx b/webpack/controls/peripherals/index.tsx index 216b53689..c84520c79 100644 --- a/webpack/controls/peripherals/index.tsx +++ b/webpack/controls/peripherals/index.tsx @@ -97,7 +97,7 @@ export class Peripherals extends React.Component