fix(web): find update settings from the command palette (#17396)
Co-authored-by: Claude <[email protected]>
This commit is contained in:
1 parent
e1ad595e0f
commit
472ea7ec5f
3 files changed
+32
-2
No files matched your search
@@ -428,6 +428,7 @@ function AboutVersionSection() {
|
||||
return (
|
||||
<>
|
||||
<SettingsRow
|
||||
id={searchableSetting("app-version").id}
|
||||
title={<AboutVersionTitle />}
|
||||
description={description}
|
||||
control={
|
||||
@@ -450,7 +451,7 @@ function AboutVersionSection() {
|
||||
/>
|
||||
{hasDesktopBridge ? (
|
||||
<SettingsRow
|
||||
title="Update track"
|
||||
{...searchableSetting("update-track")}
|
||||
description="Use stable releases or nightly builds. Switch back anytime."
|
||||
control={
|
||||
<Select
|
||||
@@ -482,7 +483,7 @@ function AboutVersionSection() {
|
||||
/>
|
||||
) : selectedHostedAppChannel ? (
|
||||
<SettingsRow
|
||||
title="Update track"
|
||||
{...searchableSetting("update-track")}
|
||||
description="Switches the hosted app release channel."
|
||||
control={
|
||||
<Select
|
||||
@@ -3345,6 +3346,7 @@ export function GeneralSettingsPanel() {
|
||||
) : (
|
||||
<>
|
||||
<SettingsRow
|
||||
id={searchableSetting("app-version").id}
|
||||
title={<AboutVersionTitle />}
|
||||
description="Current version of the application."
|
||||
/>
|
||||
|
||||
@@ -128,6 +128,16 @@ describe("searchSettings", () => {
|
||||
expect(SETTINGS_SEARCH_ITEMS.some((item) => item.id === "quit-confirmation")).toBe(true);
|
||||
expect(searchSettings("hold to quit")).toEqual([]);
|
||||
expect(searchSettings("wsl")).toEqual([]);
|
||||
expect(searchSettings("update track")).toEqual([]);
|
||||
});
|
||||
|
||||
it("finds the About update rows", () => {
|
||||
expect(searchSettings("check for updates").map((item) => item.id)).toContain("app-version");
|
||||
expect(SETTINGS_SEARCH_ITEMS.find((item) => item.id === "update-track")).toMatchObject({
|
||||
title: "Update track",
|
||||
to: "/settings/general",
|
||||
releaseChannelOnly: true,
|
||||
});
|
||||
});
|
||||
|
||||
it("hides macOS-only settings on other platforms", () => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { HOSTED_APP_CHANNEL } from "~/branding";
|
||||
import { isElectron } from "~/env";
|
||||
import { isMacPlatform, isWindowsPlatform, normalizeSearchText } from "~/lib/utils";
|
||||
import { STATIC_KEYBINDING_COMMANDS, type KeybindingCommand } from "@t3tools/contracts";
|
||||
@@ -53,6 +54,9 @@ export interface SettingsSearchItem {
|
||||
// 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;
|
||||
// Its row renders only where the release channel can change: the desktop
|
||||
// app, or a hosted web build deployed with a channel.
|
||||
readonly releaseChannelOnly?: boolean;
|
||||
readonly cloudOnly?: boolean;
|
||||
readonly environmentOnly?: boolean;
|
||||
readonly providerSettingsOnly?: boolean;
|
||||
@@ -520,6 +524,19 @@ export const SETTINGS_SEARCH_ITEMS = [
|
||||
scope: "project-defaults",
|
||||
searchTerms: ["generated thread titles source control content default provider"],
|
||||
},
|
||||
{
|
||||
id: "app-version",
|
||||
title: "Version",
|
||||
to: "/settings/general",
|
||||
searchTerms: ["about check for updates download install upgrade release"],
|
||||
},
|
||||
{
|
||||
id: "update-track",
|
||||
title: "Update track",
|
||||
to: "/settings/general",
|
||||
searchTerms: ["release channel stable latest nightly prerelease"],
|
||||
releaseChannelOnly: true,
|
||||
},
|
||||
{
|
||||
id: "cli-command",
|
||||
title: "t3 command",
|
||||
@@ -1094,6 +1111,7 @@ export function searchSettings(
|
||||
return items
|
||||
.flatMap((item, index) => {
|
||||
if (!isElectron && item.desktopOnly === true) return [];
|
||||
if (item.releaseChannelOnly && !isElectron && HOSTED_APP_CHANNEL === null) return [];
|
||||
if (item.macOnly && !isMacPlatform(platform)) return [];
|
||||
if (item.windowsOnly && !isWindowsPlatform(platform)) return [];
|
||||
|
||||
|
||||
Reference in new issue
Block a user