Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/web/src/components/settings/ConnectionsSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2769,7 +2769,7 @@ export function ConnectionsSettings() {
if (desktopWslError && canManageLocalBackend) {
return (
<SettingsRow
title="WSL backend"
{...searchableSetting("wsl-backend")}
description="Couldn't load the WSL backend state."
status={<span className="block text-destructive">{desktopWslError}</span>}
control={
Expand Down Expand Up @@ -2798,7 +2798,7 @@ export function ConnectionsSettings() {
if (!desktopWslState.enabled && !desktopWslState.wslOnly) return null;
return (
<SettingsRow
title="WSL backend"
{...searchableSetting("wsl-backend")}
description="WSL is no longer available, so the Windows backend is running instead. Switch off the WSL backend to clear this preference."
status={
desktopWslError ? (
Expand Down Expand Up @@ -2835,7 +2835,7 @@ export function ConnectionsSettings() {
return (
<>
<SettingsRow
title="WSL backend"
{...searchableSetting("wsl-backend")}
description="Run a second backend inside a WSL distro alongside the Windows one. Pick a distro to start it; pick Off to stop it. Projects opened against the WSL backend live on the Linux side; Windows projects stay where they are."
status={
desktopWslError ? (
Expand Down
11 changes: 11 additions & 0 deletions apps/web/src/components/settings/settingsSearch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ describe("searchSettings", () => {
it("hides desktop-only settings from browser search", () => {
expect(SETTINGS_SEARCH_ITEMS.some((item) => item.id === "quit-confirmation")).toBe(true);
expect(searchSettings("quit confirmation")).toEqual([]);
expect(searchSettings("wsl")).toEqual([]);
});

it("registers the WSL backend as a desktop-only setting", () => {
expect(SETTINGS_SEARCH_ITEMS).toContainEqual({
id: "wsl-backend",
title: "WSL backend",
to: "/settings/connections",
desktopOnly: true,
windowsOnly: true,
});
});

it("keeps catalog result ids unique", () => {
Expand Down
13 changes: 13 additions & 0 deletions apps/web/src/components/settings/settingsSearch.ts
Comment thread
macroscopeapp[bot] marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { isElectron } from "~/env";
import { isWindowsPlatform } from "~/lib/utils";

export type SettingsPath =
| "/settings/general"
Expand All @@ -18,6 +19,9 @@ export interface SettingsSearchItem {
// Its row only renders in the desktop app, so a browser result would land on
// an anchor that isn't there.
readonly desktopOnly?: boolean;
// Its row only renders on Windows desktop, so other desktop platforms must
// not expose a result that points to a missing anchor.
readonly windowsOnly?: boolean;
}

/**
Expand Down Expand Up @@ -259,6 +263,13 @@ export const SETTINGS_SEARCH_ITEMS = [
title: "Remote environments",
to: "/settings/connections",
},
{
id: "wsl-backend",
title: "WSL backend",
to: "/settings/connections",
desktopOnly: true,
Comment thread
macroscopeapp[bot] marked this conversation as resolved.
windowsOnly: true,
},
Comment thread
UtkarshUsername marked this conversation as resolved.
{
id: "archive",
title: "Archived threads",
Expand Down Expand Up @@ -304,6 +315,8 @@ export function searchSettings(
return items.filter(
(item) =>
(isElectron || item.desktopOnly !== true) &&
(!item.windowsOnly ||
isWindowsPlatform(typeof navigator === "undefined" ? "" : navigator.platform)) &&
normalizeSearchText(item.title).includes(normalizedQuery),
);
}
Loading