@devries-cameron20 / t3code Mirror · read-only / commits / 6975efd3dd
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 23:00 UTC

fix(web): the pull request badge reads at the meta size again (#13175)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Julius Marminge committed Sep 22, 2026 at 19:00 UTC 6975efd3dd52c95dd978ff26f591139d8c5c2503
4 files changed +65 -47
apps/web/src/components/BranchToolbarBranchSelector.tsx
+2 -1
@@ -59,6 +59,7 @@ import {
59 useLinkedThreadPullRequest,
60 } from "./ThreadStatusIndicators";
61 import { Button } from "./ui/button";
62 +import { ComposerControl } from "./chat/ComposerControl";
63 import { Switch } from "./ui/switch";
64 import { getVirtualizedScrollFadeClassName } from "./ui/scroll-area";
65 import {
@@ -790,7 +791,7 @@ export function BranchToolbarBranchSelector({
791 data-composer-context-control
792 >
793 <ThreadPullRequestBadgeControl
793 - variant="ghost"
794 + render={<ComposerControl size="xs" />}
795 badge={prBadge}
796 number={prNumber}
797 url={prUrl}
apps/web/src/components/Sidebar.tsx
+2 -2
@@ -221,7 +221,7 @@ import {
221 } from "../providerInstances";
222 import { useThreadRunningTerminalIds } from "../state/terminalSessions";
223 import { stackedThreadToast, toastManager } from "./ui/toast";
224 -import { Button } from "./ui/button";
224 +import { Button, InlineButton } from "./ui/button";
225 import {
226 Combobox,
227 ComboboxEmpty,
@@ -1510,7 +1510,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
1510 const prBadge =
1511 prBadgeShape?.kind === "stack" || pr || currentLinkedPr ? (
1512 <ThreadPullRequestBadgeControl
1513 - variant="underline"
1513 + render={<InlineButton />}
1514 badge={prBadgeShape}
1515 number={pr?.number ?? currentLinkedPr?.number}
1516 url={pr?.url ?? currentLinkedPr?.url}
apps/web/src/components/ThreadStatusIndicators.tsx
+60 -43
@@ -15,8 +15,8 @@ import {
15 type ThreadPullRequestBadge,
16 } from "@t3tools/shared/threadPullRequests";
17 import { FolderGit2Icon, TerminalIcon } from "lucide-react";
18 -import { useMemo, type MouseEvent } from "react";
19 -import { Button, InlineButton } from "./ui/button";
18 +import { useRender } from "@base-ui/react/use-render";
19 +import { useMemo, type MouseEvent, type ReactElement } from "react";
20 import { cn } from "../lib/utils";
21 import { useEnvironment, usePrimaryEnvironmentId } from "../state/environments";
22 import { EnvironmentMachineIcon } from "./EnvironmentMachineIcon";
@@ -191,9 +191,14 @@ export function resolveThreadPullRequestBadgePresentation({
191 };
192 }
193
194 -/** The complete linked-PR control shared by the sidebar and composer footer. */
194 +/**
195 + * The linked-PR badge shared by the sidebar and composer footer. The badge owns what it shows:
196 + * the state glyph and number at the meta size, in the state's color. The caller owns the control
197 + * it sits in through `render` (an inline link in a sidebar row, a toolbar control in the
198 + * composer), and the badge fills in the link or stack button behavior.
199 + */
200 export function ThreadPullRequestBadgeControl({
196 - variant,
201 + render,
202 badge,
203 number,
204 url,
@@ -201,7 +206,7 @@ export function ThreadPullRequestBadgeControl({
206 onOpenStack,
207 onOpenPullRequest,
208 }: {
204 - variant: "underline" | "ghost";
209 + render: ReactElement<{ render?: useRender.RenderProp }>;
210 badge: ThreadPullRequestBadge | null;
211 number?: number | undefined;
212 url?: string | undefined;
@@ -211,53 +216,65 @@ export function ThreadPullRequestBadgeControl({
216 }) {
217 const presentation = resolveThreadPullRequestBadgePresentation({ badge, number, url, status });
218 if (presentation === null) return null;
214 - const isStack = badge?.kind === "stack";
215 - const content = (
216 - <>
217 - <presentation.Icon aria-hidden className="size-3 shrink-0" />
218 - {presentation.text}
219 - </>
219 + return (
220 + <PullRequestBadge
221 + render={render}
222 + presentation={presentation}
223 + isStack={badge?.kind === "stack"}
224 + url={url}
225 + onOpenStack={onOpenStack}
226 + onOpenPullRequest={onOpenPullRequest}
227 + />
228 );
221 - const linkProps = isStack
222 - ? {
223 - onClick: (event: MouseEvent<HTMLElement>) => {
224 - event.preventDefault();
225 - event.stopPropagation();
226 - onOpenStack();
227 - },
229 +}
230 +
231 +function PullRequestBadge({
232 + render,
233 + presentation,
234 + isStack,
235 + url,
236 + onOpenStack,
237 + onOpenPullRequest,
238 +}: {
239 + render: ReactElement<{ render?: useRender.RenderProp }>;
240 + presentation: NonNullable<ReturnType<typeof resolveThreadPullRequestBadgePresentation>>;
241 + isStack: boolean;
242 + url: string | undefined;
243 + onOpenStack: () => void;
244 + onOpenPullRequest: (event: MouseEvent<HTMLElement>) => void;
245 +}) {
246 + const onClick = isStack
247 + ? (event: MouseEvent<HTMLElement>) => {
248 + event.preventDefault();
249 + event.stopPropagation();
250 + onOpenStack();
251 }
229 - : { onClick: onOpenPullRequest };
252 + : onOpenPullRequest;
253 const element = isStack ? (
254 <button type="button" />
255 ) : (
256 <a href={url} target="_blank" rel="noopener noreferrer" />
257 );
258 + // The caller's control (InlineButton, ComposerControl) renders as the link or stack button
259 + // through its own render prop; useRender merges the badge's behavior into it.
260 + const control = useRender({
261 + render,
262 + props: {
263 + render: element,
264 + "aria-label": presentation.label,
265 + onPointerDown: (event: MouseEvent<HTMLElement>) => event.stopPropagation(),
266 + onClick,
267 + },
268 + });
269 return (
270 <Tooltip>
237 - <TooltipTrigger
238 - render={
239 - variant === "ghost" ? (
240 - <Button
241 - render={element}
242 - variant="ghost"
243 - size="xs"
244 - className={presentation.toneClassName}
245 - aria-label={presentation.label}
246 - onPointerDown={(event) => event.stopPropagation()}
247 - {...linkProps}
248 - />
249 - ) : (
250 - <InlineButton
251 - render={element}
252 - className={presentation.toneClassName}
253 - aria-label={presentation.label}
254 - onPointerDown={(event) => event.stopPropagation()}
255 - {...linkProps}
256 - />
257 - )
258 - }
259 - >
260 - {content}
271 + <TooltipTrigger render={control}>
272 + <span
273 + className={cn("contents font-normal text-xs tabular-nums", presentation.toneClassName)}
274 + >
275 + <presentation.Icon aria-hidden className="size-3 shrink-0" />
276 + {presentation.text}
277 + </span>
278 </TooltipTrigger>
279 <TooltipPopup side="top">{presentation.label}</TooltipPopup>
280 </Tooltip>
scripts/lint-restyle-ceiling.ts
+1 -1
@@ -8,7 +8,7 @@ import * as NodeURL from "node:url";
8 // components/ui exports are migrated to variants (see vite.config.ts). This gate keeps the
9 // count from growing: CI fails when findings exceed the ceiling. Lower the ceiling when you
10 // migrate a file, and delete this script when the rule becomes an error.
11 -export const RESTYLE_CEILING = 628;
11 +export const RESTYLE_CEILING = 627;
12
13 const RULE = "shadcn(no-restyle)";
14