diff --git a/src/js/components/root.js b/src/js/components/root.js index 50505a5..e5803c2 100644 --- a/src/js/components/root.js +++ b/src/js/components/root.js @@ -12,6 +12,50 @@ function isSundaySchedule(curTime) { return isSunday; } +function getOptionsFromStations(stations) { + return _.map(stations, (station) => { + const abbr = station.abbr; + const name = station.name; + return ; + }); +} + +class ScheduleWidget extends Component { + constructor(props) { + super(props); + this.state = { station: "" }; + } + + static getDerivedStateFromProps(props, state) { + if (state.station === "" && props.stations && props.stations[0]) { + const abbr = props.stations[0].abbr; + return { station: abbr } + } + return null; + } + getSchedule(evt) { + console.log("Get schedule"); + evt.preventDefault(); + } + + changeStation(evt) { + const value = evt.target.value; + this.setState({station: value}); + } + + render() { + const stations = this.props.stations; + return (