Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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: 4 additions & 2 deletions apps/web/src/components/settings/SettingsPanels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ function AboutVersionSection() {
return (
<>
<SettingsRow
id={searchableSetting("app-version").id}
title={<AboutVersionTitle />}
description={description}
control={
Expand All @@ -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
Expand Down Expand Up @@ -482,7 +483,7 @@ function AboutVersionSection() {
/>
) : selectedHostedAppChannel ? (
<SettingsRow
title="Update track"
{...searchableSetting("update-track")}
description="Switches the hosted app release channel."
control={
<Select
Expand Down Expand Up @@ -3345,6 +3346,7 @@ export function GeneralSettingsPanel() {
) : (
<>
<SettingsRow
id={searchableSetting("app-version").id}
title={<AboutVersionTitle />}
description="Current version of the application."
/>
Expand Down
10 changes: 10 additions & 0 deletions apps/web/src/components/settings/settingsSearch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
18 changes: 18 additions & 0 deletions apps/web/src/components/settings/settingsSearch.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -503,6 +507,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",
Expand Down Expand Up @@ -1077,6 +1094,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 [];

Expand Down
Loading