import React, { Component } from 'react'; import { setScheduleTimezone, TSetScheduleTimezone } from 'actions/schedule'; import { getCurrentScheduleTimezone, ICurrentScheduleTimezone } from 'selectors/schedule'; import { AppState } from 'reducers'; import { Query } from 'components/renderCbs'; import { connect } from 'react-redux'; import { Option } from 'react-select'; import { Dropdown } from 'components/ui'; import moment from 'moment'; import 'moment-timezone'; import translate from 'translations'; interface DispatchProps { setScheduleTimezone: TSetScheduleTimezone; } interface StateProps { currentScheduleTimezone: 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: getCurrentScheduleTimezone(state) }), { setScheduleTimezone } )(ScheduleTimezoneDropDownClass);