Skip to content

Commit efe68ee

Browse files
authored
Merge branch 'main' into t3code/fix-provider-email-clipping
2 parents fabd717 + 6975efd commit efe68ee

7 files changed

Lines changed: 68 additions & 64 deletions

File tree

‎apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ export function ThreadFilesTreeScreen(props: ThreadFilesRouteScreenProps) {
417417
const { fileInspector, layout, showAuxiliaryPane } = useAdaptiveWorkspaceLayout();
418418
const [searchQuery, setSearchQuery] = useState("");
419419
const { themeAppearance: highlightTheme } = useAppearancePreferences();
420-
const headerColor = useUniwindTheme()["--color-header"];
421420
const { cwd, environmentId, projectName, selectedThread, threadId } = useThreadFilesWorkspace(
422421
props.route.params,
423422
);
@@ -554,13 +553,7 @@ export function ThreadFilesTreeScreen(props: ThreadFilesRouteScreenProps) {
554553
</>
555554
);
556555

557-
return Platform.OS === "android" ? (
558-
<View className="flex-1" style={{ backgroundColor: headerColor }}>
559-
{content}
560-
</View>
561-
) : (
562-
content
563-
);
556+
return Platform.OS === "android" ? <View className="flex-1 bg-header">{content}</View> : content;
564557
}
565558

566559
export function ThreadFileScreen(props: ThreadFileRouteScreenProps) {

‎apps/mobile/src/features/settings/appearance/components/AppearancePreviews.tsx‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
resolveMarkdownFontSizes,
66
resolveMobileCodeSurface,
77
} from "../../../../lib/appearancePreferences";
8-
import { useUniwindTheme } from "../../../../lib/useUniwindTheme";
98
import { getMobileTerminalTheme } from "../../../terminal/terminalTheme";
109
import { useAppearancePreferences } from "../AppearancePreferencesProvider";
1110

@@ -138,16 +137,12 @@ export function CodeAppearancePreview(props: {
138137
readonly wordBreak: boolean;
139138
}) {
140139
const surface = resolveMobileCodeSurface(props.fontSize);
141-
const theme = useUniwindTheme();
142-
const lineNumberColor = theme["--color-icon-subtle"];
143-
const keywordColor = theme["--color-md-link"];
144140

145141
const lineNumber = (line: CodePreviewLine, index: number) => (
146142
<Text
147-
className="text-right"
143+
className="text-right text-icon-subtle"
148144
key={line.id}
149145
style={{
150-
color: lineNumberColor,
151146
fontFamily: CODE_FONT_FAMILY,
152147
fontSize: surface.lineNumberFontSize,
153148
lineHeight: surface.rowHeight,
@@ -172,8 +167,8 @@ export function CodeAppearancePreview(props: {
172167
{line.tokens.map((token) => (
173168
<Text
174169
key={token.text}
170+
className={token.keyword ? "text-md-link" : undefined}
175171
style={{
176-
color: token.keyword ? keywordColor : undefined,
177172
fontFamily: CODE_FONT_FAMILY,
178173
fontSize: surface.fontSize,
179174
lineHeight: surface.rowHeight,

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ import {
5959
useLinkedThreadPullRequest,
6060
} from "./ThreadStatusIndicators";
6161
import { Button } from "./ui/button";
62+
import { ComposerControl } from "./chat/ComposerControl";
6263
import { Switch } from "./ui/switch";
6364
import { getVirtualizedScrollFadeClassName } from "./ui/scroll-area";
6465
import {
@@ -790,7 +791,7 @@ export function BranchToolbarBranchSelector({
790791
data-composer-context-control
791792
>
792793
<ThreadPullRequestBadgeControl
793-
variant="ghost"
794+
render={<ComposerControl size="xs" />}
794795
badge={prBadge}
795796
number={prNumber}
796797
url={prUrl}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ import {
221221
} from "../providerInstances";
222222
import { useThreadRunningTerminalIds } from "../state/terminalSessions";
223223
import { stackedThreadToast, toastManager } from "./ui/toast";
224-
import { Button } from "./ui/button";
224+
import { Button, InlineButton } from "./ui/button";
225225
import {
226226
Combobox,
227227
ComboboxEmpty,
@@ -1510,7 +1510,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
15101510
const prBadge =
15111511
prBadgeShape?.kind === "stack" || pr || currentLinkedPr ? (
15121512
<ThreadPullRequestBadgeControl
1513-
variant="underline"
1513+
render={<InlineButton />}
15141514
badge={prBadgeShape}
15151515
number={pr?.number ?? currentLinkedPr?.number}
15161516
url={pr?.url ?? currentLinkedPr?.url}

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

Lines changed: 60 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import {
1515
type ThreadPullRequestBadge,
1616
} from "@t3tools/shared/threadPullRequests";
1717
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";
2020
import { cn } from "../lib/utils";
2121
import { useEnvironment, usePrimaryEnvironmentId } from "../state/environments";
2222
import { EnvironmentMachineIcon } from "./EnvironmentMachineIcon";
@@ -191,17 +191,22 @@ export function resolveThreadPullRequestBadgePresentation({
191191
};
192192
}
193193

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+
*/
195200
export function ThreadPullRequestBadgeControl({
196-
variant,
201+
render,
197202
badge,
198203
number,
199204
url,
200205
status,
201206
onOpenStack,
202207
onOpenPullRequest,
203208
}: {
204-
variant: "underline" | "ghost";
209+
render: ReactElement<{ render?: useRender.RenderProp }>;
205210
badge: ThreadPullRequestBadge | null;
206211
number?: number | undefined;
207212
url?: string | undefined;
@@ -211,53 +216,65 @@ export function ThreadPullRequestBadgeControl({
211216
}) {
212217
const presentation = resolveThreadPullRequestBadgePresentation({ badge, number, url, status });
213218
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+
/>
220228
);
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();
228251
}
229-
: { onClick: onOpenPullRequest };
252+
: onOpenPullRequest;
230253
const element = isStack ? (
231254
<button type="button" />
232255
) : (
233256
<a href={url} target="_blank" rel="noopener noreferrer" />
234257
);
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+
});
235269
return (
236270
<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>
261278
</TooltipTrigger>
262279
<TooltipPopup side="top">{presentation.label}</TooltipPopup>
263280
</Tooltip>

‎scripts/lint-restyle-ceiling.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as NodeURL from "node:url";
88
// components/ui exports are migrated to variants (see vite.config.ts). This gate keeps the
99
// count from growing: CI fails when findings exceed the ceiling. Lower the ceiling when you
1010
// 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;
1212

1313
const RULE = "shadcn(no-restyle)";
1414

‎vite.config.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,13 @@ export default defineConfig({
215215
"apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx",
216216
"apps/mobile/src/features/files/FileMarkdownPreview.tsx",
217217
"apps/mobile/src/features/files/SourceFileSurface.tsx",
218-
"apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx",
219218
"apps/mobile/src/features/files/AttachmentFileScreen.tsx",
220219
"apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx",
221220
"apps/mobile/src/features/files/thread-file-navigator-pane.tsx",
222221
"apps/mobile/src/features/home/HomeHeader.tsx",
223222
"apps/mobile/src/features/review/ReviewSheet.tsx",
224223
"apps/mobile/src/features/review/useNativeReviewDiffBridge.ts",
225224
"apps/mobile/src/features/settings/SettingsEnvironmentsRouteScreen.tsx",
226-
"apps/mobile/src/features/settings/appearance/components/AppearancePreviews.tsx",
227225
"apps/mobile/src/features/threads/GitActionProgressOverlay.tsx",
228226
"apps/mobile/src/features/threads/NewTaskDraftScreen.tsx",
229227
"apps/mobile/src/features/threads/ThreadComposer.tsx",

0 commit comments

Comments
 (0)