@devries-cameron20 / t3code-1 / commits / 71ea5fa1ab
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Show disabled reasons for unavailable right panel surfaces (#3093)

Julius Marminge committed Jun 15, 2026 at 16:21 UTC 71ea5fa1abcd7a3156a5fe003596b724b9fdc68b
2 files changed +90 -26
apps/web/src/components/ChatView.browser.tsx
-8
@@ -2129,10 +2129,6 @@ describe("ChatView timeline estimator parity (full app)", () => {
2129 () => document.querySelector<HTMLButtonElement>('button[aria-label="Toggle right panel"]'),
2130 "Unable to find right panel toggle.",
2131 );
2132 - const headerActions = await waitForElement(
2133 - () => document.querySelector<HTMLElement>("[data-chat-header-actions]"),
2134 - "Unable to find chat header actions.",
2135 - );
2132 const chatHeader = await waitForElement(
2133 () => document.querySelector<HTMLElement>("[data-chat-header]"),
2134 "Unable to find chat header.",
@@ -2163,10 +2159,6 @@ describe("ChatView timeline estimator parity (full app)", () => {
2159 true,
2160 );
2161 expect(initialRightPanelRect.left - initialTerminalRect.right).toBe(4);
2166 - expect(
2167 - initialTerminalRect.left -
2168 - (headerActions.lastElementChild?.getBoundingClientRect().right ?? Number.NaN),
2169 - ).toBe(4);
2162
2163 document.documentElement.classList.add("wco");
2164 expect(panelLayoutControls.getBoundingClientRect().height).toBe(52);
apps/web/src/components/RightPanelTabs.tsx
+90 -18
@@ -1,7 +1,7 @@
1 import type { PreviewSessionSnapshot } from "@t3tools/contracts";
2 import { getTerminalLabel } from "@t3tools/shared/terminalLabels";
3 import { ClipboardList, FileDiff, Files, Globe2, Plus, TerminalSquare, X } from "lucide-react";
4 -import { type ReactNode, useEffect, useRef, useState } from "react";
4 +import { type ReactElement, type ReactNode, useEffect, useRef, useState } from "react";
5
6 import { isElectron } from "~/env";
7 import type { RightPanelSurface } from "~/rightPanelStore";
@@ -35,6 +35,40 @@ interface RightPanelTabsProps {
35 children: ReactNode;
36 }
37
38 +const SURFACE_DISABLED_REASONS = {
39 + browser: "Browser previews are only available in the T3 Code desktop app.",
40 + files: "Files are only available when a project is open.",
41 + diff: "Diff is only available for server threads in Git repositories.",
42 +} as const;
43 +
44 +function DisabledReasonTooltip(props: { reason: string; trigger: ReactElement }) {
45 + return (
46 + <Tooltip>
47 + <TooltipTrigger render={props.trigger} />
48 + <TooltipPopup side="top">{props.reason}</TooltipPopup>
49 + </Tooltip>
50 + );
51 +}
52 +
53 +function SurfaceMenuItem(props: {
54 + available: boolean;
55 + disabledReason?: string;
56 + onClick: () => void;
57 + children: ReactNode;
58 +}) {
59 + const item = (
60 + <MenuItem
61 + className={!props.available ? "data-disabled:pointer-events-auto" : undefined}
62 + onClick={props.onClick}
63 + disabled={!props.available}
64 + >
65 + {props.children}
66 + </MenuItem>
67 + );
68 + if (props.available || !props.disabledReason) return item;
69 + return <DisabledReasonTooltip reason={props.disabledReason} trigger={item} />;
70 +}
71 +
72 function RightPanelEmptyState(props: {
73 onAddBrowser: () => void;
74 onAddTerminal: () => void;
@@ -50,6 +84,7 @@ function RightPanelEmptyState(props: {
84 description: "Open a local app or URL.",
85 icon: Globe2,
86 available: props.browserAvailable,
87 + disabledReason: SURFACE_DISABLED_REASONS.browser,
88 onClick: props.onAddBrowser,
89 },
90 {
@@ -57,6 +92,7 @@ function RightPanelEmptyState(props: {
92 description: "Start a shell in this workspace.",
93 icon: TerminalSquare,
94 available: true,
95 + disabledReason: null,
96 onClick: props.onAddTerminal,
97 },
98 {
@@ -64,6 +100,7 @@ function RightPanelEmptyState(props: {
100 description: "Browse and read workspace files.",
101 icon: Files,
102 available: props.filesAvailable,
103 + disabledReason: SURFACE_DISABLED_REASONS.files,
104 onClick: props.onAddFiles,
105 },
106 {
@@ -71,6 +108,7 @@ function RightPanelEmptyState(props: {
108 description: "Review changes in this thread.",
109 icon: FileDiff,
110 available: props.diffAvailable,
111 + disabledReason: SURFACE_DISABLED_REASONS.diff,
112 onClick: props.onAddDiff,
113 },
114 ] as const;
@@ -84,24 +122,46 @@ function RightPanelEmptyState(props: {
122 Choose what to show in the right panel.
123 </p>
124 </div>
87 - <div className="grid gap-2 sm:grid-cols-2 lg:grid-cols-4">
125 + <div className="grid grid-cols-2 gap-2">
126 {actions.map((action) => {
127 const Icon = action.icon;
90 - return (
91 - <button
92 - key={action.label}
93 - type="button"
94 - disabled={!action.available}
95 - onClick={action.onClick}
96 - className="flex min-h-28 flex-col items-start rounded-lg border border-border/80 bg-card/40 p-4 text-left transition hover:border-border hover:bg-accent/60 disabled:cursor-not-allowed disabled:opacity-40"
97 - >
128 + const content = (
129 + <>
130 <Icon className="mb-3 size-5" />
131 <span className="text-sm font-medium">{action.label}</span>
132 <span className="mt-1 text-xs leading-relaxed text-muted-foreground">
133 {action.description}
134 </span>
135 + </>
136 + );
137 + if (action.available) {
138 + return (
139 + <button
140 + key={action.label}
141 + type="button"
142 + onClick={action.onClick}
143 + className="flex min-h-28 w-full flex-col items-start rounded-lg border border-border/80 bg-card/40 p-4 text-left transition hover:border-border hover:bg-accent/60"
144 + >
145 + {content}
146 + </button>
147 + );
148 + }
149 + const disabledCard = (
150 + <button
151 + type="button"
152 + className="flex min-h-28 w-full cursor-not-allowed flex-col items-start rounded-lg border border-border/80 bg-card/40 p-4 text-left opacity-40"
153 + aria-disabled="true"
154 + >
155 + {content}
156 </button>
157 );
158 + return (
159 + <DisabledReasonTooltip
160 + key={action.label}
161 + reason={action.disabledReason}
162 + trigger={disabledCard}
163 + />
164 + );
165 })}
166 </div>
167 </div>
@@ -290,22 +350,34 @@ export function RightPanelTabs(props: RightPanelTabsProps) {
350 <Plus className="size-4" />
351 </MenuTrigger>
352 <MenuPopup align="start" side="bottom" sideOffset={6} className="min-w-44">
293 - <MenuItem onClick={props.onAddBrowser} disabled={!props.browserAvailable}>
353 + <SurfaceMenuItem
354 + available={props.browserAvailable}
355 + disabledReason={SURFACE_DISABLED_REASONS.browser}
356 + onClick={props.onAddBrowser}
357 + >
358 <Globe2 />
359 Browser
296 - </MenuItem>
297 - <MenuItem onClick={props.onAddTerminal}>
360 + </SurfaceMenuItem>
361 + <SurfaceMenuItem available onClick={props.onAddTerminal}>
362 <TerminalSquare />
363 Terminal
300 - </MenuItem>
301 - <MenuItem onClick={props.onAddFiles} disabled={!props.filesAvailable}>
364 + </SurfaceMenuItem>
365 + <SurfaceMenuItem
366 + available={props.filesAvailable}
367 + disabledReason={SURFACE_DISABLED_REASONS.files}
368 + onClick={props.onAddFiles}
369 + >
370 <Files />
371 Files
304 - </MenuItem>
305 - <MenuItem onClick={props.onAddDiff} disabled={!props.diffAvailable}>
372 + </SurfaceMenuItem>
373 + <SurfaceMenuItem
374 + available={props.diffAvailable}
375 + disabledReason={SURFACE_DISABLED_REASONS.diff}
376 + onClick={props.onAddDiff}
377 + >
378 <FileDiff />
379 Diff
308 - </MenuItem>
380 + </SurfaceMenuItem>
381 </MenuPopup>
382 </Menu>
383 ) : null}