diff --git a/src/common/front-end-routing/routes/preferences/app/app-preferences-route.injectable.ts b/src/common/front-end-routing/routes/preferences/app/app-preferences-route.injectable.ts deleted file mode 100644 index b4dfe5c05b..0000000000 --- a/src/common/front-end-routing/routes/preferences/app/app-preferences-route.injectable.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { getInjectable } from "@ogre-tools/injectable"; -import { computed } from "mobx"; -import { frontEndRouteInjectionToken } from "../../../front-end-route-injection-token"; - -const appPreferencesRouteInjectable = getInjectable({ - id: "app-preferences-route", - - instantiate: () => ({ - path: "/preferences/app", - clusterFrame: false, - isEnabled: computed(() => true), - }), - - injectionToken: frontEndRouteInjectionToken, -}); - -export default appPreferencesRouteInjectable; diff --git a/src/common/front-end-routing/routes/preferences/editor/editor-preferences-route.injectable.ts b/src/common/front-end-routing/routes/preferences/editor/editor-preferences-route.injectable.ts deleted file mode 100644 index ca6cbf8a70..0000000000 --- a/src/common/front-end-routing/routes/preferences/editor/editor-preferences-route.injectable.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { getInjectable } from "@ogre-tools/injectable"; -import { computed } from "mobx"; -import { frontEndRouteInjectionToken } from "../../../front-end-route-injection-token"; - -const editorPreferencesRouteInjectable = getInjectable({ - id: "editor-preferences-route", - - instantiate: () => ({ - path: "/preferences/editor", - clusterFrame: false, - isEnabled: computed(() => true), - }), - - injectionToken: frontEndRouteInjectionToken, -}); - -export default editorPreferencesRouteInjectable; diff --git a/src/common/front-end-routing/routes/preferences/kubernetes/kubernetes-preferences-route.injectable.ts b/src/common/front-end-routing/routes/preferences/kubernetes/kubernetes-preferences-route.injectable.ts deleted file mode 100644 index 7b3479c7fa..0000000000 --- a/src/common/front-end-routing/routes/preferences/kubernetes/kubernetes-preferences-route.injectable.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { getInjectable } from "@ogre-tools/injectable"; -import { computed } from "mobx"; -import { frontEndRouteInjectionToken } from "../../../front-end-route-injection-token"; - -const kubernetesPreferencesRouteInjectable = getInjectable({ - id: "kubernetes-preferences-route", - - instantiate: () => ({ - path: "/preferences/kubernetes", - clusterFrame: false, - isEnabled: computed(() => true), - }), - - injectionToken: frontEndRouteInjectionToken, -}); - -export default kubernetesPreferencesRouteInjectable; diff --git a/src/common/front-end-routing/routes/preferences/proxy/proxy-preferences-route.injectable.ts b/src/common/front-end-routing/routes/preferences/proxy/proxy-preferences-route.injectable.ts deleted file mode 100644 index 322e711225..0000000000 --- a/src/common/front-end-routing/routes/preferences/proxy/proxy-preferences-route.injectable.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { getInjectable } from "@ogre-tools/injectable"; -import { computed } from "mobx"; -import { frontEndRouteInjectionToken } from "../../../front-end-route-injection-token"; - -const proxyPreferencesRouteInjectable = getInjectable({ - id: "proxy-preferences-route", - - instantiate: () => ({ - path: "/preferences/proxy", - clusterFrame: false, - isEnabled: computed(() => true), - }), - - injectionToken: frontEndRouteInjectionToken, -}); - -export default proxyPreferencesRouteInjectable; diff --git a/src/common/front-end-routing/routes/preferences/telemetry/telemetry-preferences-route.injectable.ts b/src/common/front-end-routing/routes/preferences/telemetry/telemetry-preferences-route.injectable.ts deleted file mode 100644 index 2ae9f14acd..0000000000 --- a/src/common/front-end-routing/routes/preferences/telemetry/telemetry-preferences-route.injectable.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { getInjectable } from "@ogre-tools/injectable"; -import { computed } from "mobx"; -import { frontEndRouteInjectionToken } from "../../../front-end-route-injection-token"; - -const telemetryPreferencesRouteInjectable = getInjectable({ - id: "telemetry-preferences-route", - - instantiate: () => ({ - path: "/preferences/telemetry", - clusterFrame: false, - isEnabled: computed(() => true), - }), - - injectionToken: frontEndRouteInjectionToken, -}); - -export default telemetryPreferencesRouteInjectable; diff --git a/src/common/front-end-routing/routes/preferences/terminal/terminal-preferences-route.injectable.ts b/src/common/front-end-routing/routes/preferences/terminal/terminal-preferences-route.injectable.ts deleted file mode 100644 index c077c45bab..0000000000 --- a/src/common/front-end-routing/routes/preferences/terminal/terminal-preferences-route.injectable.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { getInjectable } from "@ogre-tools/injectable"; -import { computed } from "mobx"; -import { frontEndRouteInjectionToken } from "../../../front-end-route-injection-token"; - -const terminalPreferencesRouteInjectable = getInjectable({ - id: "terminal-preferences-route", - - instantiate: () => ({ - path: "/preferences/terminal", - clusterFrame: false, - isEnabled: computed(() => true), - }), - - injectionToken: frontEndRouteInjectionToken, -}); - -export default terminalPreferencesRouteInjectable; diff --git a/src/renderer/components/+preferences/app-preferences-route-component.injectable.ts b/src/renderer/components/+preferences/app-preferences-route-component.injectable.ts deleted file mode 100644 index aa887c2df9..0000000000 --- a/src/renderer/components/+preferences/app-preferences-route-component.injectable.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { getInjectable } from "@ogre-tools/injectable"; -import { routeSpecificComponentInjectionToken } from "../../routes/route-specific-component-injection-token"; -import appPreferencesRouteInjectable from "../../../common/front-end-routing/routes/preferences/app/app-preferences-route.injectable"; -import { Application } from "./application"; - -const appPreferencesRouteComponentInjectable = getInjectable({ - id: "app-preferences-route-component", - - instantiate: (di) => ({ - route: di.inject(appPreferencesRouteInjectable), - Component: Application, - }), - - injectionToken: routeSpecificComponentInjectionToken, -}); - -export default appPreferencesRouteComponentInjectable; diff --git a/src/renderer/components/+preferences/application.tsx b/src/renderer/components/+preferences/application.tsx deleted file mode 100644 index ee460fd4d7..0000000000 --- a/src/renderer/components/+preferences/application.tsx +++ /dev/null @@ -1,193 +0,0 @@ -/** - * 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 } from "../select"; -import type { ThemeStore } from "../../themes/store"; -import type { UserStore } from "../../../common/user-store"; -import { Input } from "../input"; -import { Switch } from "../switch"; -import moment from "moment-timezone"; -import { defaultExtensionRegistryUrl, defaultLocaleTimezone, defaultExtensionRegistryUrlLocation } from "../../../common/user-store/preferences-helpers"; -import type { IComputedValue } from "mobx"; -import { runInAction } 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"; -import { Preferences } from "./preferences"; -import userStoreInjectable from "../../../common/user-store/user-store.injectable"; -import themeStoreInjectable from "../../themes/store.injectable"; -import { defaultThemeId } from "../../../common/vars"; -import { updateChannels } from "../../../features/application-update/common/update-channels"; -import { map, toPairs } from "lodash/fp"; -import { pipeline } from "@ogre-tools/fp"; -import type { SelectedUpdateChannel } from "../../../features/application-update/common/selected-update-channel/selected-update-channel.injectable"; -import selectedUpdateChannelInjectable from "../../../features/application-update/common/selected-update-channel/selected-update-channel.injectable"; - -interface Dependencies { - appPreferenceItems: IComputedValue; - userStore: UserStore; - themeStore: ThemeStore; - selectedUpdateChannel: SelectedUpdateChannel; -} - -const timezoneOptions = moment.tz.names() - .map(timezone => ({ - value: timezone, - label: timezone.replace("_", " "), - })); - -const updateChannelOptions = pipeline( - toPairs(updateChannels), - - map(([, channel]) => ({ - value: channel.id, - label: channel.label, - })), -); - -const extensionInstallRegistryOptions = [ - { - value: "default", - label: "Default Url", - }, - { - value: "npmrc", - label: "Global .npmrc file's Url", - }, - { - value: "custom", - label: "Custom Url", - }, -] as const; - -const NonInjectedApplication: React.FC = ({ appPreferenceItems, userStore, themeStore, selectedUpdateChannel }) => { - const [customUrl, setCustomUrl] = React.useState(userStore.extensionRegistryUrl.customUrl || ""); - const themeOptions = [ - { - value: "system", // TODO: replace with a sentinal value that isn't string (and serialize it differently) - label: "Sync with computer", - }, - ...Array.from(themeStore.themes, ([themeId, { name }]) => ({ - value: themeId, - label: name, - })), - ]; - const extensionSettings = appPreferenceItems.get() - .filter((preference) => preference.showInPreferencesTab === "application"); - - return ( - -
-

Application

-
- - runInAction(() => { - userStore.extensionRegistryUrl.location = value?.value ?? defaultExtensionRegistryUrlLocation; - - if (userStore.extensionRegistryUrl.location === "custom") { - userStore.extensionRegistryUrl.customUrl = ""; - } - })} - themeName="lens" - /> -

- {"This setting is to change the registry URL for installing extensions by name. "} - {`If you are unable to access the default registry (${defaultExtensionRegistryUrl}) you can change it in your `} - .npmrc - {" file or in the input below."} -

- - userStore.extensionRegistryUrl.customUrl = customUrl} - placeholder="Custom Extension Registry URL..." - disabled={userStore.extensionRegistryUrl.location !== "custom"} - /> -
- -
- -
- - userStore.openAtLogin = !userStore.openAtLogin}> - Automatically start Lens on login - -
- -
- - {extensionSettings.map(setting => ( - - ))} - -
- - userStore.localeTimezone = value?.value ?? defaultLocaleTimezone} - themeName="lens" - /> -
-
-
- ); -}; - -export const Application = withInjectables( - observer(NonInjectedApplication), - - { - getProps: (di) => ({ - appPreferenceItems: di.inject(appPreferencesInjectable), - userStore: di.inject(userStoreInjectable), - themeStore: di.inject(themeStoreInjectable), - selectedUpdateChannel: di.inject(selectedUpdateChannelInjectable), - }), - }, -); diff --git a/src/renderer/components/+preferences/editor-preferences-route-component.injectable.ts b/src/renderer/components/+preferences/editor-preferences-route-component.injectable.ts deleted file mode 100644 index a51d95438b..0000000000 --- a/src/renderer/components/+preferences/editor-preferences-route-component.injectable.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { getInjectable } from "@ogre-tools/injectable"; -import { routeSpecificComponentInjectionToken } from "../../routes/route-specific-component-injection-token"; -import { Editor } from "./editor"; -import editorPreferencesRouteInjectable from "../../../common/front-end-routing/routes/preferences/editor/editor-preferences-route.injectable"; - -const editorPreferencesRouteComponentInjectable = getInjectable({ - id: "editor-preferences-route-component", - - instantiate: (di) => ({ - route: di.inject(editorPreferencesRouteInjectable), - Component: Editor, - }), - - injectionToken: routeSpecificComponentInjectionToken, -}); - -export default editorPreferencesRouteComponentInjectable; diff --git a/src/renderer/components/+preferences/editor.tsx b/src/renderer/components/+preferences/editor.tsx deleted file mode 100644 index 4405dc949c..0000000000 --- a/src/renderer/components/+preferences/editor.tsx +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { observer } from "mobx-react"; -import React from "react"; -import type { UserStore } from "../../../common/user-store"; -import { Switch } from "../switch"; -import { Select } from "../select"; -import { SubTitle } from "../layout/sub-title"; -import { SubHeader } from "../layout/sub-header"; -import { Input, InputValidators } from "../input"; -import { Preferences } from "./preferences"; -import { withInjectables } from "@ogre-tools/injectable-react"; -import userStoreInjectable from "../../../common/user-store/user-store.injectable"; -import { defaultEditorConfig } from "../../../common/user-store/preferences-helpers"; -import { capitalize } from "lodash"; - -interface Dependencies { - userStore: UserStore; -} - -const minimapPositionOptions = (["left", "right"] as const) - .map(side => ({ - value: side, - label: side, - })); -const lineNumberOptions = ([ - "on", - "off", - "relative", - "interval", -] as const).map(lineNumbers => ({ - value: lineNumbers, - label: capitalize(lineNumbers), -})); - -const NonInjectedEditor = observer(({ userStore }: Dependencies) => { - const editorConfiguration = userStore.editorConfiguration; - - return ( - -
-

Editor configuration

- - -
-
-
- editorConfiguration.minimap.enabled = !editorConfiguration.minimap.enabled} - > - Show minimap - -
-
- Position - editorConfiguration.lineNumbers = option?.value ?? defaultEditorConfig.lineNumbers} - themeName="lens" - /> -
- -
- - editorConfiguration.tabSize = Number(value)} - /> -
-
- - editorConfiguration.fontSize = Number(value)} - /> -
-
- - editorConfiguration.fontFamily = value} - /> -
-
-
- ); -}); - -export const Editor = withInjectables( - NonInjectedEditor, - - { - getProps: (di) => ({ - userStore: di.inject(userStoreInjectable), - }), - }, -); - - diff --git a/src/renderer/components/+preferences/kubernetes-preferences-route-component.injectable.ts b/src/renderer/components/+preferences/kubernetes-preferences-route-component.injectable.ts deleted file mode 100644 index 51c33f73a6..0000000000 --- a/src/renderer/components/+preferences/kubernetes-preferences-route-component.injectable.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { getInjectable } from "@ogre-tools/injectable"; -import { routeSpecificComponentInjectionToken } from "../../routes/route-specific-component-injection-token"; -import kubernetesPreferencesRouteInjectable from "../../../common/front-end-routing/routes/preferences/kubernetes/kubernetes-preferences-route.injectable"; -import { Kubernetes } from "./kubernetes"; - -const kubernetesPreferencesRouteComponentInjectable = getInjectable({ - id: "kubernetes-preferences-route-component", - - instantiate: (di) => ({ - route: di.inject(kubernetesPreferencesRouteInjectable), - Component: Kubernetes, - }), - - injectionToken: routeSpecificComponentInjectionToken, -}); - -export default kubernetesPreferencesRouteComponentInjectable; diff --git a/src/renderer/components/+preferences/kubernetes.tsx b/src/renderer/components/+preferences/kubernetes.tsx deleted file mode 100644 index 5e7982d9e7..0000000000 --- a/src/renderer/components/+preferences/kubernetes.tsx +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { observer } from "mobx-react"; -import React from "react"; -import { HelmCharts } from "../../../features/helm-charts/child-features/preferences/renderer/helm-charts"; -import { KubeconfigSync } from "../../../features/preferences/renderer/preference-items/kubernetes/kubeconfig-sync/kubeconfig-sync"; -import { KubectlBinaries } from "./kubectl-binaries"; -import { Preferences } from "./preferences"; - -export const Kubernetes = observer(() => ( - -
-
-

Kubernetes

- -
-
- -
- -
-
-)); diff --git a/src/renderer/components/+preferences/proxy-preferences-route-component.injectable.ts b/src/renderer/components/+preferences/proxy-preferences-route-component.injectable.ts deleted file mode 100644 index 62540dfc42..0000000000 --- a/src/renderer/components/+preferences/proxy-preferences-route-component.injectable.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { getInjectable } from "@ogre-tools/injectable"; -import { routeSpecificComponentInjectionToken } from "../../routes/route-specific-component-injection-token"; -import proxyPreferencesRouteInjectable from "../../../common/front-end-routing/routes/preferences/proxy/proxy-preferences-route.injectable"; -import { LensProxy } from "./proxy"; - -const proxyPreferencesRouteComponentInjectable = getInjectable({ - id: "proxy-preferences-route-component", - - instantiate: (di) => ({ - route: di.inject(proxyPreferencesRouteInjectable), - Component: LensProxy, - }), - - injectionToken: routeSpecificComponentInjectionToken, -}); - -export default proxyPreferencesRouteComponentInjectable; diff --git a/src/renderer/components/+preferences/proxy.tsx b/src/renderer/components/+preferences/proxy.tsx deleted file mode 100644 index a87b2261a1..0000000000 --- a/src/renderer/components/+preferences/proxy.tsx +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { withInjectables } from "@ogre-tools/injectable-react"; -import { observer } from "mobx-react"; -import React from "react"; -import type { UserStore } from "../../../common/user-store"; -import { Input } from "../input"; -import { SubTitle } from "../layout/sub-title"; -import { Switch } from "../switch"; -import { Preferences } from "./preferences"; -import userStoreInjectable from "../../../common/user-store/user-store.injectable"; - -interface Dependencies { - userStore: UserStore; -} - -const NonInjectedLensProxy = observer(({ userStore }: Dependencies) => { - const [proxy, setProxy] = React.useState(userStore.httpsProxy || ""); - - return ( - -
-
-

Proxy

- - setProxy(v)} - onBlur={() => userStore.httpsProxy = proxy} - /> - - Proxy is used only for non-cluster communication. - -
- -
- -
- - userStore.allowUntrustedCAs = !userStore.allowUntrustedCAs} - > - Allow untrusted Certificate Authorities - - - This will make Lens to trust ANY certificate authority without any validations. - {" "} - Needed with some corporate proxies that do certificate re-writing. - {" "} - Does not affect cluster communications! - -
-
-
- ); -}); - -export const LensProxy = withInjectables( - NonInjectedLensProxy, - - { - getProps: (di) => ({ - userStore: di.inject(userStoreInjectable), - }), - }, -); diff --git a/src/renderer/components/+preferences/telemetry-preferences-route-component.injectable.ts b/src/renderer/components/+preferences/telemetry-preferences-route-component.injectable.ts deleted file mode 100644 index 6d78ecfccc..0000000000 --- a/src/renderer/components/+preferences/telemetry-preferences-route-component.injectable.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { getInjectable } from "@ogre-tools/injectable"; -import { routeSpecificComponentInjectionToken } from "../../routes/route-specific-component-injection-token"; -import telemetryPreferencesRouteInjectable from "../../../common/front-end-routing/routes/preferences/telemetry/telemetry-preferences-route.injectable"; -import { Telemetry } from "./telemetry"; - -const telemetryPreferencesRouteComponentInjectable = getInjectable({ - id: "telemetry-preferences-route-component", - - instantiate: (di) => ({ - route: di.inject(telemetryPreferencesRouteInjectable), - Component: Telemetry, - }), - - injectionToken: routeSpecificComponentInjectionToken, -}); - -export default telemetryPreferencesRouteComponentInjectable; diff --git a/src/renderer/components/+preferences/telemetry.tsx b/src/renderer/components/+preferences/telemetry.tsx deleted file mode 100644 index 6367042c61..0000000000 --- a/src/renderer/components/+preferences/telemetry.tsx +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { observer } from "mobx-react"; -import React from "react"; -import type { UserStore } from "../../../common/user-store"; -import { Checkbox } from "../checkbox"; -import { SubTitle } from "../layout/sub-title"; -import { ExtensionSettings } from "./extension-settings"; -import type { IComputedValue } from "mobx"; -import { withInjectables } from "@ogre-tools/injectable-react"; -import { Preferences } from "./preferences"; -import telemetryPreferenceItemsInjectable from "./telemetry-preference-items.injectable"; -import sentryDataSourceNameInjectable from "../../../common/vars/sentry-dsn-url.injectable"; -import userStoreInjectable from "../../../common/user-store/user-store.injectable"; -import type { AppPreferenceRegistration } from "./app-preferences/app-preference-registration"; - -interface Dependencies { - telemetryPreferenceItems: IComputedValue; - sentryDnsUrl: string; - userStore: UserStore; -} - -const NonInjectedTelemetry: React.FC = ({ - telemetryPreferenceItems, - sentryDnsUrl, - userStore, -}) => ( - -
-

Telemetry

- {telemetryPreferenceItems.get().map((item) => ( - - ))} - {sentryDnsUrl ? ( - -
- - userStore.allowErrorReporting = value} - /> -
- - Automatic error reports provide vital information about issues - and application crashes. It is highly recommended to keep this - feature enabled to ensure fast turnaround for issues you might - encounter. - -
-
-
-
- ) : // we don't need to shows the checkbox at all if Sentry dsn is not a valid url - null} -
-
-); - -export const Telemetry = withInjectables( - observer(NonInjectedTelemetry), - - { - getProps: (di) => ({ - telemetryPreferenceItems: di.inject(telemetryPreferenceItemsInjectable), - sentryDnsUrl: di.inject(sentryDataSourceNameInjectable), - userStore: di.inject(userStoreInjectable), - }), - }, -); diff --git a/src/renderer/components/+preferences/terminal-preferences-route-component.injectable.ts b/src/renderer/components/+preferences/terminal-preferences-route-component.injectable.ts deleted file mode 100644 index e23a4520a8..0000000000 --- a/src/renderer/components/+preferences/terminal-preferences-route-component.injectable.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { getInjectable } from "@ogre-tools/injectable"; -import { routeSpecificComponentInjectionToken } from "../../routes/route-specific-component-injection-token"; -import terminalPreferencesRouteInjectable from "../../../common/front-end-routing/routes/preferences/terminal/terminal-preferences-route.injectable"; -import { Terminal } from "./terminal"; - -const terminalPreferencesRouteComponentInjectable = getInjectable({ - id: "terminal-preferences-route-component", - - instantiate: (di) => ({ - route: di.inject(terminalPreferencesRouteInjectable), - Component: Terminal, - }), - - injectionToken: routeSpecificComponentInjectionToken, -}); - -export default terminalPreferencesRouteComponentInjectable; diff --git a/src/renderer/components/+preferences/terminal.tsx b/src/renderer/components/+preferences/terminal.tsx deleted file mode 100644 index 57c3ad6394..0000000000 --- a/src/renderer/components/+preferences/terminal.tsx +++ /dev/null @@ -1,138 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ - -import React from "react"; -import { action } from "mobx"; -import { observer } from "mobx-react"; -import type { UserStore } from "../../../common/user-store"; -import { SubTitle } from "../layout/sub-title"; -import { Input } from "../input"; -import { Switch } from "../switch"; -import { Select, type SelectOption } from "../select"; -import type { ThemeStore } from "../../themes/store"; -import { Preferences } from "./preferences"; -import { withInjectables } from "@ogre-tools/injectable-react"; -import userStoreInjectable from "../../../common/user-store/user-store.injectable"; -import themeStoreInjectable from "../../themes/store.injectable"; -import defaultShellInjectable from "./default-shell.injectable"; -import logger from "../../../common/logger"; - -interface Dependencies { - userStore: UserStore; - themeStore: ThemeStore; - defaultShell: string; -} - -const NonInjectedTerminal = observer(( - { - userStore, - themeStore, - defaultShell, - }: Dependencies) => { - const themeOptions = [ - { - value: "", // TODO: replace with a sentinal value that isn't string (and serialize it differently) - label: "Match Lens Theme", - }, - ...Array.from(themeStore.themes, ([themeId, { name }]) => ({ - value: themeId, - label: name, - })), - ]; - - // fonts must be declared in `fonts.scss` and at `template.html` (if early-preloading required) - const supportedCustomFonts: SelectOption[] = [ - "RobotoMono", "Anonymous Pro", "IBM Plex Mono", "JetBrains Mono", "Red Hat Mono", - "Source Code Pro", "Space Mono", "Ubuntu Mono", - ].map(customFont => { - const { fontFamily, fontSize } = userStore.terminalConfig; - - return { - label: {customFont}, - value: customFont, - isSelected: fontFamily === customFont, - }; - }); - - const onFontFamilyChange = action(({ value: fontFamily }: SelectOption) => { - logger.info(`setting terminal font to ${fontFamily}`); - - userStore.terminalConfig.fontFamily = fontFamily; // save to external storage - }); - - return ( - -
-

Terminal

- -
- - userStore.shell = value} - /> -
- -
- - userStore.terminalCopyOnSelect = !userStore.terminalCopyOnSelect} - > - Copy on select and paste on right-click - -
- -
- - userStore.terminalConfig.fontSize = Number(value)} - /> -
-
- -