Add ability to configure the locale timezone (#2523)

This commit is contained in:
Arthur Knoepflin authored and GitHub committed 2021-04-20 09:26:52 -04:00
1 parent 8d42d40433
commit 52ebcc4fdb
11 files changed
+84 -8

No files matched your search

@@ -1,6 +1,7 @@
import "./preferences.scss";
import React from "react";
import moment from "moment-timezone";
import { computed, observable, reaction } from "mobx";
import { disposeOnUnmount, observer } from "mobx-react";
@@ -40,6 +41,11 @@ export class Preferences extends React.Component {
}));
}
timezoneOptions: SelectOption<string>[] = moment.tz.names().map(zone => ({
label: zone,
value: zone,
}));
componentDidMount() {
disposeOnUnmount(this, [
reaction(() => navigation.location.hash, hash => {
@@ -95,7 +101,7 @@ export class Preferences extends React.Component {
const { preferences } = userStore;
const extensions = appPreferenceRegistry.getItems();
const telemetryExtensions = extensions.filter(e => e.showInPreferencesTab == Pages.Telemetry);
let defaultShell = process.env.SHELL || process.env.PTYSHELL;
let defaultShell = process.env.SHELL || process.env.PTYSHELL;
if (!defaultShell) {
if (isWindows) {
@@ -153,6 +159,18 @@ export class Preferences extends React.Component {
label="Automatically start Lens on login"
/>
</section>
<hr />
<section id="locale">
<SubTitle title="Locale Timezone" />
<Select
options={this.timezoneOptions}
value={preferences.localeTimezone}
onChange={({ value }: SelectOption) => userStore.setLocaleTimezone(value)}
themeName="lens"
/>
</section>
</section>
)}
{this.activeTab == Pages.Proxy && (