Compare commits

...
Author SHA1 Message Date
Julius MarmingeandClaude c5610286c8 Make sidebar v2 the only sidebar
Retires the `sidebarV2Enabled` beta flag and deletes the v1 sidebar.

- `AppSidebarLayout` always renders `SidebarV2`; the settings-route nav
  moves into `SidebarV2` (it lived in v1 only, which is why v1 stayed
  mounted on `/settings*`).
- `data-sidebar-version` is gone: both palettes were already identical,
  so the sidebar tokens key off `data-app-sidebar` instead.
- `chat.new` routes through the command palette whenever there is more
  than one project group, which was the v2 branch.
- Drops the flag from `ClientSettingsSchema`/`ClientSettingsPatch`.
  Stored settings that still carry it decode fine (excess keys are
  ignored), covered by a regression test.
- Removes `sidebarThreadPreviewCount`, whose only reader and only UI
  were in the v1 sidebar, along with the now-orphaned
  `preview/openDiscoveredPort.ts`.

Co-Authored-By: Claude <[email protected]>
2026-07-28 00:47:50 +02:00
11 changed files with 52 additions and 3757 deletions

No files matched your search

@@ -28,8 +28,6 @@ const clientSettings: ClientSettings = {
},
sidebarProjectSortOrder: "manual",
sidebarThreadSortOrder: "created_at",
sidebarThreadPreviewCount: 6,
sidebarV2Enabled: false,
timestampFormat: "24-hour",
wordWrap: true,
};
+2 -11
View File
@@ -14,9 +14,7 @@ import { getLocalStorageItem } from "../hooks/useLocalStorage";
import { resolveShortcutCommand, shortcutLabelForCommand } from "../keybindings";
import { cn, isMacPlatform } from "../lib/utils";
import { primaryServerKeybindingsAtom } from "../state/server";
import { useClientSettings } from "../hooks/useSettings";
import ThreadSidebar from "./Sidebar";
import ThreadSidebarV2 from "./SidebarV2";
import ThreadSidebar from "./SidebarV2";
import { useSidebarStageBackdropVariant } from "./SidebarStageBackdrop";
import {
resolveInitialThreadSidebarWidth,
@@ -115,13 +113,7 @@ function SidebarControl() {
export function AppSidebarLayout({ children }: { children: ReactNode }) {
const navigate = useNavigate();
const sidebarV2Enabled = useClientSettings((settings) => settings.sidebarV2Enabled);
// Settings routes render the settings nav, which lives in the v1 component
// and is identical for both sidebars — so v1 stays mounted there.
const pathname = useLocation({ select: (location) => location.pathname });
const isOnSettings = pathname === "/settings" || pathname.startsWith("/settings/");
const useSidebarV2 = sidebarV2Enabled && !isOnSettings;
const useSidebarV2Theme = useSidebarV2 || isOnSettings;
const isMacosDesktop = isElectron && isMacPlatform(navigator.platform);
const [sidebarWidth, setSidebarWidth] = useState(readInitialThreadSidebarWidth);
// Subscribed rather than read once: the clamp must track live window size,
@@ -185,7 +177,6 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) {
side="left"
collapsible="offcanvas"
data-app-sidebar=""
data-sidebar-version={useSidebarV2Theme ? "v2" : "v1"}
className="border-r border-sidebar-border bg-sidebar text-sidebar-foreground"
resizable={{
maxWidth: sidebarMaximumWidth,
@@ -197,7 +188,7 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) {
onResize: setSidebarWidth,
}}
>
{useSidebarV2 ? <ThreadSidebarV2 /> : <ThreadSidebar />}
<ThreadSidebar />
<SidebarRail />
</Sidebar>
{children}
File diff suppressed because it is too large. Load diff
+16 -1
View File
@@ -46,7 +46,7 @@ import {
type MouseEvent as ReactMouseEvent,
type ReactNode,
} from "react";
import { useParams, useRouter } from "@tanstack/react-router";
import { useLocation, useParams, useRouter } from "@tanstack/react-router";
import {
isAtomCommandInterrupted,
@@ -154,6 +154,7 @@ import { Menu, MenuPopup, MenuRadioGroup, MenuRadioItem, MenuTrigger } from "./u
import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "./ui/select";
import { SidebarContent, SidebarGroup, SidebarMenuButton, useSidebar } from "./ui/sidebar";
import { SidebarChromeFooter, SidebarChromeHeader } from "./sidebar/SidebarChrome";
import { SettingsSidebarNav } from "./settings/SettingsSidebarNav";
import { Popover, PopoverPopup, PopoverTrigger } from "./ui/popover";
import { Tooltip, TooltipPopup, TooltipProvider, TooltipTrigger } from "./ui/tooltip";
import { useComposerDraftStore } from "../composerDraftStore";
@@ -1000,6 +1001,7 @@ export default function SidebarV2() {
const projectOrder = useUiStateStore((store) => store.projectOrder);
const threads = useThreadShells();
const router = useRouter();
const pathname = useLocation({ select: (location) => location.pathname });
const { isMobile, setOpenMobile } = useSidebar();
const keybindings = useAtomValue(primaryServerKeybindingsAtom);
const autoSettleAfterDays = useClientSettings((s) => s.sidebarAutoSettleAfterDays);
@@ -2217,6 +2219,19 @@ export default function SidebarV2() {
const newThreadShortcutLabel =
shortcutLabelForCommand(keybindings, "chat.newLocal") ??
shortcutLabelForCommand(keybindings, "chat.new");
// Settings routes swap the thread list for the settings nav. The component
// stays mounted so sidebar state (project scope, expanded tails) survives a
// trip through settings.
if (pathname === "/settings" || pathname.startsWith("/settings/")) {
return (
<>
<SidebarChromeHeader isElectron={isElectron} />
<SettingsSidebarNav pathname={pathname} />
</>
);
}
return (
<>
<SidebarChromeHeader isElectron={isElectron} />
@@ -1,26 +0,0 @@
import type { DiscoveredLocalServer, ScopedThreadRef } from "@t3tools/contracts";
import {
mapAtomCommandResult,
type AtomCommandResult,
} from "@t3tools/client-runtime/state/runtime";
import { resolveDiscoveredServerUrl } from "~/browser/browserTargetResolver";
import type { OpenPreviewMutation } from "~/browser/openFileInPreview";
import { useRightPanelStore } from "~/rightPanelStore";
import { openPreviewSession } from "./openPreviewSession";
export async function openDiscoveredPort<E>(input: {
readonly threadRef: ScopedThreadRef;
readonly port: DiscoveredLocalServer;
readonly openPreview: OpenPreviewMutation<E>;
}): Promise<AtomCommandResult<void, E>> {
const resolvedUrl = resolveDiscoveredServerUrl(input.threadRef.environmentId, input.port.url);
const result = await openPreviewSession({
openPreview: input.openPreview,
threadRef: input.threadRef,
url: resolvedUrl,
});
return mapAtomCommandResult(result, (snapshot) => {
useRightPanelStore.getState().openBrowser(input.threadRef, snapshot.tabId);
});
}
@@ -51,7 +51,6 @@ function AutoSettleDaysInput({
}
export function BetaSettingsPanel() {
const sidebarV2Enabled = useClientSettings((settings) => settings.sidebarV2Enabled);
const sidebarAutoSettleAfterDays = useClientSettings(
(settings) => settings.sidebarAutoSettleAfterDays,
);
@@ -61,46 +60,31 @@ export function BetaSettingsPanel() {
<SettingsPageContainer>
<SettingsSection title="Beta features">
<SettingsRow
title="Sidebar v2"
description="One flat thread list in creation order. Active work renders as rich cards; settled threads collapse to compact rows. Settling requires an up-to-date server — on older servers threads simply stay active. Switch back any time."
title="Auto-settle inactive threads"
description="Threads with no activity for this long settle automatically. Threads on merged or closed PRs always settle."
control={
<Switch
checked={sidebarV2Enabled}
onCheckedChange={(checked) => updateSettings({ sidebarV2Enabled: Boolean(checked) })}
aria-label="Enable the sidebar v2 beta"
checked={sidebarAutoSettleAfterDays !== null}
onCheckedChange={(checked) =>
updateSettings({
sidebarAutoSettleAfterDays: checked ? AUTO_SETTLE_DEFAULT_DAYS : null,
})
}
aria-label="Auto-settle inactive threads"
/>
}
/>
{sidebarV2Enabled ? (
<>
<SettingsRow
title="Auto-settle inactive threads"
description="Threads with no activity for this long settle automatically. Threads on merged or closed PRs always settle."
control={
<Switch
checked={sidebarAutoSettleAfterDays !== null}
onCheckedChange={(checked) =>
updateSettings({
sidebarAutoSettleAfterDays: checked ? AUTO_SETTLE_DEFAULT_DAYS : null,
})
}
aria-label="Auto-settle inactive threads"
/>
}
/>
{sidebarAutoSettleAfterDays !== null ? (
<SettingsRow
title="Days of inactivity before auto-settle"
description="Any new activity un-settles a thread automatically."
control={
<AutoSettleDaysInput
value={sidebarAutoSettleAfterDays}
onCommit={(days) => updateSettings({ sidebarAutoSettleAfterDays: days })}
/>
}
{sidebarAutoSettleAfterDays !== null ? (
<SettingsRow
title="Days of inactivity before auto-settle"
description="Any new activity un-settles a thread automatically."
control={
<AutoSettleDaysInput
value={sidebarAutoSettleAfterDays}
onCommit={(days) => updateSettings({ sidebarAutoSettleAfterDays: days })}
/>
) : null}
</>
}
/>
) : null}
</SettingsSection>
</SettingsPageContainer>
@@ -404,9 +404,6 @@ export function useSettingsRestore(onRestored?: () => void) {
...(settings.timestampFormat !== DEFAULT_UNIFIED_SETTINGS.timestampFormat
? ["Time format"]
: []),
...(settings.sidebarThreadPreviewCount !== DEFAULT_UNIFIED_SETTINGS.sidebarThreadPreviewCount
? ["Visible threads"]
: []),
...(settings.sidebarProjectGroupingMode !==
DEFAULT_UNIFIED_SETTINGS.sidebarProjectGroupingMode
? ["Project Grouping"]
@@ -461,7 +458,6 @@ export function useSettingsRestore(onRestored?: () => void) {
settings.enableAssistantStreaming,
settings.enableProviderUpdateChecks,
settings.sidebarProjectGroupingMode,
settings.sidebarThreadPreviewCount,
settings.timestampFormat,
settings.wordWrap,
theme,
@@ -484,7 +480,6 @@ export function useSettingsRestore(onRestored?: () => void) {
wordWrap: DEFAULT_UNIFIED_SETTINGS.wordWrap,
diffIgnoreWhitespace: DEFAULT_UNIFIED_SETTINGS.diffIgnoreWhitespace,
glassOpacity: DEFAULT_UNIFIED_SETTINGS.glassOpacity,
sidebarThreadPreviewCount: DEFAULT_UNIFIED_SETTINGS.sidebarThreadPreviewCount,
sidebarProjectGroupingMode: DEFAULT_UNIFIED_SETTINGS.sidebarProjectGroupingMode,
autoOpenPlanSidebar: DEFAULT_UNIFIED_SETTINGS.autoOpenPlanSidebar,
enableAssistantStreaming: DEFAULT_UNIFIED_SETTINGS.enableAssistantStreaming,
+4 -8
View File
@@ -895,12 +895,9 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
}
}
/* Keep both navigation implementations on the same quiet zinc hierarchy:
zinc-50 navigation, zinc-25 hover, and white selected/raised surfaces.
The version attribute remains useful for layout-specific styling without
changing the color system when the beta is toggled. */
[data-sidebar-version="v1"],
[data-sidebar-version="v2"] {
/* Keep the navigation on its own quiet zinc hierarchy: zinc-50 navigation,
zinc-25 hover, and white selected/raised surfaces. */
[data-app-sidebar] {
--background: var(--color-zinc-25);
--foreground: var(--color-zinc-800);
--card: var(--color-white);
@@ -923,8 +920,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
background-color: var(--sidebar);
}
.dark [data-sidebar-version="v1"],
.dark [data-sidebar-version="v2"] {
.dark [data-app-sidebar] {
--background: #000;
--foreground: #f1f3f7;
--card: #000;
+4 -6
View File
@@ -28,7 +28,6 @@ function ChatRouteGlobalShortcuts() {
const { activeDraftThread, activeThread, defaultProjectRef, handleNewThread, routeThreadRef } =
useHandleNewThread();
const keybindings = useAtomValue(primaryServerKeybindingsAtom);
const sidebarV2Enabled = useClientSettings((settings) => settings.sidebarV2Enabled);
const projectGroupingSettings = useClientSettings(selectProjectGroupingSettings);
const projects = useProjects();
const primaryEnvironmentId = usePrimaryEnvironmentId();
@@ -92,10 +91,10 @@ function ChatRouteGlobalShortcuts() {
if (command === "chat.new") {
event.preventDefault();
event.stopPropagation();
// Sidebar v2 routes creation through the command palette whenever
// there is a real choice to make; v1 (and single-project setups)
// keep the immediate contextual create.
if (sidebarV2Enabled && projectGroupCount > 1) {
// Creation routes through the command palette whenever there is a real
// choice to make; single-project setups keep the immediate contextual
// create.
if (projectGroupCount > 1) {
openCommandPalette({ open: "new-thread-in" });
return;
}
@@ -167,7 +166,6 @@ function ChatRouteGlobalShortcuts() {
projectGroupCount,
routeThreadRef,
selectedThreadKeysSize,
sidebarV2Enabled,
terminalOpen,
]);
+7 -5
View File
@@ -49,11 +49,13 @@ describe("ClientSettings glass opacity", () => {
});
});
describe("ClientSettings sidebar v2", () => {
it("defaults the beta off with a three-day auto-settle threshold", () => {
const settings = decodeClientSettings({});
expect(settings.sidebarV2Enabled).toBe(false);
expect(settings.sidebarAutoSettleAfterDays).toBe(3);
describe("ClientSettings sidebar auto-settle", () => {
it("defaults to a three-day auto-settle threshold", () => {
expect(decodeClientSettings({}).sidebarAutoSettleAfterDays).toBe(3);
});
it("ignores the retired sidebar v2 beta flag left in stored settings", () => {
expect(() => decodeClientSettings({ sidebarV2Enabled: true })).not.toThrow();
});
it("allows auto-settle by inactivity to be disabled", () => {
-16
View File
@@ -28,16 +28,6 @@ export const SidebarProjectGroupingMode = Schema.Literals([
]);
export type SidebarProjectGroupingMode = typeof SidebarProjectGroupingMode.Type;
export const DEFAULT_SIDEBAR_PROJECT_GROUPING_MODE: SidebarProjectGroupingMode = "repository";
export const MIN_SIDEBAR_THREAD_PREVIEW_COUNT = 1;
export const MAX_SIDEBAR_THREAD_PREVIEW_COUNT = 15;
export const SidebarThreadPreviewCount = Schema.Int.check(
Schema.isBetween({
minimum: MIN_SIDEBAR_THREAD_PREVIEW_COUNT,
maximum: MAX_SIDEBAR_THREAD_PREVIEW_COUNT,
}),
);
export type SidebarThreadPreviewCount = typeof SidebarThreadPreviewCount.Type;
export const DEFAULT_SIDEBAR_THREAD_PREVIEW_COUNT: SidebarThreadPreviewCount = 6;
export const MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS = 1;
export const MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS = 90;
export const SidebarAutoSettleAfterDays = Schema.Number.check(
@@ -111,10 +101,6 @@ export const ClientSettingsSchema = Schema.Struct({
sidebarThreadSortOrder: SidebarThreadSortOrder.pipe(
Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_THREAD_SORT_ORDER)),
),
sidebarThreadPreviewCount: SidebarThreadPreviewCount.pipe(
Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_THREAD_PREVIEW_COUNT)),
),
sidebarV2Enabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
timestampFormat: TimestampFormat.pipe(
Schema.withDecodingDefault(Effect.succeed(DEFAULT_TIMESTAMP_FORMAT)),
),
@@ -634,8 +620,6 @@ export const ClientSettingsPatch = Schema.Struct({
),
sidebarProjectSortOrder: Schema.optionalKey(SidebarProjectSortOrder),
sidebarThreadSortOrder: Schema.optionalKey(SidebarThreadSortOrder),
sidebarThreadPreviewCount: Schema.optionalKey(SidebarThreadPreviewCount),
sidebarV2Enabled: Schema.optionalKey(Schema.Boolean),
timestampFormat: Schema.optionalKey(TimestampFormat),
wordWrap: Schema.optionalKey(Schema.Boolean),
});