summaryrefslogtreecommitdiff
path: root/Settings.jsx
blob: 768cddd88f6eed3fba4d505af68f348e01f49501 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const { React } = require('powercord/webpack');
const { SelectInput } = require('powercord/components/settings');
const { SETTINGS_TIMEZONE } = require('./constants');
const tz = require('./tz');


module.exports = class Settings extends React.Component {
  constructor (props) {
    super(props);
    this.state = {
      timezone: this.props.getSetting(SETTINGS_TIMEZONE, 'GMT')
    };
  }

  render () {
    return <div>
      <SelectInput
        searchable={true}
        onChange={(e) => {
          this.props.updateSetting(SETTINGS_TIMEZONE, e.value);
          this.setState({ timezone: e.value });
        }}
        value={this.state.timezone}
        options={[
          ...tz.timezones.map(it => ({
            value: it.code,
            label: `${it.name} (${it.offset})`
          }))
        ]}
      >
        My timezone
      </SelectInput>
    </div>;
  }

};
;