/** * Copyright (c) OpenLens Authors. All rights reserved. * Licensed under MIT License. See LICENSE in root directory for more information. */ import React from "react"; import { observer } from "mobx-react"; import { SubTitle } from "../layout/sub-title"; import { Select, SelectOption } from "../select"; import { ThemeStore } from "../../theme.store"; import { UserStore } from "../../../common/user-store"; import { Input } from "../input"; import { isWindows } from "../../../common/vars"; import { Switch } from "../switch"; import moment from "moment-timezone"; import { CONSTANTS, defaultExtensionRegistryUrl, ExtensionRegistryLocation } from "../../../common/user-store/preferences-helpers"; import { action, IComputedValue } from "mobx"; import { isUrl } from "../input/input_validators"; import { ExtensionSettings } from "./extension-settings"; import type { RegisteredAppPreference } from "./app-preferences/app-preference-registration"; import { withInjectables } from "@ogre-tools/injectable-react"; import appPreferencesInjectable from "./app-preferences/app-preferences.injectable"; const timezoneOptions: SelectOption[] = moment.tz.names().map(zone => ({ label: zone, value: zone, })); const updateChannelOptions: SelectOption[] = Array.from( CONSTANTS.updateChannels.entries(), ([value, { label }]) => ({ value, label }), ); interface Dependencies { appPreferenceItems: IComputedValue } const NonInjectedApplication: React.FC = ({ appPreferenceItems }) => { const userStore = UserStore.getInstance(); const defaultShell = process.env.SHELL || process.env.PTYSHELL || ( isWindows ? "powershell.exe" : "System default shell" ); const [customUrl, setCustomUrl] = React.useState(userStore.extensionRegistryUrl.customUrl || ""); const [shell, setShell] = React.useState(userStore.shell || ""); const extensionSettings = appPreferenceItems.get().filter((preference) => preference.showInPreferencesTab === "application"); const themeStore = ThemeStore.getInstance(); return (

Application

userStore.terminalTheme = value} />
userStore.shell = shell} />
userStore.terminalCopyOnSelect = !userStore.terminalCopyOnSelect} > Copy on select and paste on right-click

userStore.extensionRegistryUrl.customUrl = customUrl} placeholder="Custom Extension Registry URL..." disabled={userStore.extensionRegistryUrl.location !== ExtensionRegistryLocation.CUSTOM} />

userStore.openAtLogin = !userStore.openAtLogin}> Automatically start Lens on login

{extensionSettings.map(setting => ( ))}
userStore.setLocaleTimezone(value)} themeName="lens" />
); }; export const Application = withInjectables( observer(NonInjectedApplication), { getProps: (di) => ({ appPreferenceItems: di.inject(appPreferencesInjectable), }), }, );