GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge pull request 'feat(web): one fork-features flag gates Home, the… · yasinuslu/t3code@7b4e047

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/web/src
    • components
      • AppSidebarLayout.tsx
      • CommandPalette.tsx
      • settings
        • SettingsPanels.tsx
        • settingsSearch.ts
      • sidebar
        • SidebarHomeEntry.tsx
    • homeOverlayStore.test.ts
    • homeOverlayStore.ts
    • hooks
      • useSettings.ts
  • packages/contracts/src
    • settings.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/web/src/components/AppSidebarLayout.tsx‎

Copy file name to clipboardExpand all lines: apps/web/src/components/AppSidebarLayout.tsx
+18-6Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useAtomValue } from "@effect/atom-react";
22
import * as Schema from "effect/Schema";
33
import {
44
useEffect,
5+
useLayoutEffect,
56
useState,
67
useSyncExternalStore,
78
type CSSProperties,
@@ -25,15 +26,19 @@ import { selectThreadTerminalUiState, useTerminalUiStateStore } from "../termina
2526
import { resolveThreadRouteRef } from "../threadRoutes";
2627
import { cn, isMacPlatform } from "../lib/utils";
2728
import { primaryServerKeybindingsAtom } from "../state/server";
28-
import { useEnvironmentIdentificationMode, useLegacySidebarEnabled } from "../hooks/useSettings";
29+
import {
30+
useEnvironmentIdentificationMode,
31+
useForkFeatures,
32+
useLegacySidebarEnabled,
33+
} from "../hooks/useSettings";
2934
import {
3035
PanelAnimationSuppressionProvider,
3136
usePanelAnimationSettings,
3237
usePanelNavigationSuppression,
3338
} from "../panelAnimations";
3439
import { BrainstormHost } from "./brainstorm/BrainstormHost";
3540
import { HomeOverlay } from "./home/HomeOverlay";
36-
import { useHomeOverlayStore } from "../homeOverlayStore";
41+
import { setHomeOverlayEnabled, useHomeOverlayStore } from "../homeOverlayStore";
3742
import { ModeShortcuts, ModeSwitch } from "./ModeSwitch";
3843
import { PhoneTabBar } from "./PhoneTabBar";
3944
import LegacyThreadSidebar from "./LegacySidebar";
@@ -229,6 +234,9 @@ function ProjectProjectionRetention() {
229234
export function AppSidebarLayout({ children }: { children: ReactNode }) {
230235
const navigate = useNavigate();
231236
const legacySidebarEnabled = useLegacySidebarEnabled();
237+
const forkFeatures = useForkFeatures();
238+
// Before first paint, so a reloaded Home never flashes while the flag is off.
239+
useLayoutEffect(() => setHomeOverlayEnabled(forkFeatures), [forkFeatures]);
232240
const { active: panelAnimationsActive, durationMs: panelAnimationDurationMs } =
233241
usePanelAnimationSettings();
234242
// Settings routes show the settings nav in place of whichever thread
@@ -347,11 +355,15 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) {
347355
<SidebarRail onDoubleClick={resetSidebarWidth} />
348356
</Sidebar>
349357
{children}
350-
<HomeOverlay />
358+
{forkFeatures ? <HomeOverlay /> : null}
351359
<SidebarControl />
352-
<ModeSwitch />
353-
<PhoneTabBar />
354-
<ModeShortcuts />
360+
{forkFeatures ? (
361+
<>
362+
<ModeSwitch />
363+
<PhoneTabBar />
364+
<ModeShortcuts />
365+
</>
366+
) : null}
355367
<NavigationHistoryShortcuts />
356368
<MainAppLocationTracker />
357369
</SidebarProvider>
Collapse file

‎apps/web/src/components/CommandPalette.tsx‎

Copy file name to clipboardExpand all lines: apps/web/src/components/CommandPalette.tsx
+30-27Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ import { useDesktopLocalBootstraps } from "../connection/useDesktopLocalBootstra
8989
import { useHandleNewThread } from "../hooks/useHandleNewThread";
9090
import { useOpenPanelPullRequestUrl } from "../hooks/useOpenPanelPullRequestUrl";
9191
import { writeTextToClipboard } from "../hooks/useCopyToClipboard";
92-
import { useClientSettings } from "../hooks/useSettings";
92+
import { useClientSettings, useForkFeatures } from "../hooks/useSettings";
9393
import { useTheme } from "../hooks/useTheme";
9494
import { useCustomThemes } from "../hooks/useCustomThemes";
9595
import { useEnvironmentThemeDefinitions } from "../hooks/useEnvironmentTheme";
@@ -729,6 +729,7 @@ function OpenCommandPaletteDialog(props: {
729729
setHighlightedItemValue(null);
730730
}
731731
const clientSettings = useClientSettings();
732+
const forkFeatures = useForkFeatures();
732733
const createProject = useAtomCommand(projectEnvironment.create, {
733734
reportFailure: false,
734735
});
@@ -2251,36 +2252,38 @@ function OpenCommandPaletteDialog(props: {
22512252
});
22522253
}
22532254

2254-
actionItems.push({
2255-
kind: "action",
2256-
value: "action:manager",
2257-
searchTerms: ["home", "manager", "dashboard", "work", "goals", "tasks", "status", "plan"],
2258-
title: "Go home (manager and work)",
2259-
icon: <CompassIcon className={ITEM_ICON_CLASS} />,
2260-
shortcutCommand: "manager.open",
2261-
run: async () => openManagerHome(),
2262-
});
2263-
2264-
for (const entry of APP_MODES) {
2255+
if (forkFeatures) {
22652256
actionItems.push({
22662257
kind: "action",
2267-
value: `action:mode-${entry.mode}`,
2268-
searchTerms: [
2269-
"mode",
2270-
"switch",
2271-
"view",
2272-
"grow",
2273-
"manager",
2274-
"classic",
2275-
"normal",
2276-
"threads",
2277-
"t3",
2278-
],
2279-
title: `Switch to ${entry.label} mode`,
2258+
value: "action:manager",
2259+
searchTerms: ["home", "manager", "dashboard", "work", "goals", "tasks", "status", "plan"],
2260+
title: "Go home (manager and work)",
22802261
icon: <CompassIcon className={ITEM_ICON_CLASS} />,
2281-
shortcutCommand: entry.command,
2282-
run: async () => setAppMode(entry.mode),
2262+
shortcutCommand: "manager.open",
2263+
run: async () => openManagerHome(),
22832264
});
2265+
2266+
for (const entry of APP_MODES) {
2267+
actionItems.push({
2268+
kind: "action",
2269+
value: `action:mode-${entry.mode}`,
2270+
searchTerms: [
2271+
"mode",
2272+
"switch",
2273+
"view",
2274+
"grow",
2275+
"manager",
2276+
"classic",
2277+
"normal",
2278+
"threads",
2279+
"t3",
2280+
],
2281+
title: `Switch to ${entry.label} mode`,
2282+
icon: <CompassIcon className={ITEM_ICON_CLASS} />,
2283+
shortcutCommand: entry.command,
2284+
run: async () => setAppMode(entry.mode),
2285+
});
2286+
}
22842287
}
22852288

22862289
actionItems.push({
Collapse file

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

Copy file name to clipboardExpand all lines: apps/web/src/components/settings/SettingsPanels.tsx
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,7 @@ export function useSettingsRestore(onRestored?: () => void) {
587587
...(settings.snoozeLimitedThreads !== DEFAULT_UNIFIED_SETTINGS.snoozeLimitedThreads
588588
? ["Snooze limited threads"]
589589
: []),
590+
...(settings.forkFeatures !== DEFAULT_UNIFIED_SETTINGS.forkFeatures ? ["Fork features"] : []),
590591
...(settings.hostsManager !== DEFAULT_UNIFIED_SETTINGS.hostsManager
591592
? ["Host the manager"]
592593
: []),
@@ -711,6 +712,7 @@ export function useSettingsRestore(onRestored?: () => void) {
711712
settings.sidebarAutoSettleOnMerge,
712713
settings.autoResumeLimitedThreads,
713714
settings.snoozeLimitedThreads,
715+
settings.forkFeatures,
714716
settings.hostsManager,
715717
settings.managerProfiles,
716718
settings.sidebarProjectGroupingMode,
@@ -820,6 +822,7 @@ export function useSettingsRestore(onRestored?: () => void) {
820822
sidebarAutoSettleOnMerge: DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleOnMerge,
821823
autoResumeLimitedThreads: DEFAULT_UNIFIED_SETTINGS.autoResumeLimitedThreads,
822824
snoozeLimitedThreads: DEFAULT_UNIFIED_SETTINGS.snoozeLimitedThreads,
825+
forkFeatures: DEFAULT_UNIFIED_SETTINGS.forkFeatures,
823826
hostsManager: DEFAULT_UNIFIED_SETTINGS.hostsManager,
824827
managerProfiles: DEFAULT_UNIFIED_SETTINGS.managerProfiles,
825828
responseStreamingMode: DEFAULT_UNIFIED_SETTINGS.responseStreamingMode,
@@ -2413,6 +2416,20 @@ export function GeneralSettingsPanel() {
24132416
/>
24142417
}
24152418
/>
2419+
<SettingsRow
2420+
serverScoped
2421+
{...searchableSetting("fork-features")}
2422+
description="Home with Grow and the Manager, the mode switch and its shortcuts. Turn off to use the app as upstream T3 Code ships it."
2423+
settingKeys={["forkFeatures"]}
2424+
control={
2425+
<ScopedSwitch
2426+
settingKeys={["forkFeatures"]}
2427+
checked={settings.forkFeatures}
2428+
onCheckedChange={(checked) => updateSettings({ forkFeatures: Boolean(checked) })}
2429+
aria-label="Fork features"
2430+
/>
2431+
}
2432+
/>
24162433
<SettingsRow
24172434
serverScoped
24182435
{...searchableSetting("host-manager")}
Collapse file

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

Copy file name to clipboardExpand all lines: apps/web/src/components/settings/settingsSearch.ts
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,12 @@ export const SETTINGS_SEARCH_ITEMS = [
292292
to: "/settings/general",
293293
searchTerms: ["usage quota rate limit reset wake recover continue"],
294294
},
295+
{
296+
id: "fork-features",
297+
title: "Fork features",
298+
to: "/settings/general",
299+
searchTerms: ["grow manager home mode upstream fork flag switch"],
300+
},
295301
{
296302
id: "host-manager",
297303
title: "Host the manager",
Collapse file

‎apps/web/src/components/sidebar/SidebarHomeEntry.tsx‎

Copy file name to clipboardExpand all lines: apps/web/src/components/sidebar/SidebarHomeEntry.tsx
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
} from "../../brainstormStore";
1212
import { openManagerHome, useOpenManagerThreadPage } from "../brainstorm/useOpenManagerThread";
1313
import { useMediaQuery } from "../../hooks/useMediaQuery";
14+
import { useForkFeatures } from "../../hooks/useSettings";
1415
import { shortcutLabelForCommand } from "../../keybindings";
1516
import { useAtomValue } from "@effect/atom-react";
1617
import { primaryServerKeybindingsAtom } from "../../state/server";
@@ -24,6 +25,10 @@ import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
2425
* the active profile's manager thread.
2526
*/
2627
export const SidebarHomeEntry = memo(function SidebarHomeEntry() {
28+
return useForkFeatures() ? <HomeEntry /> : null;
29+
});
30+
31+
function HomeEntry() {
2732
const keybindings = useAtomValue(primaryServerKeybindingsAtom);
2833
const managerKeys = useManagerThreadKeys();
2934
const allThreads = useThreadShellsWithoutBrainstorms();
@@ -89,4 +94,4 @@ export const SidebarHomeEntry = memo(function SidebarHomeEntry() {
8994
</Tooltip>
9095
</div>
9196
);
92-
});
97+
}
Collapse file

‎apps/web/src/homeOverlayStore.test.ts‎

Copy file name to clipboard
+35Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { afterEach, describe, expect, it } from "vitest";
2+
3+
import {
4+
closeHomeOverlay,
5+
openHomeOverlay,
6+
setHomeOverlayEnabled,
7+
toggleHomeOverlay,
8+
useHomeOverlayStore,
9+
} from "./homeOverlayStore";
10+
11+
describe("Home while the fork features are off", () => {
12+
afterEach(() => {
13+
setHomeOverlayEnabled(true);
14+
closeHomeOverlay();
15+
});
16+
17+
it("closes an open Home and refuses to open it again", () => {
18+
openHomeOverlay();
19+
expect(useHomeOverlayStore.getState().open).toBe(true);
20+
21+
setHomeOverlayEnabled(false);
22+
expect(useHomeOverlayStore.getState().open).toBe(false);
23+
24+
openHomeOverlay();
25+
toggleHomeOverlay();
26+
expect(useHomeOverlayStore.getState().open).toBe(false);
27+
});
28+
29+
it("opens again once the features are back on", () => {
30+
setHomeOverlayEnabled(false);
31+
setHomeOverlayEnabled(true);
32+
openHomeOverlay();
33+
expect(useHomeOverlayStore.getState().open).toBe(true);
34+
});
35+
});
Collapse file

‎apps/web/src/homeOverlayStore.ts‎

Copy file name to clipboardExpand all lines: apps/web/src/homeOverlayStore.ts
+11-2Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,21 @@ const lastWasClosed = () => {
3434
}
3535
};
3636

37+
// Home belongs to the fork features: while they are off, nothing can open it.
38+
let homeEnabled = true;
39+
3740
export const useHomeOverlayStore = create<HomeOverlayStore>()((set) => ({
3841
open: reopened,
39-
setOpen: (open) => set({ open }),
40-
toggle: () => set((state) => ({ open: !state.open })),
42+
setOpen: (open) => set({ open: open && homeEnabled }),
43+
toggle: () => set((state) => ({ open: !state.open && homeEnabled })),
4144
}));
4245

46+
/** Called by the app shell with the `forkFeatures` setting; turning it off closes Home. */
47+
export function setHomeOverlayEnabled(enabled: boolean) {
48+
homeEnabled = enabled;
49+
if (!enabled) useHomeOverlayStore.setState({ open: false });
50+
}
51+
4352
export const openHomeOverlay = () => useHomeOverlayStore.getState().setOpen(true);
4453

4554
let openedOnStartup = reopened;
Collapse file

‎apps/web/src/hooks/useSettings.ts‎

Copy file name to clipboardExpand all lines: apps/web/src/hooks/useSettings.ts
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,15 @@ export function useLegacySidebarEnabled(): boolean {
380380
return settingsHydrated && legacySidebarEnabled;
381381
}
382382

383+
/**
384+
* Whether the fork's additions are on (`forkFeatures`), read from the primary
385+
* environment. Chrome that only exists in this fork asks this; it is on while
386+
* the settings are still loading and in the hosted app, which has no primary.
387+
*/
388+
export function useForkFeatures(): boolean {
389+
return useAtomValue(primaryServerSettingsAtom).forkFeatures;
390+
}
391+
383392
/** Read current settings for one environment, merged with client-local preferences. */
384393
export function useEnvironmentSettings<T = UnifiedSettings>(
385394
environmentId: EnvironmentId,
Collapse file

‎packages/contracts/src/settings.ts‎

Copy file name to clipboardExpand all lines: packages/contracts/src/settings.ts
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,12 @@ export const ServerSettings = Schema.Struct({
13531353
* that sets this, else on their primary one.
13541354
*/
13551355
hostsManager: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
1356+
/**
1357+
* The master switch for everything this fork adds on top of upstream T3 Code
1358+
* (Home with Grow and the Manager, the mode switch and its shortcuts, and
1359+
* whatever gets gated behind it next). Off, the app behaves like upstream.
1360+
*/
1361+
forkFeatures: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
13561362
/**
13571363
* Code profiles whose managers this server runs, so each profile's manager
13581364
* can live on the machine that does that profile's work. A server that
@@ -1731,6 +1737,7 @@ export const ServerSettingsPatch = Schema.Struct({
17311737
autoResumeLimitedThreads: Schema.optionalKey(Schema.Boolean),
17321738
snoozeLimitedThreads: Schema.optionalKey(Schema.Boolean),
17331739
hostsManager: Schema.optionalKey(Schema.Boolean),
1740+
forkFeatures: Schema.optionalKey(Schema.Boolean),
17341741
managerProfiles: Schema.optionalKey(Schema.Array(TrimmedNonEmptyString)),
17351742
backgroundActivity: Schema.optionalKey(
17361743
Schema.Struct({

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.