Fix a bunch of TSLint warnings

pull/422/head
Rick Carlino 2017-08-23 17:26:09 -05:00
parent 4348b0f350
commit 95da7da5fe
111 changed files with 270 additions and 529 deletions

View File

@ -89,7 +89,7 @@ describe("util", () => {
}
}
});
expect(result).toEqual("Email: can't be blank.");
expect(result).toEqual("Email: can't be blank");
});
});

View File

@ -52,8 +52,7 @@ export class Account extends React.Component<Props, State> {
<DeleteAccount
onClick={(password) => this
.props
.dispatch(deleteUser({ password }))}
/>
.dispatch(deleteUser({ password }))} />
</Row>
</Col>
</Page>

View File

@ -83,8 +83,7 @@ export default class App extends React.Component<AppProps, {}> {
user={this.props.user}
bot={this.props.bot}
dispatch={this.props.dispatch}
logs={this.props.logs}
/>
logs={this.props.logs} />
{!syncLoaded && <Spinner radius={33} strokeWidth={6} />}
{syncLoaded && this.props.children}
<ControlsPopup dispatch={this.props.dispatch} />

View File

@ -29,8 +29,7 @@ export class Controls extends React.Component<Props, {}> {
peripherals={this.props.peripherals}
dispatch={this.props.dispatch}
resources={this.props.resources}
disabled={arduinoBusy}
/>
disabled={arduinoBusy} />
</Col>
<Col xs={12} sm={6}>
<WebcamPanel bot={this.props.bot}

View File

@ -24,8 +24,7 @@ export class DirectionButton extends React.Component<DirectionButtonProps, {}> {
onClick={this.sendCommand}
className={klass}
title={title}
disabled={disabled || false}
/>
disabled={disabled || false} />
);
}
}

View File

@ -17,8 +17,7 @@ export class JogButtons extends React.Component<JogMovementControlsProps, {}> {
direction="up"
isInverted={this.props.y_axis_inverted}
steps={this.props.bot.stepSize || 1000}
disabled={this.props.disabled}
/>
disabled={this.props.disabled} />
</td>
<td />
<td />
@ -28,8 +27,7 @@ export class JogButtons extends React.Component<JogMovementControlsProps, {}> {
direction="up"
isInverted={this.props.z_axis_inverted}
steps={this.props.bot.stepSize || 1000}
disabled={this.props.disabled}
/>
disabled={this.props.disabled} />
</td>
</tr>
<tr>
@ -37,8 +35,7 @@ export class JogButtons extends React.Component<JogMovementControlsProps, {}> {
<button
className="i fa fa-home arrow-button fb-button"
onClick={() => homeAll(100)}
disabled={this.props.disabled || false}
/>
disabled={this.props.disabled || false} />
</td>
<td />
<td>
@ -47,8 +44,7 @@ export class JogButtons extends React.Component<JogMovementControlsProps, {}> {
direction="left"
isInverted={this.props.x_axis_inverted}
steps={this.props.bot.stepSize || 1000}
disabled={this.props.disabled}
/>
disabled={this.props.disabled} />
</td>
<td>
<DirectionButton
@ -56,8 +52,7 @@ export class JogButtons extends React.Component<JogMovementControlsProps, {}> {
direction="down"
isInverted={this.props.y_axis_inverted}
steps={this.props.bot.stepSize || 1000}
disabled={this.props.disabled}
/>
disabled={this.props.disabled} />
</td>
<td>
<DirectionButton
@ -65,8 +60,7 @@ export class JogButtons extends React.Component<JogMovementControlsProps, {}> {
direction="right"
isInverted={this.props.x_axis_inverted}
steps={this.props.bot.stepSize || 1000}
disabled={this.props.disabled}
/>
disabled={this.props.disabled} />
</td>
<td />
<td>
@ -75,8 +69,7 @@ export class JogButtons extends React.Component<JogMovementControlsProps, {}> {
direction="down"
isInverted={this.props.z_axis_inverted}
steps={this.props.bot.stepSize || 1000}
disabled={this.props.disabled}
/>
disabled={this.props.disabled} />
</td>
</tr>
<tr>

View File

@ -61,8 +61,7 @@ export class Move extends React.Component<MoveProps, {}> {
</label>
<button
className={"fb-button fb-toggle-button " + xBtnColor}
onClick={this.toggle("x")}
/>
onClick={this.toggle("x")} />
</fieldset>
<fieldset>
<label>
@ -70,8 +69,7 @@ export class Move extends React.Component<MoveProps, {}> {
</label>
<button
className={"fb-button fb-toggle-button " + yBtnColor}
onClick={this.toggle("y")}
/>
onClick={this.toggle("y")} />
</fieldset>
<fieldset>
<label>
@ -79,8 +77,7 @@ export class Move extends React.Component<MoveProps, {}> {
</label>
<button
className={"fb-button fb-toggle-button " + zBtnColor}
onClick={this.toggle("z")}
/>
onClick={this.toggle("z")} />
</fieldset>
<label>
{t("Display Encoder Data")}
@ -91,8 +88,7 @@ export class Move extends React.Component<MoveProps, {}> {
</label>
<button
className={"fb-button fb-toggle-button " + rawBtnColor}
onClick={this.toggle_encoder_data("raw_encoders")}
/>
onClick={this.toggle_encoder_data("raw_encoders")} />
</fieldset>
<fieldset>
<label>
@ -100,15 +96,13 @@ export class Move extends React.Component<MoveProps, {}> {
</label>
<button
className={"fb-button fb-toggle-button " + scaledBtnColor}
onClick={this.toggle_encoder_data("scaled_encoders")}
/>
onClick={this.toggle_encoder_data("scaled_encoders")} />
</fieldset>
</div>
</Popover>
<EStopButton
bot={this.props.bot}
user={this.props.user}
/>
user={this.props.user} />
</WidgetHeader>
<WidgetBody>
<MustBeOnline
@ -121,15 +115,13 @@ export class Move extends React.Component<MoveProps, {}> {
<StepSizeSelector
choices={[1, 10, 100, 1000, 10000]}
selector={num => this.props.dispatch(changeStepSize(num))}
selected={this.props.bot.stepSize}
/>
selected={this.props.bot.stepSize} />
<JogButtons
bot={this.props.bot}
x_axis_inverted={x_axis_inverted}
y_axis_inverted={y_axis_inverted}
z_axis_inverted={z_axis_inverted}
disabled={this.props.disabled}
/>
disabled={this.props.disabled} />
<Row>
<Col xs={3}>
<label>{t("X AXIS")}</label>
@ -143,18 +135,15 @@ export class Move extends React.Component<MoveProps, {}> {
</Row>
<AxisDisplayGroup
position={motor_coordinates}
label={"Motor Coordinates (mm)"}
/>
label={"Motor Coordinates (mm)"} />
{scaled_encoders &&
<AxisDisplayGroup
position={scaled_encoders_data}
label={"Scaled Encoder (steps)"}
/>}
label={"Scaled Encoder (steps)"} />}
{raw_encoders &&
<AxisDisplayGroup
position={raw_encoders_data}
label={"Raw Encoder data"}
/>}
label={"Raw Encoder data"} />}
<AxisInputBoxGroup
position={motor_coordinates}
onCommit={input => moveAbs(input)}

View File

@ -83,8 +83,7 @@ export class Peripherals extends React.Component<PeripheralsProps, PeripheralSta
<SaveBtn
hidden={!isEditing}
status={status}
onClick={this.maybeSave}
/>
onClick={this.maybeSave} />
<button
hidden={!isEditing}
className="fb-button green"

View File

@ -17,8 +17,7 @@ export function PeripheralForm(props: PeripheralFormProps) {
onChange={(e) => {
let { value } = e.currentTarget;
dispatch(edit(p, { label: value }));
}}
/>
}} />
</Col>
<Col xs={4}>
<input type="number"
@ -33,8 +32,7 @@ export function PeripheralForm(props: PeripheralFormProps) {
<Col xs={2}>
<button
className="red fb-button"
onClick={() => { dispatch(destroy(p.uuid)); }}
>
onClick={() => { dispatch(destroy(p.uuid)); }}>
<i className="fa fa-minus" />
</button>
</Col>

View File

@ -48,8 +48,7 @@ export class ToggleButton extends React.Component<ToggleButtonProps, {}> {
<button
disabled={!!this.props.disabled}
className={this.css()}
onClick={cb}
>
onClick={cb}>
{this.caption()}
</button>
);

View File

@ -40,16 +40,14 @@ export class WebcamPanel extends
{isEditing &&
<button
className="fb-button green"
onClick={this.save}
>
onClick={this.save}>
{t("Save")}{this.props.feed.specialStatus ? "" : "*"}
</button>
}
{!isEditing &&
<button
className="fb-button gray"
onClick={this.toggle}
>
onClick={this.toggle}>
{t("Edit")}
</button>
}

View File

@ -26,8 +26,7 @@ export class ControlsPopup extends React.Component<Props, Partial<State>> {
return (
<div
className={"controls-popup " + isOpen}
onClick={this.toggle("isOpen")}
>
onClick={this.toggle("isOpen")}>
<i className="fa fa-plus" />
<div className="controls-popup-menu-outer">
<div className="controls-popup-menu-inner">
@ -36,29 +35,25 @@ export class ControlsPopup extends React.Component<Props, Partial<State>> {
direction="up"
isInverted={false}
steps={this.state.stepSize}
disabled={false}
/>
disabled={false} />
<DirectionButton
axis="x"
direction="left"
isInverted={false}
steps={this.state.stepSize}
disabled={false}
/>
disabled={false} />
<DirectionButton
axis="y"
direction="down"
isInverted={false}
steps={this.state.stepSize}
disabled={false}
/>
disabled={false} />
<DirectionButton
axis="z"
direction="right"
isInverted={false}
steps={this.state.stepSize}
disabled={false}
/>
disabled={false} />
</div>
</div>
</div>

View File

@ -6,13 +6,13 @@ describe("<LockableButton/>", () => {
it("does not trigger callback when clicked and disabled", () => {
let fakeCB = jest.fn();
let btn = mount(<LockableButton disabled={true} onClick={fakeCB} />);
btn.simulate("click")
btn.simulate("click");
expect(fakeCB.mock.calls.length).toEqual(0);
});
it("does trigger callback when clicked and enabled", () => {
let fakeCB = jest.fn();
let btn = mount(<LockableButton disabled={false} onClick={fakeCB} />);
btn.simulate("click")
btn.simulate("click");
expect(fakeCB.mock.calls.length).toEqual(1);
});
});

View File

@ -37,22 +37,19 @@ export function BooleanMCUInputGroup(props: BooleanMCUInputGroupProps) {
<ToggleButton
disabled={disableX}
toggleValue={mcu_params[x]}
toggleAction={() => settingToggle(x, bot, displayAlert)}
/>
toggleAction={() => settingToggle(x, bot, displayAlert)} />
</Col>
<Col xs={2}>
<ToggleButton
disabled={disableY}
toggleValue={mcu_params[y]}
toggleAction={() => settingToggle(y, bot, displayAlert)}
/>
toggleAction={() => settingToggle(y, bot, displayAlert)} />
</Col>
<Col xs={2}>
<ToggleButton
disabled={disableZ}
toggleValue={mcu_params[z]}
toggleAction={() => settingToggle(z, bot, displayAlert)}
/>
toggleAction={() => settingToggle(z, bot, displayAlert)} />
</Col>
</Row>
);

View File

@ -13,7 +13,7 @@ const LOOKUP: { [name: string]: DropDownItem } = {
[Encoder.differential]: { label: "Differential", value: Encoder.differential },
[Encoder.quadrature]: { label: "Single-Ended", value: Encoder.quadrature },
DEFAULT: { label: "---", value: Encoder.unknown }
}
};
const OPTIONS = [LOOKUP[Encoder.differential], LOOKUP[Encoder.quadrature]];
@ -38,7 +38,7 @@ export function EncoderType(props: EncoderTypeProps) {
} else {
throw new Error("Got bad encoder type in device panel.");
}
}
};
return <tr>
<td>
<label>{t("ENCODER TYPE")}</label>

View File

@ -125,8 +125,7 @@ export class FarmbotOsSettings
<div>
<TimezoneSelector
currentTimezone={this.props.account.body.timezone}
onUpdate={this.handleTimezone}
/>
onUpdate={this.handleTimezone} />
</div>
</Col>
</Row>
@ -189,8 +188,7 @@ export class FarmbotOsSettings
<button
className="fb-button yellow"
type="button"
onClick={reboot}
>
onClick={reboot}>
{t("RESTART")}
</button>
</Col>
@ -211,8 +209,7 @@ export class FarmbotOsSettings
<button
className="fb-button red"
type="button"
onClick={powerOff}
>
onClick={powerOff}>
{t("SHUTDOWN")}
</button>
</Col>
@ -232,8 +229,7 @@ export class FarmbotOsSettings
<button
className="fb-button red"
type="button"
onClick={factoryReset}
>
onClick={factoryReset}>
{t("FACTORY RESET")}
</button>
</Col>

View File

@ -44,21 +44,17 @@ export class HardwareSettings extends
</div>
<HomingAndCalibration
dispatch={dispatch}
bot={bot}
/>
bot={bot} />
<Motors
dispatch={dispatch}
bot={bot}
/>
bot={bot} />
<EncodersAndEndStops
dispatch={dispatch}
bot={bot}
/>
bot={bot} />
<DangerZone
dispatch={dispatch}
bot={bot}
onReset={MCUFactoryReset}
/>
onReset={MCUFactoryReset} />
</MustBeOnline>
</WidgetBody>
</Widget>

View File

@ -15,8 +15,7 @@ export function DangerZone(props: DangerZoneProps) {
bool={danger_zone}
title={"Danger Zone"}
name={"danger_zone"}
dispatch={dispatch}
/>
dispatch={dispatch} />
<Collapse isOpen={!!danger_zone}>
<Row>
<Col xs={4}>
@ -37,8 +36,7 @@ export function DangerZone(props: DangerZoneProps) {
<Col xs={2}>
<button
className="fb-button red"
onClick={onReset}
>
onClick={onReset}>
{t("RESET")}
</button>
</Col>

View File

@ -17,8 +17,7 @@ export function EncodersAndEndStops(props: EncodersProps) {
bool={encoders_and_endstops}
title={"Encoders and Endstops"}
name={"encoders_and_endstops"}
dispatch={dispatch}
/>
dispatch={dispatch} />
<Collapse isOpen={!!encoders_and_endstops}>
<BooleanMCUInputGroup
name={t("Enable Encoders")}
@ -27,8 +26,7 @@ export function EncodersAndEndStops(props: EncodersProps) {
y={"encoder_enabled_y"}
z={"encoder_enabled_z"}
dispatch={dispatch}
bot={bot}
/>
bot={bot} />
<BooleanMCUInputGroup
name={t("Use Encoders for Positioning")}
tooltip={t(ToolTips.ENCODER_POSITIONING)}
@ -36,8 +34,7 @@ export function EncodersAndEndStops(props: EncodersProps) {
y={"encoder_use_for_pos_y"}
z={"encoder_use_for_pos_z"}
dispatch={dispatch}
bot={bot}
/>
bot={bot} />
<BooleanMCUInputGroup
name={t("Invert Encoders")}
tooltip={t(ToolTips.INVERT_ENCODERS)}
@ -45,8 +42,7 @@ export function EncodersAndEndStops(props: EncodersProps) {
y={"encoder_invert_y"}
z={"encoder_invert_z"}
dispatch={dispatch}
bot={bot}
/>
bot={bot} />
<NumericMCUInputGroup
name={t("Max Missed Steps")}
tooltip={t(ToolTips.MAX_MISSED_STEPS)}
@ -54,8 +50,7 @@ export function EncodersAndEndStops(props: EncodersProps) {
y={"encoder_missed_steps_max_y"}
z={"encoder_missed_steps_max_z"}
bot={bot}
dispatch={dispatch}
/>
dispatch={dispatch} />
<NumericMCUInputGroup
name={t("Encoder Missed Step Decay")}
tooltip={t(ToolTips.ENCODER_MISSED_STEP_DECAY)}
@ -63,8 +58,7 @@ export function EncodersAndEndStops(props: EncodersProps) {
y={"encoder_missed_steps_decay_y"}
z={"encoder_missed_steps_decay_z"}
bot={bot}
dispatch={dispatch}
/>
dispatch={dispatch} />
<NumericMCUInputGroup
name={t("Encoder Scaling")}
tooltip={t(ToolTips.ENCODER_SCALING)}
@ -72,8 +66,7 @@ export function EncodersAndEndStops(props: EncodersProps) {
y={"encoder_scaling_y"}
z={"encoder_scaling_z"}
bot={bot}
dispatch={dispatch}
/>
dispatch={dispatch} />
<BooleanMCUInputGroup
name={t("Enable Endstops")}
tooltip={t(ToolTips.ENABLE_ENDSTOPS)}
@ -81,8 +74,7 @@ export function EncodersAndEndStops(props: EncodersProps) {
y={"movement_enable_endpoints_y"}
z={"movement_enable_endpoints_z"}
dispatch={dispatch}
bot={bot}
/>
bot={bot} />
<BooleanMCUInputGroup
name={t("Invert Endstops")}
tooltip={t(ToolTips.INVERT_ENDPOINTS)}
@ -90,8 +82,7 @@ export function EncodersAndEndStops(props: EncodersProps) {
y={"movement_invert_endpoints_y"}
z={"movement_invert_endpoints_z"}
dispatch={dispatch}
bot={bot}
/>
bot={bot} />
</Collapse>
</section>;
}

View File

@ -18,5 +18,5 @@ export let Header = (props: Props) => {
<span className="icon-toggle">
&nbsp;&nbsp;[<i className={`fa fa-${icon_string}`} />]
</span>
</h4>
}
</h4>;
};

View File

@ -28,8 +28,7 @@ export function HomingAndCalibration(props: HomingAndCalibrationProps) {
title={"Homing and Calibration"}
name={"homing_and_calibration"}
dispatch={dispatch}
bool={homing_and_calibration}
/>
bool={homing_and_calibration} />
<Collapse isOpen={!!homing_and_calibration}>
<HomingRow hardware={mcu_params} />
<CalibrationRow hardware={mcu_params} />
@ -45,8 +44,7 @@ export function HomingAndCalibration(props: HomingAndCalibrationProps) {
z={"movement_home_at_boot_z"}
dispatch={dispatch}
bot={bot}
caution={true}
/>
caution={true} />
<BooleanMCUInputGroup
name={t("Stop at Home")}
tooltip={t(ToolTips.STOP_AT_HOME)}
@ -54,8 +52,7 @@ export function HomingAndCalibration(props: HomingAndCalibrationProps) {
y={"movement_stop_at_home_y"}
z={"movement_stop_at_home_z"}
dispatch={dispatch}
bot={bot}
/>
bot={bot} />
<BooleanMCUInputGroup
name={t("Stop at Max")}
tooltip={t(ToolTips.STOP_AT_MAX)}
@ -63,8 +60,7 @@ export function HomingAndCalibration(props: HomingAndCalibrationProps) {
y={"movement_stop_at_max_y"}
z={"movement_stop_at_max_z"}
dispatch={dispatch}
bot={bot}
/>
bot={bot} />
<BooleanMCUInputGroup
name={t("Negative Coordinates Only")}
tooltip={t(ToolTips.NEGATIVE_COORDINATES_ONLY)}
@ -72,8 +68,7 @@ export function HomingAndCalibration(props: HomingAndCalibrationProps) {
y={"movement_home_up_y"}
z={"movement_home_up_z"}
dispatch={dispatch}
bot={bot}
/>
bot={bot} />
<NumericMCUInputGroup
name={t("Axis Length (steps)")}
tooltip={t(ToolTips.LENGTH)}
@ -81,8 +76,7 @@ export function HomingAndCalibration(props: HomingAndCalibrationProps) {
y={"movement_axis_nr_steps_y"}
z={"movement_axis_nr_steps_z"}
bot={bot}
dispatch={dispatch}
/>
dispatch={dispatch} />
<NumericMCUInputGroup
name={t("Timeout after (seconds)")}
tooltip={t(ToolTips.TIMEOUT_AFTER)}
@ -90,8 +84,7 @@ export function HomingAndCalibration(props: HomingAndCalibrationProps) {
y={"movement_timeout_y"}
z={"movement_timeout_z"}
bot={bot}
dispatch={dispatch}
/>
dispatch={dispatch} />
</Collapse>
</section>;
}

View File

@ -23,8 +23,7 @@ export function Motors({ dispatch, bot }: MotorsProps) {
bool={motors}
title={"Motors"}
name={"motors"}
dispatch={dispatch}
/>
dispatch={dispatch} />
<Collapse isOpen={!!motors}>
<Row>
<Col xs={6}>
@ -51,8 +50,7 @@ export function Motors({ dispatch, bot }: MotorsProps) {
<ToggleButton
toggleValue={mcu_params.param_e_stop_on_mov_err}
toggleAction={() =>
settingToggle("param_e_stop_on_mov_err", bot, undefined)}
/>
settingToggle("param_e_stop_on_mov_err", bot, undefined)} />
</Col>
</Row>
<NumericMCUInputGroup
@ -62,8 +60,7 @@ export function Motors({ dispatch, bot }: MotorsProps) {
y={"movement_max_spd_y"}
z={"movement_max_spd_z"}
bot={bot}
dispatch={dispatch}
/>
dispatch={dispatch} />
<NumericMCUInputGroup
name={t("Minimum Speed (steps/s)")}
tooltip={t(ToolTips.MIN_SPEED)}
@ -71,8 +68,7 @@ export function Motors({ dispatch, bot }: MotorsProps) {
y={"movement_min_spd_y"}
z={"movement_min_spd_z"}
bot={bot}
dispatch={dispatch}
/>
dispatch={dispatch} />
<NumericMCUInputGroup
name={t("Accelerate for (steps)")}
tooltip={t(ToolTips.ACCELERATE_FOR)}
@ -80,8 +76,7 @@ export function Motors({ dispatch, bot }: MotorsProps) {
y={"movement_steps_acc_dec_y"}
z={"movement_steps_acc_dec_z"}
bot={bot}
dispatch={dispatch}
/>
dispatch={dispatch} />
<Row>
<Col xs={6}>
<label>
@ -93,22 +88,19 @@ export function Motors({ dispatch, bot }: MotorsProps) {
<BotConfigInputBox
setting="steps_per_mm_x"
bot={bot}
dispatch={dispatch}
/>
dispatch={dispatch} />
</Col>
<Col xs={2}>
<BotConfigInputBox
setting="steps_per_mm_y"
bot={bot}
dispatch={dispatch}
/>
dispatch={dispatch} />
</Col>
<Col xs={2}>
<BotConfigInputBox
setting="steps_per_mm_z"
bot={bot}
dispatch={dispatch}
/>
dispatch={dispatch} />
</Col>
</Row>
<BooleanMCUInputGroup
@ -118,8 +110,7 @@ export function Motors({ dispatch, bot }: MotorsProps) {
y={"movement_keep_active_y"}
z={"movement_keep_active_z"}
dispatch={dispatch}
bot={bot}
/>
bot={bot} />
<BooleanMCUInputGroup
name={t("Invert Motors")}
tooltip={t(ToolTips.INVERT_MOTORS)}
@ -127,8 +118,7 @@ export function Motors({ dispatch, bot }: MotorsProps) {
y={"movement_invert_motor_y"}
z={"movement_invert_motor_z"}
dispatch={dispatch}
bot={bot}
/>
bot={bot} />
<Row>
<Col xs={6}>
<label>
@ -140,8 +130,7 @@ export function Motors({ dispatch, bot }: MotorsProps) {
<ToggleButton
toggleValue={mcu_params.movement_secondary_motor_x}
toggleAction={() =>
settingToggle("movement_secondary_motor_x", bot, undefined)}
/>
settingToggle("movement_secondary_motor_x", bot, undefined)} />
</Col>
</Row>
<Row>
@ -155,8 +144,7 @@ export function Motors({ dispatch, bot }: MotorsProps) {
<ToggleButton
toggleValue={mcu_params.movement_secondary_motor_invert_x}
toggleAction={() =>
settingToggle("movement_secondary_motor_invert_x", bot, undefined)}
/>
settingToggle("movement_secondary_motor_invert_x", bot, undefined)} />
</Col>
</Row>
</Collapse>

View File

@ -12,8 +12,7 @@ export function LockableButton({ onClick, disabled, children }: Props) {
return <button
className={"fb-button " + className}
disabled={disabled}
onClick={() => disabled ? "" : onClick()}
>
onClick={() => disabled ? "" : onClick()} >
{children}
</button>;
};
}

View File

@ -42,7 +42,6 @@ export class McuInputBox extends React.Component<McuInputBoxProps, {}> {
return <BlurableInput
type="number"
value={this.value}
onCommit={this.commit}
/>;
onCommit={this.commit} />;
}
}

View File

@ -20,22 +20,19 @@ export function NumericMCUInputGroup(props: NumericMCUInputGroupProps) {
<McuInputBox
setting={x}
bot={bot}
dispatch={dispatch}
/>
dispatch={dispatch} />
</Col>
<Col xs={2}>
<McuInputBox
setting={y}
bot={bot}
dispatch={dispatch}
/>
dispatch={dispatch} />
</Col>
<Col xs={2}>
<McuInputBox
setting={z}
bot={bot}
dispatch={dispatch}
/>
dispatch={dispatch} />
</Col>
</Row>;
}

View File

@ -65,8 +65,7 @@ export let OsUpdateButton = ({ bot }: BotProp) => {
<Col xs={7}>
<button
className={"fb-button " + buttonColor}
onClick={() => checkControllerUpdates()}
>
onClick={() => checkControllerUpdates()}>
{downloadProgress || buttonStr}
</button>
</Col>

View File

@ -33,7 +33,6 @@ export class BotConfigInputBox extends React.Component<StepsPerMMBoxProps, {}> {
return <BlurableInput
type="number"
onCommit={this.change(this.props.setting, this.props.dispatch)}
value={value}
/>;
value={value} />;
}
}

View File

@ -11,8 +11,7 @@ const AXES: Axis[] = ["x", "y", "z"];
export function ZeroButton({ axis }: { axis: Axis }) {
return <button
className="fb-button yellow"
onClick={() => zero(axis)}
>
onClick={() => zero(axis)} >
{t("zero {{axis}}", { axis })}
</button>;
}

View File

@ -17,15 +17,13 @@ export class Devices extends React.Component<Props, {}> {
account={this.props.deviceAccount}
dispatch={this.props.dispatch}
bot={this.props.bot}
auth={this.props.auth}
/>
auth={this.props.auth} />
</Col>
<Col xs={12} sm={6}>
<HardwareSettings
controlPanelState={this.props.bot.controlPanelState}
dispatch={this.props.dispatch}
bot={this.props.bot}
/>
bot={this.props.bot} />
</Col>
</Row>
</Page>;

View File

@ -40,7 +40,6 @@ export class TimezoneSelector extends React.Component<TZSelectorProps, {}> {
return <FBSelect
list={CHOICES}
selectedItem={this.selectedItem()}
onChange={this.itemSelected}
/>;
onChange={this.itemSelected} />;
}
}

View File

@ -222,8 +222,7 @@ export class EditFEForm extends React.Component<EditFEProps, State> {
<FBSelect
list={this.props.executableOptions}
onChange={this.executableSet}
selectedItem={this.executableGet()}
/>
selectedItem={this.executableGet()} />
<label>
{t("Starts")}
</label>
@ -234,8 +233,7 @@ export class EditFEForm extends React.Component<EditFEProps, State> {
className="add-event-start-date"
name="start_date"
value={this.fieldGet("startDate")}
onCommit={this.fieldSet("startDate")}
/>
onCommit={this.fieldSet("startDate")} />
</Col>
<Col xs={6}>
<BlurableInput
@ -243,16 +241,14 @@ export class EditFEForm extends React.Component<EditFEProps, State> {
className="add-event-start-time"
name="start_time"
value={this.fieldGet("startTime")}
onCommit={this.fieldSet("startTime")}
/>
onCommit={this.fieldSet("startTime")} />
</Col>
</Row>
<label>
<input type="checkbox"
onChange={this.toggleRepeat}
disabled={this.isReg}
checked={repeats && !this.isReg}
/>
checked={repeats && !this.isReg} />
&nbsp;{t("Repeats?")}
</label>
<FarmEventRepeatForm
@ -262,8 +258,7 @@ export class EditFEForm extends React.Component<EditFEProps, State> {
timeUnit={this.fieldGet("timeUnit") as TimeUnit}
repeat={this.fieldGet("repeat")}
endDate={this.fieldGet("endDate")}
endTime={this.fieldGet("endTime")}
/>
endTime={this.fieldGet("endTime")} />
<SaveBtn
status={fe.specialStatus || this.state.specialStatusLocal}
color="magenta"

View File

@ -51,8 +51,7 @@ export function FarmEventRepeatForm(props: RepeatFormProps) {
<FBSelect
list={repeatOptions}
onChange={(e) => onChange("timeUnit", "" + e.value)}
selectedItem={OPTN_LOOKUP[timeUnit] || OPTN_LOOKUP["daily"]}
/>
selectedItem={OPTN_LOOKUP[timeUnit] || OPTN_LOOKUP["daily"]} />
</Col>
</Row>
<label>

View File

@ -102,21 +102,6 @@ export class PureFarmEvents extends React.Component<FarmEventProps, {}> {
<div className="panel-content">
<Row>
{/* Hidden until built out per Rory */}
{/*
<Col xs={2}>
<i className="fa fa-calendar"></i>
</Col>
<Col xs={10}>
<FBSelect list={[]}
selectedItem={undefined}
onChange={option => {
this.props.push("/app/designer/farm_events/" + option.value);
}}
/>
</Col>
*/}
</Row>
<div className="farm-events">

View File

@ -2,7 +2,6 @@ import * as React from "react";
import { t } from "i18next";
import { timezoneMismatch } from "../../devices/timezones/guess_timezone";
const WARNING = `Note: Times displayed according to local browser time, which
is currently different from your device timezone setting (on the Device page).`;

View File

@ -74,8 +74,7 @@ export class FarmDesigner extends React.Component<Props, Partial<State>> {
showPlants={showPlants}
showPoints={showPoints}
showSpread={showSpread}
showFarmbot={showFarmbot}
/>
showFarmbot={showFarmbot} />
<div className="panel-header gray-panel designer-mobile-nav">
<div className="panel-tabs">
@ -110,8 +109,7 @@ export class FarmDesigner extends React.Component<Props, Partial<State>> {
points={this.props.points}
toolSlots={this.props.toolSlots}
botPosition={this.props.botPosition}
hoveredPlant={this.props.hoveredPlant}
/>
hoveredPlant={this.props.hoveredPlant} />
</div>
</div>;
}

View File

@ -123,13 +123,11 @@ export class GardenMap extends
botOriginQuadrant={this.props.designer.botOriginQuadrant}
plants={this.props.plants}
currentPlant={this.getPlant()}
visible={!!this.props.showSpread}
/>
visible={!!this.props.showSpread} />
<PointLayer
botOriginQuadrant={this.props.designer.botOriginQuadrant}
visible={!!this.props.showPoints}
points={this.props.points}
/>
points={this.props.points} />
<PlantLayer
botOriginQuadrant={this.props.designer.botOriginQuadrant}
dispatch={this.props.dispatch}
@ -138,26 +136,22 @@ export class GardenMap extends
crops={this.props.crops}
currentPlant={this.getPlant()}
dragging={!!this.state.isDragging}
editing={!!this.isEditing}
/>
editing={!!this.isEditing} />
<ToolSlotLayer
botOriginQuadrant={this.props.designer.botOriginQuadrant}
visible={!!this.props.showFarmbot}
slots={this.props.toolSlots}
/>
slots={this.props.toolSlots} />
<FarmBotLayer
botOriginQuadrant={this.props.designer.botOriginQuadrant}
visible={!!this.props.showFarmbot}
botPosition={this.props.botPosition}
/>
botPosition={this.props.botPosition} />
<HoveredPlantLayer
isEditing={this.isEditing}
botOriginQuadrant={this.props.designer.botOriginQuadrant}
currentPlant={this.getPlant()}
designer={this.props.designer}
dispatch={this.props.dispatch}
hoveredPlant={this.props.hoveredPlant}
/>
hoveredPlant={this.props.hoveredPlant} />
</svg>
</div>;
}

View File

@ -51,23 +51,19 @@ export function GardenMapLegend(props: GardenMapLegendProps) {
<LayerToggle
value={showPlants}
label={t("Plants?")}
onClick={toggle("showPlants")}
/>
onClick={toggle("showPlants")} />
<LayerToggle
value={showPoints}
label={t("Points?")}
onClick={toggle("showPoints")}
/>
onClick={toggle("showPoints")} />
<LayerToggle
value={showSpread}
label={t("Spread?")}
onClick={toggle("showSpread")}
/>
onClick={toggle("showSpread")} />
<LayerToggle
value={showFarmbot}
label={t("FarmBot?")}
onClick={toggle("showFarmbot")}
/>
onClick={toggle("showFarmbot")} />
</div>
<div className="farmbot-origin">
<label>
@ -76,20 +72,16 @@ export function GardenMapLegend(props: GardenMapLegendProps) {
<div className="quadrants">
<div
className={"quadrant " + (botOriginQuadrant === 2 && "selected")}
onClick={updateBotOriginQuadrant(2)}
/>
onClick={updateBotOriginQuadrant(2)} />
<div
className={"quadrant " + (botOriginQuadrant === 1 && "selected")}
onClick={updateBotOriginQuadrant(1)}
/>
onClick={updateBotOriginQuadrant(1)} />
<div
className={"quadrant " + (botOriginQuadrant === 3 && "selected")}
onClick={updateBotOriginQuadrant(3)}
/>
onClick={updateBotOriginQuadrant(3)} />
<div
className={"quadrant " + (botOriginQuadrant === 4 && "selected")}
onClick={updateBotOriginQuadrant(4)}
/>
onClick={updateBotOriginQuadrant(4)} />
</div>
</div>
</div>

View File

@ -31,8 +31,7 @@ export class GardenPlant extends
x={qx}
y={qy}
r={radius}
selected={selected}
/>
selected={selected} />
<image
className={"plant-image is-chosen-" + selected}
@ -43,8 +42,7 @@ export class GardenPlant extends
height={radius * 2}
width={radius * 2}
x={qx - radius}
y={qy - radius}
/>
y={qy - radius} />
</g>;
}
}

View File

@ -14,7 +14,6 @@ export function FarmBotLayer(props: FarmBotLayerProps) {
return visible ? <g>
<VirtualFarmBot
quadrant={botOriginQuadrant}
botPosition={props.botPosition}
/>
botPosition={props.botPosition} />
</g> : <g />; // fallback
}

View File

@ -30,7 +30,7 @@ interface HoveredPlantLayerState { isHovered: boolean; }
export class HoveredPlantLayer extends
React.Component<HoveredPlantLayerProps, Partial<HoveredPlantLayerState>> {
state: HoveredPlantLayerState = { isHovered: false }
state: HoveredPlantLayerState = { isHovered: false };
onClick = () => {
let plant = this.props.hoveredPlant;

View File

@ -16,8 +16,7 @@ export function PointLayer(props: PointLayerProps) {
<GardenPoint
point={p}
key={p.body.id}
quadrant={botOriginQuadrant}
/>
)}}
quadrant={botOriginQuadrant} />
)}
</g> : <g />; // fallback
}

View File

@ -23,10 +23,7 @@ export function SpreadLayer(props: SpreadLayerProps) {
<SpreadCircle
plant={p}
key={index}
quadrant={botOriginQuadrant}
/>
:
<g key={index} />;
quadrant={botOriginQuadrant} /> : <g key={index} />;
})
}
</g>
@ -64,8 +61,7 @@ export class SpreadCircle extends
fillOpacity={0.2}
fill={"green"}
stroke={"green"}
strokeWidth={"1.5"}
/>
strokeWidth={"1.5"} />
);
}
}

View File

@ -16,8 +16,7 @@ export function ToolSlotLayer(props: ToolSlotLayerProps) {
<ToolSlotPoint
key={slot.toolSlot.uuid}
slot={slot}
quadrant={botOriginQuadrant}
/>
quadrant={botOriginQuadrant} />
)}
</g> : <g />; // fallback
}

View File

@ -44,6 +44,6 @@ export class ToolSlotPoint extends
fill={"#434343"}>
{this.slot.tool ? this.slot.tool.body.name : "no tool"}
</text>
</g>
</g>;
}
}

View File

@ -44,8 +44,7 @@ export class CropCatalog extends React.Component<CropCatalogProps, {}> {
value={this.props.cropSearchQuery}
onChange={this.handleChange}
className="search"
placeholder="Search OpenFarm"
/>
placeholder="Search OpenFarm" />
</div>
</div>
</div>

View File

@ -75,8 +75,7 @@ export class CropInfo extends React.Component<CropInfoProps, {}> {
onDragStart={this.handleDragStart}
draggable={true}
src={result.image}
data-icon-url={result.crop.svg_icon}
/>
data-icon-url={result.crop.svg_icon} />
<div className="crop-info-overlay">
{t("Drag and drop into map")}
</div>
@ -121,8 +120,7 @@ export class CropInfo extends React.Component<CropInfoProps, {}> {
<img
src={svgToUrl(value)}
width={100}
height={100}
/>
height={100} />
</div>
:
<span>

View File

@ -3,11 +3,10 @@ import { connect } from "react-redux";
import { t } from "i18next";
import { BackArrow } from "../../ui";
import { TaggedPlantPointer } from "../../resources/tagged_resources";
import { mapStateToProps, formatPlantInfo } from "./map_state_to_props"
import { mapStateToProps, formatPlantInfo } from "./map_state_to_props";
import { PlantInfoBase } from "./plant_info_base";
import { PlantPanel } from "./plant_panel";
@connect(mapStateToProps)
export class EditPlantInfo extends PlantInfoBase {
default = (plant_info: TaggedPlantPointer) => {

View File

@ -30,8 +30,7 @@ export class OpenFarmResults extends React.Component<SearchResultProps, {}> {
<div
className="plant-catalog-image"
style={{ background: `url(${image}) top center no-repeat` }}
draggable={false}
/>
draggable={false} />
</div>
</Link>;
})}

View File

@ -20,8 +20,7 @@ export class PlantInfo extends PlantInfoBase {
<Link to="/app/designer/plants" className="back-arrow">
<i
className="fa fa-arrow-left"
onClick={() => this.props.dispatch(action)}
/>
onClick={() => this.props.dispatch(action)} />
</Link>
<span className="title">
{name}
@ -38,7 +37,7 @@ export class PlantInfo extends PlantInfoBase {
}
render() {
let plant_info = this.plant && this.plant
let plant_info = this.plant && this.plant;
return plant_info ? this.default(plant_info) : this.fallback();
}
}

View File

@ -63,8 +63,7 @@ export class Plants extends React.Component<Props, State> {
.map(p => <PlantInventoryItem
key={p.uuid}
tpp={p}
dispatch={this.props.dispatch}
/>)
dispatch={this.props.dispatch} />)
}
</div>
@ -78,4 +77,4 @@ export class Plants extends React.Component<Props, State> {
</div>;
}
};
}

View File

@ -69,8 +69,7 @@ export function PlantPanel({ info, onDestroy }: PlantPanelProps) {
<button
className="fb-button red"
hidden={!onDestroy}
onClick={destroy}
>
onClick={destroy} >
{t("Delete")}
</button>
</div>;

View File

@ -19,8 +19,7 @@ export class CameraCalibration extends
title={"Camera Calibration"}
help={t(ToolTips.CAMERA_CALIBRATION)}
onCalibrate={this.props.dispatch(calibrate)}
env={this.props.env}
/>
env={this.props.env} />
<WidgetBody>
<Row>
<Col sm={12}>
@ -51,8 +50,7 @@ export class CameraCalibration extends
V_LO={this.props.V_LO}
H_HI={this.props.H_HI}
S_HI={this.props.S_HI}
V_HI={this.props.V_HI}
/>
V_HI={this.props.V_HI} />
</Col>
</Row>
</WidgetBody>

View File

@ -106,8 +106,7 @@ export class FarmwarePanel extends React.Component<FWProps, Partial<FWState>> {
<MustBeOnline
fallback="Not available when FarmBot is offline."
status={this.props.syncStatus}
lockOpen={process.env.NODE_ENV !== "production"}
>
lockOpen={process.env.NODE_ENV !== "production"}>
<Row>
<fieldset>
<Col xs={12}>
@ -116,14 +115,12 @@ export class FarmwarePanel extends React.Component<FWProps, Partial<FWState>> {
value={this.state.packageUrl || ""}
onChange={(e) => {
this.setState({ packageUrl: e.currentTarget.value });
}}
/>
}} />
</Col>
<Col xs={12}>
<button
className="fb-button green"
onClick={this.install}
>
onClick={this.install}>
{t("Install")}
</button>
</Col>
@ -147,20 +144,17 @@ export class FarmwarePanel extends React.Component<FWProps, Partial<FWState>> {
<Col xs={12}>
<button
className="fb-button red"
onClick={this.remove}
>
onClick={this.remove}>
{t("Remove")}
</button>
<button
className="fb-button yellow"
onClick={this.update}
>
onClick={this.update}>
{t("Update")}
</button>
<button
className="fb-button green"
onClick={this.run}
>
onClick={this.run}>
{t("Run")}
</button>
</Col>

View File

@ -21,14 +21,12 @@ export class ImageFlipper extends
<p>{t(`Image loading (try refreshing)`)}</p>
<img
className="image-flipper-image"
src={PLACEHOLDER_FARMBOT}
/>
src={PLACEHOLDER_FARMBOT} />
</div>)}
<img
onLoad={() => this.setState({ isLoaded: true })}
className={`image-flipper-image is-loaded-${this.state.isLoaded}`}
src={url}
/>
src={url} />
</div>;
} else {
return <div className="no-flipper-image-container">
@ -36,8 +34,7 @@ export class ImageFlipper extends
Once you do, they will show up here.`)}</p>
<img
className="image-flipper-image"
src={PLACEHOLDER_FARMBOT}
/>
src={PLACEHOLDER_FARMBOT} />
</div>;
}
}
@ -59,14 +56,12 @@ export class ImageFlipper extends
{image}
<button
onClick={this.go(1)}
className="image-flipper-left fb-button"
>
className="image-flipper-left fb-button">
{t("Prev")}
</button>
<button
onClick={this.go(-1)}
className="image-flipper-right fb-button"
>
className="image-flipper-right fb-button">
{t("Next")}
</button>
</div>

View File

@ -59,8 +59,7 @@ export class Photos extends React.Component<PhotosProps, {}> {
<WidgetHeader helpText={ToolTips.PHOTOS} title={"Photos"}>
<button
className="fb-button gray"
onClick={this.takePhoto}
>
onClick={this.takePhoto}>
{t("Take Photo")}
</button>
</WidgetHeader>
@ -68,8 +67,7 @@ export class Photos extends React.Component<PhotosProps, {}> {
<ImageFlipper
onFlip={id => { this.props.dispatch(selectImage(id)); }}
currentImage={this.props.currentImage}
images={this.props.images}
/>
images={this.props.images} />
</WidgetBody>
<WidgetFooter>
{/** Separated from <MetaInfo /> for stylistic purposes. */}

View File

@ -18,14 +18,12 @@ export class FarmwarePage extends React.Component<FarmwareProps, {}> {
<Photos
dispatch={this.props.dispatch}
images={this.props.images}
currentImage={this.props.currentImage}
/>
currentImage={this.props.currentImage} />
</Col>
<Col xs={12} sm={5}>
<FarmwarePanel
syncStatus={this.props.syncStatus}
farmwares={this.props.farmwares}
/>
farmwares={this.props.farmwares} />
</Col>
</Row>
<Row>
@ -44,8 +42,7 @@ export class FarmwarePage extends React.Component<FarmwareProps, {}> {
V_LO={envGet("CAMERA_CALIBRATION_V_LO", this.props.env)}
H_HI={envGet("CAMERA_CALIBRATION_H_HI", this.props.env)}
S_HI={envGet("CAMERA_CALIBRATION_S_HI", this.props.env)}
V_HI={envGet("CAMERA_CALIBRATION_V_HI", this.props.env)}
/>
V_HI={envGet("CAMERA_CALIBRATION_V_HI", this.props.env)} />
</Col>
<Col xs={12} sm={5} smOffset={1}>
<WeedDetector {...this.props} />

View File

@ -12,7 +12,6 @@ import { devices } from "../../../device";
import { translateImageWorkspaceAndSave } from "../actions";
import { scanImage, test } from "../actions";
describe("actions", () => {
beforeEach(function () {
jest.clearAllMocks();

View File

@ -42,5 +42,5 @@ describe("envGet()", () => {
let result = envGet("CAMERA_CALIBRATION_calibration_object_separation",
myEnv);
expect(result).toEqual(29);
})
})
});
});

View File

@ -14,7 +14,8 @@ describe("<TitleBar/>", () => {
title: "Test",
help: "help text",
env: {}
}
};
let tb = mount(<TitleBar {...props} />);
expect(tb.text().toLowerCase()).toContain("clear weeds");
tb.setProps({ deletionProgress: "10%" });

View File

@ -53,13 +53,11 @@ export function WeedDetectorConfig(props: SettingsMenuProps) {
checked={!!envGet("CAMERA_CALIBRATION_invert_hue_selection", props.values)}
onChange={e => props.onChange("CAMERA_CALIBRATION_invert_hue_selection",
e.currentTarget.checked ?
SPECIAL_VALUES.TRUE : SPECIAL_VALUES.FALSE)}
/>
SPECIAL_VALUES.TRUE : SPECIAL_VALUES.FALSE)} />
</div>
<NumberBox
conf={"CAMERA_CALIBRATION_calibration_object_separation"}
label={t(`Calibration Object Separation`)}
/>
label={t(`Calibration Object Separation`)} />
<label>
{t(`Calibration Object Separation along axis`)}
</label>
@ -72,14 +70,12 @@ export function WeedDetectorConfig(props: SettingsMenuProps) {
<Col xs={6}>
<NumberBox
conf={"CAMERA_CALIBRATION_camera_offset_x"}
label={t(`Camera Offset X`)}
/>
label={t(`Camera Offset X`)} />
</Col>
<Col xs={6}>
<NumberBox
conf={"CAMERA_CALIBRATION_camera_offset_y"}
label={t(`Camera Offset Y`)}
/>
label={t(`Camera Offset Y`)} />
</Col>
</Row>
<label htmlFor="image_bot_origin_location">
@ -89,20 +85,17 @@ export function WeedDetectorConfig(props: SettingsMenuProps) {
list={ORIGIN_DROPDOWNS}
onChange={setDDI("CAMERA_CALIBRATION_image_bot_origin_location")}
selectedItem={find("CAMERA_CALIBRATION_image_bot_origin_location")}
placeholder="Select..."
/>
placeholder="Select..." />
<Row>
<Col xs={6}>
<NumberBox
conf={"CAMERA_CALIBRATION_coord_scale"}
label={t(`Pixel coordinate scale`)}
/>
label={t(`Pixel coordinate scale`)} />
</Col>
<Col xs={6}>
<NumberBox
conf={"CAMERA_CALIBRATION_total_rotation_angle"}
label={t(`Camera rotation`)}
/>
label={t(`Camera rotation`)} />
</Col>
</Row>
</div>;

View File

@ -27,7 +27,7 @@ export const SPECIAL_VALUE_DDI = {
label: "Bottom Right",
value: SPECIAL_VALUES.BOTTOM_RIGHT
},
}
};
export const CALIBRATION_DROPDOWNS: DropDownItem[] = [
SPECIAL_VALUE_DDI[SPECIAL_VALUES.X],

View File

@ -38,8 +38,8 @@ export class HsvSlider extends React.Component<EnvSliderProps, EnvSliderState> {
get name(): HSV {
switch (this.props.name) {
case "H": case "S": case "V": this.props.name
default: throw new Error("HSV is bad.")
case "H": case "S": case "V": return this.props.name;
default: throw new Error("HSV is bad.");
}
}

View File

@ -82,8 +82,7 @@ export class WeedDetector
S_LO={envGet("WEED_DETECTOR_S_LO", this.props.env)}
S_HI={envGet("WEED_DETECTOR_S_HI", this.props.env)}
V_LO={envGet("WEED_DETECTOR_V_LO", this.props.env)}
V_HI={envGet("WEED_DETECTOR_V_HI", this.props.env)}
/>
V_HI={envGet("WEED_DETECTOR_V_HI", this.props.env)} />
</Col>
</Row>
</WidgetBody>

View File

@ -15,7 +15,7 @@ describe("DEFAULT_FORMATTER", () => {
it("parses OK inputs (number)", () => {
let result = DEFAULT_FORMATTER.parse("CAMERA_CALIBRATION_blur", "23");
expect(result).toEqual(23)
expect(result).toEqual(23);
});
it("parses OK inputs (special)", () => {

View File

@ -17,7 +17,7 @@ export function prepopulateEnv(env: Dictionary<string | undefined>): WD_ENV {
val = initial;
} else {
val = "" + DEFAULTS[key];
};
}
output[key] = parseEnvKey(key, val);
});
return output;

View File

@ -11,4 +11,3 @@ export function parseEnvKey(key: WDENVKey, value: string) {
return (TRANSLATORS[key] || DEFAULT_FORMATTER)
.parse(key, value);
}

View File

@ -136,23 +136,20 @@ export class FrontPage extends React.Component<{}, Partial<FrontPageState>> {
<label>{t("I agree to the terms of use")}</label>
<input type="checkbox"
onChange={this.set("agreeToTerms").bind(this)}
value={this.state.agreeToTerms ? "false" : "true"}
/>
value={this.state.agreeToTerms ? "false" : "true"} />
</div>
<ul>
<li>
<a
href={PRV_URL}
target="_blank"
>
target="_blank">
{t("Privacy Policy")}
</a>
</li>
<li>
<a
href={TOS_URL}
target="_blank"
>
target="_blank">
{t("Terms of Use")}
</a>
</li>
@ -209,12 +206,10 @@ export class FrontPage extends React.Component<{}, Partial<FrontPageState>> {
</Row>
<img
className="hidden-xs hidden-sm col-md-7"
src="/app-resources/img/farmbot-desktop.png"
/>
src="/app-resources/img/farmbot-desktop.png" />
<img
className="hidden-xs hidden-md hidden-lg hidden-xl col-sm-7"
src="/app-resources/img/farmbot-tablet.png"
/>
src="/app-resources/img/farmbot-tablet.png" />
<Row>
{!forgotPassword && (
<Col xs={12} sm={5}>
@ -222,8 +217,7 @@ export class FrontPage extends React.Component<{}, Partial<FrontPageState>> {
<WidgetHeader title={"Login"}>
<button
className="fb-button gray"
onClick={toggleServerOpts}
>
onClick={toggleServerOpts} >
<i className={`fa fa-${expandIcon}`} />
</button>
</WidgetHeader>
@ -235,19 +229,16 @@ export class FrontPage extends React.Component<{}, Partial<FrontPageState>> {
<input
type="email"
value={this.state.email}
onChange={this.set("email").bind(this)}
/>
onChange={this.set("email").bind(this)} />
<label>
{t("Password")}
</label>
<input
type="password"
onChange={this.set("loginPassword").bind(this)}
/>
onChange={this.set("loginPassword").bind(this)} />
<a
className="forgot-password"
onClick={this.toggleForgotPassword.bind(this)}
>
onClick={this.toggleForgotPassword.bind(this)} >
{t("Forgot password?")}
</a>
{this.state.showServerOpts &&
@ -258,23 +249,20 @@ export class FrontPage extends React.Component<{}, Partial<FrontPageState>> {
<input
type="text"
onChange={this.set("serverURL").bind(this)}
value={this.state.serverURL}
/>
value={this.state.serverURL} />
<label>
{t("Server Port")}
</label>
<input
type="text"
onChange={this.set("serverPort").bind(this)}
value={this.state.serverPort}
/>
value={this.state.serverPort} />
</div>
}
<Row>
<button
className="fb-button green pull-right"
style={buttonStylesUniqueToOnlyThisPage}
>
style={buttonStylesUniqueToOnlyThisPage} >
{t("Login")}
</button>
</Row>
@ -289,8 +277,7 @@ export class FrontPage extends React.Component<{}, Partial<FrontPageState>> {
<WidgetHeader title={"Reset Password"}>
<button
className="fb-button gray"
onClick={this.toggleForgotPassword.bind(this)}
>
onClick={this.toggleForgotPassword.bind(this)} >
{t("BACK")}
</button>
</WidgetHeader>
@ -300,13 +287,11 @@ export class FrontPage extends React.Component<{}, Partial<FrontPageState>> {
<input
type="email"
value={this.state.email}
onChange={this.set("email").bind(this)}
/>
onChange={this.set("email").bind(this)} />
<Row>
<button
className="fb-button green"
style={buttonStylesUniqueToOnlyThisPage}
>
style={buttonStylesUniqueToOnlyThisPage}>
{t("Reset Password")}
</button>
</Row>
@ -325,33 +310,28 @@ export class FrontPage extends React.Component<{}, Partial<FrontPageState>> {
</label>
<input
type="email"
onChange={this.set("regEmail").bind(this)}
/>
onChange={this.set("regEmail").bind(this)} />
<label>
{t("Name")}
</label>
<input
type="text"
onChange={this.set("regName").bind(this)}
/>
onChange={this.set("regName").bind(this)} />
<label>
{t("Password")}
</label>
<input
type="password"
onChange={this.set("regPassword").bind(this)}
/>
onChange={this.set("regPassword").bind(this)} />
<label>{t("Verify Password")}</label>
<input
type="password"
onChange={this.set("regConfirmation").bind(this)}
/>
onChange={this.set("regConfirmation").bind(this)} />
{this.maybeRenderTos()}
<Row>
<button
className="fb-button green"
style={buttonStylesUniqueToOnlyThisPage}
>
style={buttonStylesUniqueToOnlyThisPage}>
{t("Create Account")}
</button>
</Row>

View File

@ -39,14 +39,12 @@ export class HotKeys extends React.Component<Props, Partial<State>> {
<div>
<Overlay
isOpen={this.state.guideOpen}
onClose={this.toggle("guideOpen")}
>
onClose={this.toggle("guideOpen")}>
<div className={hotkeyGuideClasses}>
<h3>{t("Hotkeys")}</h3>
<i
className="fa fa-times"
onClick={this.toggle("guideOpen")}
/>
onClick={this.toggle("guideOpen")} />
{
this.hotkeys(this.props.dispatch, "")
.map(hotkey => {
@ -121,8 +119,7 @@ export class HotKeys extends React.Component<Props, Partial<State>> {
global={true}
combo={combo}
label={label}
onKeyDown={onKeyDown}
/>;
onKeyDown={onKeyDown} />;
})
}
</Hotkeys>;

View File

@ -14,8 +14,7 @@ describe("NavBar", () => {
logs={[log]}
bot={bot}
user={taggedUser}
dispatch={jest.fn()}
/>
dispatch={jest.fn()} />
);
expect(wrapper.hasClass("nav-wrapper")).toBeTruthy();

View File

@ -22,8 +22,7 @@ describe("<TickerList />", () => {
<TickerList
logs={[log]}
tickerListOpen={false}
toggle={jest.fn()}
/>
toggle={jest.fn()} />
);
let labels = wrapper.find("label");
expect(labels.length).toEqual(2);
@ -41,8 +40,7 @@ describe("<TickerList />", () => {
<TickerList
logs={[]}
tickerListOpen={false}
toggle={jest.fn()}
/>
toggle={jest.fn()} />
);
let labels = wrapper.find("label");
expect(labels.length).toEqual(2);
@ -54,8 +52,7 @@ describe("<TickerList />", () => {
<TickerList
logs={[log, log]}
tickerListOpen={true}
toggle={jest.fn()}
/>
toggle={jest.fn()} />
);
let labels = wrapper.find("label");
expect(labels.length).toEqual(4);

View File

@ -25,8 +25,7 @@ export const AdditionalMenu = (logout: () => void) => {
<label>{t("VERSION")}</label>:&nbsp;
<a
href="https://github.com/FarmBot/Farmbot-Web-App"
target="_blank"
>
target="_blank">
{(globalConfig.SHORT_REVISION || "NONE").slice(0, 8)}
</a>
</div>

View File

@ -60,8 +60,7 @@ export class NavBar extends React.Component<NavBarProps, Partial<NavBarState>> {
<div className="nav-left">
<i
className={menuIconClassNames.join(" ")}
onClick={this.toggle("mobileMenuOpen")}
/>
onClick={this.toggle("mobileMenuOpen")} />
<span className="mobile-menu-container">
{MobileMenu({ toggle, mobileMenuOpen })}
</span>
@ -75,17 +74,14 @@ export class NavBar extends React.Component<NavBarProps, Partial<NavBarState>> {
interactionKind={PopoverInteractionKind.HOVER}
target={<div className="nav-name">{firstName}</div>}
position={Position.BOTTOM_RIGHT}
content={AdditionalMenu(this.logout)}
/>
content={AdditionalMenu(this.logout)} />
<EStopButton
bot={this.props.bot}
user={this.props.user}
/>
user={this.props.user} />
<SyncButton
bot={this.props.bot}
user={this.props.user}
dispatch={this.props.dispatch}
/>
dispatch={this.props.dispatch} />
</div>
</div>
</div>

View File

@ -12,8 +12,7 @@ export let MobileMenu = (props: MobileMenuProps) => {
<div>
<Overlay
isOpen={props.mobileMenuOpen}
onClose={props.toggle("mobileMenuOpen")}
>
onClose={props.toggle("mobileMenuOpen")}>
<div className={`${classes.join(" ")} ${isActive}`}>
{NavLinks({ toggle: props.toggle })}
</div>

View File

@ -29,8 +29,7 @@ export const NavLinks = (props: NavLinksProps) => {
to={"/app/" + link.slug}
className={`${isActive}`}
key={link.slug}
onClick={maybeToggle()}
>
onClick={maybeToggle()}>
<i className={`fa fa-${link.icon}`} />
{link.name}
</Link>

View File

@ -34,8 +34,7 @@ export let TickerList = (props: TickerListProps) => {
return (
<div
className="ticker-list"
onClick={props.toggle("tickerListOpen")}
>
onClick={props.toggle("tickerListOpen")} >
<div className="first-ticker">
{Ticker(firstTicker || noLogs, -1)}
</div>

View File

@ -18,6 +18,6 @@ detectLanguage().then((config) => {
render(reactElem, domElem);
} else {
throw new Error(t("Add a div with id `root` to the page first."));
};
}
});
});

View File

@ -75,21 +75,18 @@ export class PasswordReset extends React.Component<Props, State> {
</label>
<input
type="password"
onChange={this.set("password").bind(this)}
/>
onChange={this.set("password").bind(this)} />
<label>
{t("Confirm New Password")}
</label>
<input
type="password"
onChange={this.set("passwordConfirmation").bind(this)}
/>
onChange={this.set("passwordConfirmation").bind(this)} />
<Row>
<Col xs={12}>
<button
className="fb-button green pull-right"
style={buttonStylesUniqueToOnlyThisPage}
>
style={buttonStylesUniqueToOnlyThisPage}>
{t("Reset")}
</button>
</Col>

View File

@ -5,8 +5,7 @@ export function AddButton({ active, click }: AddButtonProps) {
if (!active) { return <div />; }
return <button
className="fb-button green add"
onClick={click}
>
onClick={click} >
<i className="fa fa-plus" />
</button>;
}

View File

@ -22,26 +22,22 @@ export function WeekGrid({ weeks, dispatch }: WeekGridProps) {
<Col xs={12}>
<button
className="green widget-control fb-button"
onClick={() => dispatch(pushWeek())}
>
onClick={() => dispatch(pushWeek())}>
<i className="fa fa-plus" /> {t("Week")}
</button>
<button
className="red widget-control fb-button"
onClick={() => dispatch(popWeek())}
>
onClick={() => dispatch(popWeek())}>
<i className="fa fa-minus" /> {t("Week")}
</button>
<button
className="gray widget-control fb-button"
onClick={() => dispatch(deselectDays())}
>
onClick={() => dispatch(deselectDays())}>
{t("Deselect all")}
</button>
<button
className="gray widget-control fb-button"
onClick={() => dispatch(selectDays())}
>
onClick={() => dispatch(selectDays())}>
{t("Select all")}
</button>
</Col>

View File

@ -30,8 +30,7 @@ function Day({ day, id, dispatch, week, active }: DayProps) {
className="day"
onClick={select(dispatch, day, week)}
checked={active}
readOnly={true}
/>
readOnly={true} />
<label className="day-label left-most" htmlFor={id}>
{(week * 7) + day}
</label>

View File

@ -14,7 +14,7 @@ export function CopyButton({ dispatch, regimen }: CopyButtnProps) {
</button>;
} else {
return <span />;
};
}
}
let count = 1;

View File

@ -16,8 +16,7 @@ function MiddleSection({ regimen, dispatch, calendar }: MiddleSectionProps) {
<ActiveEditor
dispatch={dispatch}
regimen={regimen}
calendar={calendar}
/>
calendar={calendar} />
);
} else {
return <EmptyEditor />;
@ -58,8 +57,7 @@ export function RegimenEditorWidget({ current, dispatch, auth, calendar }:
{regimen && (
<SaveBtn
status={regimen.specialStatus}
onClick={save({ dispatch, regimen })}
/>
onClick={save({ dispatch, regimen })} />
)}
<CopyButton regimen={regimen} dispatch={dispatch} />
@ -74,8 +72,7 @@ export function RegimenEditorWidget({ current, dispatch, auth, calendar }:
<MiddleSection
regimen={regimen}
dispatch={dispatch}
calendar={calendar}
/>
calendar={calendar} />
</div >;
} else {
throw new Error("Must log in first");

View File

@ -25,13 +25,11 @@ export function RegimenNameInput({ regimen, dispatch }: RegimenProps) {
placeholder={t("Regimen Name")}
type="text"
onChange={write({ dispatch, regimen })}
value={value}
/>
value={value} />
</Col>
<ColorPicker
current={(regimen && regimen.body.color) || "gray"}
onChange={(color) => dispatch(editRegimen(regimen, { color }))}
/>
onChange={(color) => dispatch(editRegimen(regimen, { color }))} />
</Row>
);
}

View File

@ -21,8 +21,7 @@ export class Regimens extends React.Component<Props, {}> {
weeks={this.props.weeks}
sequences={this.props.sequences}
resources={this.props.resources}
dispatch={this.props.dispatch}
/>
dispatch={this.props.dispatch} />
</Col>
<Col xs={12} md={6}>
<RegimenEditorWidget
@ -30,16 +29,14 @@ export class Regimens extends React.Component<Props, {}> {
auth={this.props.auth}
bot={this.props.bot}
calendar={this.props.calendar}
current={this.props.current}
/>
current={this.props.current} />
</Col>
{isMobile() && <MobileRegimensNav />}
<Col xs={12} md={3}>
<RegimensList
dispatch={this.props.dispatch}
regimens={this.props.regimens}
regimen={this.props.current}
/>
regimen={this.props.current} />
</Col>
</Row>
</Page>;

View File

@ -47,8 +47,7 @@ export class RegimensList extends
key={index}
regimen={regimen}
dispatch={this.props.dispatch}
length={this.props.regimens.length}
/>
length={this.props.regimens.length} />
);
})}
</Col>
@ -71,8 +70,7 @@ export class RegimensList extends
<AddRegimen dispatch={dispatch} length={regimens.length} />
<input
onChange={this.onChange}
placeholder={t("Search Regimens...")}
/>
placeholder={t("Search Regimens...")} />
<Row>
{this.rows()}
</Row>

View File

@ -16,12 +16,10 @@ export function RegimenListItem({ regimen, dispatch }: RegimenListItemProps) {
return <Link
to={`/app/regimens/${urlFriendly(name)}`}
key={regimen.uuid}
>
key={regimen.uuid}>
<button
className={style.join(" ")}
onClick={select(dispatch, regimen)}
>
onClick={select(dispatch, regimen)}>
{name} {regimen.specialStatus && ("*")}
</button>
</Link>;

View File

@ -79,4 +79,3 @@ let createRows = (index: ResourceIndex, dispatch: Function, regimen: TaggedRegim
let day = Math.floor(duration(time_offset).asDays()) + 1;
return { name, hhmm, color, day, dispatch, regimen, item, sortKey: time_offset };
};

View File

@ -16,11 +16,8 @@ export function InputDefault({
let notUndefied = (isString(raw) || isNumber(raw));
let val = notUndefied ? raw : "";
return (
<BlurableInput
type={type_ || "text"}
value={val}
onCommit={updateStep({ dispatch, step, field, index, sequence })}
/>
);
return <BlurableInput
type={type_ || "text"}
value={val}
onCommit={updateStep({ dispatch, step, field, index, sequence })} />;
}

View File

@ -16,4 +16,4 @@ export function StepInputBox(props: StepInputProps) {
default:
return <InputUnknown {...props } />;
}
};
}

View File

@ -62,14 +62,12 @@ export class SequenceEditorMiddleActive extends
onClick={() => execSequence(sequence.body)} />
<button
className="fb-button red"
onClick={() => dispatch(destroy(sequence.uuid))}
>
onClick={() => dispatch(destroy(sequence.uuid))}>
{t("Delete")}
</button>
<button
className="fb-button yellow"
onClick={copy(dispatch, sequence)}
>
onClick={copy(dispatch, sequence)}>
{t("Copy")}
</button>
</div>
@ -82,8 +80,7 @@ export class SequenceEditorMiddleActive extends
</Col>
<ColorPicker
current={sequence.body.color}
onChange={color => editCurrentSequence(dispatch, sequence, { color })}
/>
onChange={color => editCurrentSequence(dispatch, sequence, { color })} />
</Row>
<hr style={{ marginBottom: 0 }} />
<AllSteps onDrop={onDrop(dispatch, sequence)} {...this.props} />

View File

@ -33,8 +33,7 @@ export class Sequences extends React.Component<Props, {}> {
sequence={this.props.sequence}
slots={this.props.slots}
tools={this.props.tools}
resources={this.props.resources}
/>
resources={this.props.resources} />
</div>
</Col>
{isMobile() && <MobileSequencesNav />}
@ -43,8 +42,7 @@ export class Sequences extends React.Component<Props, {}> {
dispatch={this.props.dispatch}
auth={this.props.auth}
sequence={this.props.sequence}
sequences={this.props.sequences}
/>
sequences={this.props.sequences} />
</Col>
</Page>;
}

View File

@ -29,8 +29,7 @@ let sequenceList = (dispatch: Function) =>
return <Link
to={`/app/sequences/${urlFriendly(ts.body.name) || ""}`}
key={uuid}
onClick={click}
>
onClick={click} >
<button className={css.join(" ")}>
{name}
</button>
@ -91,14 +90,12 @@ export class SequencesList extends
onClick={() => {
dispatch(init(this.emptySequence()));
push("/app/sequences/new_sequence_" + (sequences.length++));
}}
>
}}>
<i className="fa fa-plus" />
</button>
<input
onChange={this.onChange}
placeholder={t("Search Sequences...")}
/>
placeholder={t("Search Sequences...")} />
<Row>
<Col xs={12}>
{

View File

@ -17,7 +17,8 @@ const label_ops: Record<ALLOWED_OPS, string> = {
"<": "is less than",
"is": "is",
"not": "is not"
}
};
export function If_(props: IfParams) {
let {
dispatch,
@ -49,8 +50,7 @@ export function If_(props: IfParams) {
list={LHSOptions}
placeholder="Left hand side"
onChange={updateField("lhs")}
selectedItem={LHSOptions.filter(x => x.value === lhs)[0] || NULL_CHOICE}
/>
selectedItem={LHSOptions.filter(x => x.value === lhs)[0] || NULL_CHOICE} />
</Col>
<Col xs={4}>
<label>{t("Operator")}</label>

View File

@ -153,8 +153,7 @@ export class TileMoveAbsolute extends Component<StepParams, MoveAbsState> {
<TileMoveAbsSelect
resources={this.resources}
selectedItem={this.args.location}
onChange={(x) => this.updateArgs({ location: x })}
/>
onChange={(x) => this.updateArgs({ location: x })} />
</Col>
<Col xs={3}>
<InputBox

View File

@ -12,7 +12,6 @@ export function TileMoveAbsSelect(props: TileMoveAbsProps) {
allowEmpty={true}
list={generateList(props.resources)}
selectedItem={formatSelectedDropdown(props.resources, i)}
onChange={(x) => props.onChange(handleSelect(props.resources, x))}
/>
onChange={(x) => props.onChange(handleSelect(props.resources, x))} />
);
}

View File

@ -125,8 +125,7 @@ class RefactoredSendMessage extends React.Component<SendMessageParams, {}> {
step={currentStep}
sequence={currentSequence}
index={index}
field="message"
/>
field="message" />
<div className="bottom-content">
<div className="channel-options">
<FBSelect

View File

@ -25,5 +25,5 @@ export const MESSAGE_STATUSES = [
];
export function channel(channel_name: ALLOWED_CHANNEL_NAMES): Channel {
return { kind: "channel", args: { channel_name } }
return { kind: "channel", args: { channel_name } };
}

View File

@ -61,8 +61,7 @@ export class ToolForm extends React.Component<ToolFormProps, {}> {
value={tool.body.name || "Error getting Name"}
onCommit={(e) => {
dispatch(edit(tool, { name: e.currentTarget.value }));
}}
/>
}} />
</Col>
<Col xs={2}>
<button

View File

@ -15,8 +15,7 @@ export class ToolList extends React.Component<ToolListProps, {}> {
<WidgetHeader helpText={ToolTips.TOOL_LIST} title="Tools">
<button
className="fb-button gray"
onClick={toggle}
>
onClick={toggle}>
{t("Edit")}
</button>
</WidgetHeader>

View File

@ -70,8 +70,7 @@ export class ToolBayForm extends React.Component<ToolBayFormProps, {}> {
status={toolSlotStatus}
onClick={() => {
dispatch(saveAll(toolSlots, () => { toggle(); }));
}}
/>
}} />
<button
className="green fb-button"
onClick={() => { dispatch(init(this.emptyToolSlot())); }}>
@ -98,8 +97,7 @@ export class ToolBayForm extends React.Component<ToolBayFormProps, {}> {
onCommit={(e) => {
dispatch(edit(slot, { x: parseInt(e.currentTarget.value, 10) }));
}}
type="number"
/>
type="number" />
</Col>
<Col xs={2}>
<BlurableInput
@ -107,8 +105,7 @@ export class ToolBayForm extends React.Component<ToolBayFormProps, {}> {
onCommit={(e) => {
dispatch(edit(slot, { y: parseInt(e.currentTarget.value, 10) }));
}}
type="number"
/>
type="number" />
</Col>
<Col xs={2}>
<BlurableInput
@ -116,8 +113,7 @@ export class ToolBayForm extends React.Component<ToolBayFormProps, {}> {
onCommit={(e) => {
dispatch(edit(slot, { z: parseInt(e.currentTarget.value, 10) }));
}}
type="number"
/>
type="number" />
</Col>
<Col xs={3}>
<FBSelect
@ -125,8 +121,7 @@ export class ToolBayForm extends React.Component<ToolBayFormProps, {}> {
selectedItem={this.props.getChosenToolOption(slot.uuid)}
allowEmpty={true}
onChange={this.props.changeToolSlot(slot,
this.props.dispatch)}
/>
this.props.dispatch)} />
</Col>
<Col xs={1}>
<button

Some files were not shown because too many files have changed in this diff Show More