Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nikikim01/batch log better support #64

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
91 changes: 82 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions src/components/FeederActivity.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from "react";

import { Select, MenuItem } from "@material-ui/core";
import { CAR_ACTIVITIES_OPTIONS, DEFAULT_ACTIVITY } from "./MasterActivity";

interface Props {
masterActivity: string;
}

interface State {
myActivity: string;
}

class FeederActivity extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
myActivity: DEFAULT_ACTIVITY,
};
}

componentDidUpdate(prevProps: Props) {
if (prevProps.masterActivity !== this.props.masterActivity) {
this.setState({ myActivity: this.props.masterActivity });
}
}

render() {
return (
<Select
value={this.state.myActivity}
onChange={(evt) => {
this.setState({ myActivity: evt.target.value as string });
}}
>
{CAR_ACTIVITIES_OPTIONS.map((activity) => (
<MenuItem key={activity} value={activity}>
{activity}
</MenuItem>
))}
</Select>
);
}
}

export default FeederActivity;
47 changes: 47 additions & 0 deletions src/components/FeederChassis.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from "react";

import { Select, MenuItem } from "@material-ui/core";
import { CHASSIS_OPTIONS, DEFAULT_CHASSIS } from "./MasterChassis";

interface Props {
masterChassis: string;
}

interface State {
myChassis: string;
}

class FeederChassis extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
myChassis: DEFAULT_CHASSIS,
};
}

componentDidUpdate(prevProps: Props) {
if (prevProps.masterChassis !== this.props.masterChassis) {
this.setState({ myChassis: this.props.masterChassis });
}
}

render() {
return (
<Select
label="Chassis"
value={this.state.myChassis}
onChange={(evt) => {
this.setState({ myChassis: evt.target.value as string });
}}
>
{CHASSIS_OPTIONS.map((chassis) => (
<MenuItem key={chassis} value={chassis}>
{chassis}
</MenuItem>
))}
</Select>
);
}
}

export default FeederChassis;
Loading