import React, { Component } from 'react'; import { connect } from 'react-redux'; import { Option } from 'react-select'; import moment from 'moment'; import 'moment-timezone'; import translate from 'translations'; import { scheduleActions, scheduleSelectors } from 'features/schedule'; import { AppState } from 'features/reducers'; import { Query } from 'components/renderCbs'; import { Dropdown } from 'components/ui'; interface DispatchProps { setScheduleTimezone: scheduleActions.TSetScheduleTimezone; } interface StateProps { currentScheduleTimezone: scheduleSelectors.ICurrentScheduleTimezone; } type Props = DispatchProps & StateProps; class ScheduleTimezoneDropDownClass extends Component { public render() { const { currentScheduleTimezone } = this.props; const allTimezones = moment.tz.names(); return (
); } private handleOnChange = (timezone: Option | null) => { if (!timezone) { return; } if (!timezone.value) { throw Error('No timezone value found'); } this.props.setScheduleTimezone({ value: timezone.value, raw: timezone.value }); }; } export const ScheduleTimezoneDropDown = connect( (state: AppState) => ({ currentScheduleTimezone: scheduleSelectors.getCurrentScheduleTimezone(state) }), { setScheduleTimezone: scheduleActions.setScheduleTimezone } )(ScheduleTimezoneDropDownClass);