pull/488/head
gabrielburnworth 2017-10-06 00:12:12 -07:00
parent 1223add25d
commit d60b5cad8a
11 changed files with 38 additions and 49 deletions

View File

@ -17,19 +17,19 @@
// Sequences and Regimens
@import "sequences";
@import "regimens";
// App loading animations
@import "spinner";
@import "loading_plant";
// Components
@import "buttons";
@import "events";
@import "hotkeys";
@import "image_flipper";
@import "inputs";
@import "steps"; // must be imported after "inputs"
@import "labels";
@import "loading_plant";
@import "navbar";
@import "spinner";
@import "static_pages";
@import "status_ticker";
@import "steps";
@import "tables";
@import "toastr";
@import "tooltips";

View File

@ -1,14 +0,0 @@
.add-event-repeat-frequency {
min-height: 34px;
}
.events {
.fa-calendar {
font-size: 2rem;
padding-top: 0.6rem;
padding-left: 2.4rem;
}
.event-date {
padding: 0;
}
}

View File

@ -81,3 +81,7 @@
margin-top: 4rem;
}
}
.add-event-repeat-frequency {
min-height: 34px;
}

View File

@ -18,15 +18,13 @@ describe("<HomingRow />", () => {
// TODO: fix this test
// Code being run is {t("HOME {{axis}}", { axis })}
// Result string is "HOME {{axis}}HOME {{axis}}HOME {{axis}}"
// Console example (result is "HOME {{ax}}"):
// let ax = "x";
// it("renders three buttons", () => {
// const wrapper = mount(<HomingRow hardware={bot.hardware.mcu_params} />);
// let txt = wrapper.text();
// ["X", "Y", "Z"].map(function (axis) {
// expect(txt).toContain(`HOME ${axis}`);
// });
// });
xit("renders three buttons", () => {
const wrapper = mount(<HomingRow hardware={bot.hardware.mcu_params} />);
const txt = wrapper.text();
["X", "Y", "Z"].map(function (axis) {
expect(txt).toContain(`HOME ${axis}`);
});
});
it("calls device", () => {
const { mock } = devices.current.findHome as jest.Mock<{}>;
const result = mount(<HomingRow hardware={bot.hardware.mcu_params} />);

View File

@ -1,6 +1,6 @@
import * as React from "react";
import { t } from "i18next";
import { Widget, WidgetHeader } from "./ui";
import { Widget, WidgetHeader } from "../ui";
/*
* Widget to display if the desired widget fails to load.

View File

@ -8,7 +8,7 @@ interface SpinnerProps {
// TODO: Keep accurate proportions when scaling up or down
export function Spinner(props: SpinnerProps) {
let { radius, strokeWidth } = props;
const { radius, strokeWidth } = props;
return <div className="spinner-container">
<svg className="spinner"
width={`${radius * 2}px`}

View File

@ -18,12 +18,12 @@ export function mapStateToProps(props: Everything) {
const { plantUUID } = props.resources.consumers.farm_designer.hoveredPlant;
const hoveredPlant = plants.filter(x => x.uuid === plantUUID)[0];
let botPosition: BotPosition;
if (props.bot.hardware.location_data) {
botPosition = props.bot.hardware.location_data.position;
} else {
botPosition = { x: undefined, y: undefined, z: undefined };
}
const getBotPosition = (): BotPosition => {
if (props.bot.hardware.location_data) {
return props.bot.hardware.location_data.position;
}
return { x: undefined, y: undefined, z: undefined };
};
function stepsPerMmXY(): StepsPerMmXY {
const config = props.bot.hardware.configuration;
@ -43,7 +43,7 @@ export function mapStateToProps(props: Everything) {
toolSlots: joinToolsAndSlot(props.resources.index),
hoveredPlant,
plants,
botPosition,
botPosition: getBotPosition(),
botMcuParams: props.bot.hardware.mcu_params,
stepsPerMmXY: stepsPerMmXY()
};

View File

@ -23,7 +23,7 @@ interface State {
guideOpen: boolean;
}
let hotkeyGuideClasses = [
const hotkeyGuideClasses = [
"hotkey-guide",
"pt-card",
Classes.ELEVATION_4
@ -70,10 +70,10 @@ export class HotKeys extends React.Component<Props, Partial<State>> {
this.setState({ [property]: !this.state[property] });
hotkeys(dispatch: Function, slug: string) {
let idx = _.findIndex(links, { slug });
let right = "/app/" + (links[idx + 1] || links[0]).slug;
let left = "/app/" + (links[idx - 1] || links[links.length - 1]).slug;
let hotkeyMap: IHotkeyProps[] = [
const idx = _.findIndex(links, { slug });
const right = "/app/" + (links[idx + 1] || links[0]).slug;
const left = "/app/" + (links[idx - 1] || links[links.length - 1]).slug;
const hotkeyMap: IHotkeyProps[] = [
{
combo: "ctrl + shift + s",
label: "Sync",
@ -109,7 +109,7 @@ export class HotKeys extends React.Component<Props, Partial<State>> {
}
renderHotkeys() {
let slug = history.getCurrentLocation().pathname.split("/")[2];
const slug = history.getCurrentLocation().pathname.split("/")[2];
return <Hotkeys>
{
this.hotkeys(this.props.dispatch, slug)

View File

@ -67,12 +67,13 @@ export function mapStateToProps(props: Everything): Props {
dispatch(edit(t, { tool_id }));
};
let botPosition: BotPosition;
if (props.bot.hardware.location_data) {
botPosition = props.bot.hardware.location_data.position;
} else {
botPosition = { x: undefined, y: undefined, z: undefined };
}
const getBotPosition = (): BotPosition => {
if (props.bot.hardware.location_data) {
return props.bot.hardware.location_data.position;
}
return { x: undefined, y: undefined, z: undefined };
};
return {
toolSlots,
@ -84,7 +85,7 @@ export function mapStateToProps(props: Everything): Props {
changeToolSlot,
isActive,
dispatch: _.noop,
botPosition
botPosition: getBotPosition()
};
}