Skip to content

Commit 472ea7e

Browse files
sergicalclaude
andauthored
fix(web): find update settings from the command palette (pingdotgg#17396)
Co-authored-by: Claude <[email protected]>
1 parent e1ad595 commit 472ea7e

3 files changed

Lines changed: 32 additions & 2 deletions

File tree

‎apps/web/src/components/settings/SettingsPanels.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ function AboutVersionSection() {
428428
return (
429429
<>
430430
<SettingsRow
431+
id={searchableSetting("app-version").id}
431432
title={<AboutVersionTitle />}
432433
description={description}
433434
control={
@@ -450,7 +451,7 @@ function AboutVersionSection() {
450451
/>
451452
{hasDesktopBridge ? (
452453
<SettingsRow
453-
title="Update track"
454+
{...searchableSetting("update-track")}
454455
description="Use stable releases or nightly builds. Switch back anytime."
455456
control={
456457
<Select
@@ -482,7 +483,7 @@ function AboutVersionSection() {
482483
/>
483484
) : selectedHostedAppChannel ? (
484485
<SettingsRow
485-
title="Update track"
486+
{...searchableSetting("update-track")}
486487
description="Switches the hosted app release channel."
487488
control={
488489
<Select
@@ -3345,6 +3346,7 @@ export function GeneralSettingsPanel() {
33453346
) : (
33463347
<>
33473348
<SettingsRow
3349+
id={searchableSetting("app-version").id}
33483350
title={<AboutVersionTitle />}
33493351
description="Current version of the application."
33503352
/>

‎apps/web/src/components/settings/settingsSearch.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,16 @@ describe("searchSettings", () => {
128128
expect(SETTINGS_SEARCH_ITEMS.some((item) => item.id === "quit-confirmation")).toBe(true);
129129
expect(searchSettings("hold to quit")).toEqual([]);
130130
expect(searchSettings("wsl")).toEqual([]);
131+
expect(searchSettings("update track")).toEqual([]);
132+
});
133+
134+
it("finds the About update rows", () => {
135+
expect(searchSettings("check for updates").map((item) => item.id)).toContain("app-version");
136+
expect(SETTINGS_SEARCH_ITEMS.find((item) => item.id === "update-track")).toMatchObject({
137+
title: "Update track",
138+
to: "/settings/general",
139+
releaseChannelOnly: true,
140+
});
131141
});
132142

133143
it("hides macOS-only settings on other platforms", () => {

‎apps/web/src/components/settings/settingsSearch.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { HOSTED_APP_CHANNEL } from "~/branding";
12
import { isElectron } from "~/env";
23
import { isMacPlatform, isWindowsPlatform, normalizeSearchText } from "~/lib/utils";
34
import { STATIC_KEYBINDING_COMMANDS, type KeybindingCommand } from "@t3tools/contracts";
@@ -53,6 +54,9 @@ export interface SettingsSearchItem {
5354
// Its row only renders on Windows desktop, so other desktop platforms must
5455
// not expose a result that points to a missing anchor.
5556
readonly windowsOnly?: boolean;
57+
// Its row renders only where the release channel can change: the desktop
58+
// app, or a hosted web build deployed with a channel.
59+
readonly releaseChannelOnly?: boolean;
5660
readonly cloudOnly?: boolean;
5761
readonly environmentOnly?: boolean;
5862
readonly providerSettingsOnly?: boolean;
@@ -520,6 +524,19 @@ export const SETTINGS_SEARCH_ITEMS = [
520524
scope: "project-defaults",
521525
searchTerms: ["generated thread titles source control content default provider"],
522526
},
527+
{
528+
id: "app-version",
529+
title: "Version",
530+
to: "/settings/general",
531+
searchTerms: ["about check for updates download install upgrade release"],
532+
},
533+
{
534+
id: "update-track",
535+
title: "Update track",
536+
to: "/settings/general",
537+
searchTerms: ["release channel stable latest nightly prerelease"],
538+
releaseChannelOnly: true,
539+
},
523540
{
524541
id: "cli-command",
525542
title: "t3 command",
@@ -1094,6 +1111,7 @@ export function searchSettings(
10941111
return items
10951112
.flatMap((item, index) => {
10961113
if (!isElectron && item.desktopOnly === true) return [];
1114+
if (item.releaseChannelOnly && !isElectron && HOSTED_APP_CHANNEL === null) return [];
10971115
if (item.macOnly && !isMacPlatform(platform)) return [];
10981116
if (item.windowsOnly && !isWindowsPlatform(platform)) return [];
10991117

0 commit comments

Comments
 (0)