Fixed lots of lint issues

This commit is contained in:
Alex Mikhalev 2018-08-06 12:10:34 +03:00
parent 03f317c1ba
commit a3c6fa2b8e
8 changed files with 47 additions and 34 deletions

View File

@ -2,7 +2,7 @@ import { observer } from "mobx-react";
import { RouterStore } from "mobx-react-router";
import * as React from "react";
import { Link } from "react-router-dom";
import { Button, ButtonProps, Icon, Table } from "semantic-ui-react";
import { Button, ButtonProps, Form, Icon, Table } from "semantic-ui-react";
import { ProgramSequenceView, ScheduleView } from "@app/components";
import * as rp from "@app/routePaths";
@ -54,8 +54,10 @@ class ProgramRows extends React.Component<{
const detailRow = expanded && (
<Table.Row>
<Table.Cell className="program--sequence" colSpan="5">
<Form>
<h4>Sequence: </h4> <ProgramSequenceView sequence={sequence} sections={sections} />
<h4>Schedule: </h4> <ScheduleView schedule={schedule}/>
<ScheduleView schedule={schedule} label={<h4>Schedule: </h4>} />
</Form>
</Table.Cell>
</Table.Row>
);

View File

@ -56,7 +56,7 @@ export default class ScheduleDate extends React.Component<ScheduleDateProps, Sch
let labelNode: React.ReactNode = null;
if (typeof label === "string") {
labelNode = <label>{label}</label>
labelNode = <label>{label}</label>;
} else if (label != null) {
labelNode = label;
}

View File

@ -27,10 +27,11 @@ export default class ScheduleTimes extends React.Component<{
</span>
);
}
return (<Form.Field inline className="scheduleTimes">
<label>At</label>
{timesNode}
</Form.Field>);
return (
<Form.Field inline className="scheduleTimes">
<label>At</label> {timesNode}
</Form.Field>
);
}
private onTimeChange = (newTime: TimeOfDay, index: number) => {
const { times, onChange } = this.props;

View File

@ -28,18 +28,22 @@ export default class TimeInput extends React.Component<TimeInputProps, TimeInput
}
return {};
}
constructor(p: any) {
super(p);
this.state = { rawValue: "", lastTime: null };
}
render() {
return <Input type="time" value={this.state.rawValue} onChange={this.onChange} onBlur={this.onBlur} />;
}
private onChange = (e: React.SyntheticEvent<HTMLInputElement>, data: InputOnChangeData) => {
this.setState({
rawValue: data.value,
});
};
}
private onBlur: React.FocusEventHandler<HTMLInputElement> = (e) => {
const m = moment(this.state.rawValue, HTML_TIME_INPUT_FORMAT);
if (m.isValid()) {
@ -47,5 +51,5 @@ export default class TimeInput extends React.Component<TimeInputProps, TimeInput
} else {
this.setState({ rawValue: timeOfDayToHtmlDateInput(this.props.value) });
}
};
}
}

View File

@ -31,9 +31,11 @@ export default class WeekdaysView extends React.Component<WeekdaysViewProps> {
} else {
node = weekdays.map((weekday) => Weekday[weekday]).join(", ");
}
return (<Form.Group inline>
return (
<Form.Group inline>
<label>On</label> {node}
</Form.Group>);
</Form.Group>
);
}
private toggleWeekday = (event: React.FormEvent<HTMLInputElement>, data: CheckboxProps) => {
const { weekdays, onChange } = this.props;

View File

@ -23,7 +23,7 @@ export default class ScheduleView extends React.Component<ScheduleViewProps> {
let labelNode: React.ReactNode;
if (typeof label === "string") {
labelNode = <label>{label}</label>
labelNode = <label>{label}</label>;
} else if (label != null) {
labelNode = label;
}

View File

@ -145,7 +145,11 @@ class ProgramPage extends React.Component<ProgramPageProps> {
</Form.Group>
<Form.Field>
<label><h4>Sequence</h4></label>
<ProgramSequenceView sequence={sequence} sections={this.device.sections} editing={editing}/>
<ProgramSequenceView
sequence={sequence}
sections={this.device.sections}
editing={editing}
/>
</Form.Field>
<ScheduleView schedule={schedule} editing={editing} label={<h4>Schedule</h4>} />
</Form>