Skip to content

Commit ae430d4

Browse files
authored
feat: preview features (experiments settings UI) (#888)
Signed-off-by: Taylor Ho <[email protected]> Signed-off-by: npub1223z34hd7vtwc6qj4s7flsxkj644nlre2nthu7lrrmkumhu3xddsrx9r6w <52a228d6edf316ec6812ac3c9fc0d696ab59fc7954d77e7be31eedcddf91335b@sprout-oss.stage.blox.sqprod.co>
1 parent a357e22 commit ae430d4

27 files changed

Lines changed: 674 additions & 70 deletions

‎desktop/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@
7070
"sonner": "^2.0.7",
7171
"tailwind-merge": "^3.5.0",
7272
"tiptap-markdown": "^0.9.0",
73-
"yaml": "^2.8.3"
73+
"yaml": "^2.8.3",
74+
"zod": "^4.4.3"
7475
},
7576
"devDependencies": {
7677
"@noble/hashes": "^2.0.1",

‎desktop/src/app/routes/channels.$channelId.posts.$postId.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from "react";
22
import { createFileRoute } from "@tanstack/react-router";
33

4+
import { usePreviewFeatureWarning } from "@/shared/features";
45
import { ViewLoadingFallback } from "@/shared/ui/ViewLoadingFallback";
56

67
type ForumPostRouteSearch = {
@@ -29,6 +30,7 @@ const ChannelRouteScreen = React.lazy(async () => {
2930
});
3031

3132
function ForumPostRouteComponent() {
33+
usePreviewFeatureWarning("forum");
3234
const { channelId, postId } = Route.useParams();
3335
const search = Route.useSearch();
3436

‎desktop/src/app/routes/projects.$projectId.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from "react";
22
import { createFileRoute } from "@tanstack/react-router";
33

4+
import { usePreviewFeatureWarning } from "@/shared/features";
45
import { ViewLoadingFallback } from "@/shared/ui/ViewLoadingFallback";
56

67
const ProjectDetailScreen = React.lazy(async () => {
@@ -13,6 +14,7 @@ export const Route = createFileRoute("/projects/$projectId")({
1314
});
1415

1516
function ProjectDetailRouteComponent() {
17+
usePreviewFeatureWarning("projects");
1618
const { projectId } = Route.useParams();
1719

1820
return (

‎desktop/src/app/routes/projects.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from "react";
22
import { createFileRoute } from "@tanstack/react-router";
33

4+
import { usePreviewFeatureWarning } from "@/shared/features";
45
import { ViewLoadingFallback } from "@/shared/ui/ViewLoadingFallback";
56

67
const ProjectsScreen = React.lazy(async () => {
@@ -13,6 +14,7 @@ export const Route = createFileRoute("/projects")({
1314
});
1415

1516
function ProjectsRouteComponent() {
17+
usePreviewFeatureWarning("projects");
1618
return (
1719
<React.Suspense
1820
fallback={<ViewLoadingFallback includeHeader kind="projects" />}

‎desktop/src/app/routes/pulse.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from "react";
22
import { createFileRoute } from "@tanstack/react-router";
33

4+
import { usePreviewFeatureWarning } from "@/shared/features";
45
import { ViewLoadingFallback } from "@/shared/ui/ViewLoadingFallback";
56

67
const PulseScreen = React.lazy(async () => {
@@ -13,6 +14,7 @@ export const Route = createFileRoute("/pulse")({
1314
});
1415

1516
function PulseRouteComponent() {
17+
usePreviewFeatureWarning("pulse");
1618
return (
1719
<React.Suspense
1820
fallback={<ViewLoadingFallback includeHeader kind="pulse" />}

‎desktop/src/app/routes/workflows.$workflowId.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from "react";
22
import { createFileRoute } from "@tanstack/react-router";
33

4+
import { usePreviewFeatureWarning } from "@/shared/features";
45
import { ViewLoadingFallback } from "@/shared/ui/ViewLoadingFallback";
56

67
export const Route = createFileRoute("/workflows/$workflowId")({
@@ -13,6 +14,7 @@ const WorkflowsRouteScreen = React.lazy(async () => {
1314
});
1415

1516
function WorkflowDetailRouteComponent() {
17+
usePreviewFeatureWarning("workflows");
1618
const { workflowId } = Route.useParams();
1719

1820
return (

‎desktop/src/app/routes/workflows.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from "react";
22
import { createFileRoute } from "@tanstack/react-router";
33

4+
import { usePreviewFeatureWarning } from "@/shared/features";
45
import { ViewLoadingFallback } from "@/shared/ui/ViewLoadingFallback";
56

67
export const Route = createFileRoute("/workflows")({
@@ -13,6 +14,7 @@ const WorkflowsRouteScreen = React.lazy(async () => {
1314
});
1415

1516
function WorkflowsRouteComponent() {
17+
usePreviewFeatureWarning("workflows");
1618
return (
1719
<React.Suspense
1820
fallback={<ViewLoadingFallback includeHeader kind="workflows" />}

‎desktop/src/features-manifest.d.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module "@features-manifest" {
2+
const manifest: import("@/shared/features/types").FeaturesManifest;
3+
export default manifest;
4+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { desktopFeatures, useFeatureToggle } from "@/shared/features";
2+
import type { FeatureDefinition } from "@/shared/features";
3+
import { Switch } from "@/shared/ui/switch";
4+
5+
function FeatureRow({ feature }: { feature: FeatureDefinition }) {
6+
const [enabled, toggle] = useFeatureToggle(feature.id);
7+
const switchId = `feature-toggle-${feature.id}`;
8+
9+
return (
10+
<div className="flex items-center justify-between gap-3 rounded-lg border border-border/70 bg-background/70 px-4 py-3">
11+
<div className="min-w-0 flex-1">
12+
<p className="text-sm font-medium" id={`${switchId}-label`}>
13+
{feature.name}
14+
</p>
15+
<p className="text-xs text-muted-foreground">{feature.description}</p>
16+
</div>
17+
<Switch
18+
aria-labelledby={`${switchId}-label`}
19+
checked={enabled}
20+
data-testid={switchId}
21+
onCheckedChange={toggle}
22+
/>
23+
</div>
24+
);
25+
}
26+
27+
export function ExperimentalFeaturesCard() {
28+
// Manifest is preview-only by definition; every desktop entry is a preview
29+
// feature.
30+
const previewFeatures = desktopFeatures;
31+
32+
return (
33+
<section className="min-w-0" data-testid="settings-experimental">
34+
<div className="mb-12 min-w-0">
35+
<h2 className="text-2xl font-semibold tracking-tight">Experiments</h2>
36+
<p className="text-base font-normal text-muted-foreground">
37+
These features are functional but still being refined. Enable them to
38+
try new capabilities early.
39+
</p>
40+
</div>
41+
42+
<div className="flex flex-col gap-2">
43+
{previewFeatures.map((f) => (
44+
<FeatureRow feature={f} key={f.id} />
45+
))}
46+
</div>
47+
</section>
48+
);
49+
}

‎desktop/src/features/settings/ui/SettingsPanels.tsx‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Check,
66
Cpu,
77
Download,
8+
FlaskConical,
89
Keyboard,
910
LayoutTemplate,
1011
LockKeyhole,
@@ -33,6 +34,7 @@ import {
3334
import { SYNTAX_THEMES, isLightTheme } from "@/shared/theme/theme-loader";
3435
import { ChannelTemplatesSettingsCard } from "./ChannelTemplatesSettingsCard";
3536
import { DoctorSettingsPanel } from "./DoctorSettingsPanel";
37+
import { ExperimentalFeaturesCard } from "./ExperimentalFeaturesCard";
3638
import { KeyboardShortcutsCard } from "./KeyboardShortcutsCard";
3739
import { MeshComputeSettingsCard } from "@/features/mesh-compute/ui/MeshComputeSettingsCard";
3840
import { MobilePairingCard } from "./MobilePairingCard";
@@ -44,6 +46,7 @@ import { UpdateChecker } from "../UpdateChecker";
4446
export type SettingsSection =
4547
| "profile"
4648
| "notifications"
49+
| "experimental"
4750
| "agents"
4851
| "channel-templates"
4952
| "compute"
@@ -61,6 +64,8 @@ export type SettingsSectionDescriptor = {
6164
value: SettingsSection;
6265
label: string;
6366
icon: LucideIcon;
67+
/** If set, this section is only visible when the feature is enabled */
68+
featureGate?: string;
6469
};
6570

6671
export type SettingsPanelProps = {
@@ -93,15 +98,22 @@ export const settingsSections: SettingsSectionDescriptor[] = [
9398
label: "Notifications",
9499
icon: BellRing,
95100
},
101+
{
102+
value: "experimental",
103+
label: "Experiments",
104+
icon: FlaskConical,
105+
},
96106
{
97107
value: "agents",
98108
label: "Agents",
99109
icon: Bot,
110+
featureGate: "managed-agents",
100111
},
101112
{
102113
value: "channel-templates",
103114
label: "Templates",
104115
icon: LayoutTemplate,
116+
featureGate: "channel-templates",
105117
},
106118
{
107119
value: "compute",
@@ -122,6 +134,7 @@ export const settingsSections: SettingsSectionDescriptor[] = [
122134
value: "custom-emoji",
123135
label: "Custom Emoji",
124136
icon: Smile,
137+
featureGate: "custom-emoji",
125138
},
126139
{
127140
value: "mobile",
@@ -137,6 +150,7 @@ export const settingsSections: SettingsSectionDescriptor[] = [
137150
value: "doctor",
138151
label: "Doctor",
139152
icon: Stethoscope,
153+
featureGate: "doctor",
140154
},
141155
];
142156

@@ -296,6 +310,8 @@ export function renderSettingsSection(
296310
onSetSoundEnabled={props.onSetSoundEnabled}
297311
/>
298312
);
313+
case "experimental":
314+
return <ExperimentalFeaturesCard />;
299315
case "agents":
300316
return <PreventSleepSettingsCard />;
301317
case "channel-templates":

0 commit comments

Comments
 (0)