Skip to content

Commit 83297b9

Browse files
authored
Merge branch 'main' into t3code/show-openrouter-credit-balance
2 parents 89b436d + 96f4370 commit 83297b9

115 files changed

Lines changed: 11838 additions & 245 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/mobile/modules/t3-markdown-text/android/src/main/java/expo/modules/t3markdowntext/T3MarkdownTextSelectionModule.kt‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package expo.modules.t3markdowntext
33
import android.content.ClipData
44
import android.content.ClipboardManager
55
import android.content.Context
6+
import android.text.Spannable
7+
import android.text.SpannableStringBuilder
68
import android.text.Spanned
79
import android.text.style.ReplacementSpan
810
import android.view.ActionMode
@@ -18,6 +20,14 @@ import kotlin.math.min
1820

1921
private const val OBJECT_REPLACEMENT_CHARACTER = "\uFFFC"
2022

23+
// Match React Native's measurement buffer. Android orders tied line-height
24+
// spans differently in SpannableString, shifting inline images once RN's
25+
// span priorities are exhausted.
26+
private object MarkdownSpannableFactory : Spannable.Factory() {
27+
override fun newSpannable(source: CharSequence): Spannable =
28+
SpannableStringBuilder(source)
29+
}
30+
2131
private fun copyTextWithoutInlineImages(
2232
text: CharSequence,
2333
start: Int,
@@ -85,6 +95,7 @@ class T3MarkdownTextSelectionModule : Module() {
8595
if (currentCallback is SanitizingSelectionActionModeCallback) {
8696
return@runOnUiQueueThread
8797
}
98+
textView.setSpannableFactory(MarkdownSpannableFactory)
8899
textView.customSelectionActionModeCallback =
89100
SanitizingSelectionActionModeCallback(textView, currentCallback)
90101
}

‎apps/mobile/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
"buildFromSource": [
148148
"expo-notifications",
149149
"react-native-screens",
150+
"react-native-reanimated",
150151
"@react-native-menu/menu",
151152
"expo-audio"
152153
]

‎apps/mobile/src/components/ComposerAttachmentButton.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ export function ComposerAttachmentButton(props: {
4040

4141
return (
4242
<ControlPillMenu
43+
accessible
44+
accessibilityLabel="Add attachment"
45+
accessibilityRole="button"
4346
actions={ATTACHMENT_MENU_ACTIONS}
4447
onPressAction={({ nativeEvent }) => {
4548
if (nativeEvent.event === "photos") {

‎apps/mobile/src/features/files/thread-file-navigator-pane.tsx‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { useEnvironmentQuery } from "../../state/query";
1818
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
1919
import { FileTreeBrowser } from "./FileTreeBrowser";
2020
import { preloadWorkspaceFileContents } from "./preload-workspace-file";
21+
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
2122

2223
export function ThreadFileNavigatorPane(props: {
2324
readonly cwd: string;
@@ -28,6 +29,7 @@ export function ThreadFileNavigatorPane(props: {
2829
readonly onSelectFile: (path: string) => void;
2930
}) {
3031
const [searchQuery, setSearchQuery] = useState("");
32+
const { toggleAuxiliaryPane } = useAdaptiveWorkspaceLayout();
3133
const { themeAppearance: highlightTheme } = useAppearancePreferences();
3234
const theme = useUniwindTheme();
3335
const foregroundColor = theme["--color-foreground"];
@@ -64,8 +66,18 @@ export function ThreadFileNavigatorPane(props: {
6466
type: "button" as const,
6567
width: 44,
6668
},
69+
{
70+
accessibilityLabel: "Close files",
71+
icon: { name: "xmark", type: "sfSymbol" as const },
72+
identifier: "thread-file-navigator-close",
73+
onPress: toggleAuxiliaryPane,
74+
sharesBackground: false,
75+
tintColor: foregroundColor,
76+
type: "button" as const,
77+
width: 44,
78+
},
6779
] as ComponentProps<typeof ScreenStackHeaderConfig>["headerRightBarButtonItems"],
68-
[entriesQuery.refresh, foregroundColor],
80+
[entriesQuery.refresh, foregroundColor, toggleAuxiliaryPane],
6981
);
7082

7183
const fileTree = (
@@ -159,6 +171,15 @@ export function ThreadFileNavigatorPane(props: {
159171
type="monochrome"
160172
/>
161173
</Pressable>
174+
<Pressable
175+
accessibilityRole="button"
176+
accessibilityLabel="Close files"
177+
hitSlop={8}
178+
className="h-8 w-8 items-center justify-center rounded-full active:bg-subtle"
179+
onPress={toggleAuxiliaryPane}
180+
>
181+
<SymbolView name="xmark" size={14} tintColorClassName="accent-icon-muted" />
182+
</Pressable>
162183
</View>
163184
<View className="flex-row items-center gap-2 border-t border-border px-3 py-2">
164185
<SymbolView

‎apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,19 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
850850
[navigation, selectedThread, terminalId],
851851
);
852852

853+
const handleCloseTerminal = useCallback(() => {
854+
if (navigation.canGoBack()) {
855+
navigation.goBack();
856+
return;
857+
}
858+
navigation.dispatch(
859+
StackActions.replace("Thread", {
860+
environmentId: params.environmentId,
861+
threadId: params.threadId,
862+
}),
863+
);
864+
}, [navigation, params.environmentId, params.threadId]);
865+
853866
const navigateAwayAfterExit = useCallback(() => {
854867
// With other shells still live, fall through to the previous one instead
855868
// of dropping the user back on the thread.
@@ -1143,7 +1156,7 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
11431156
<AndroidScreenHeader
11441157
title="Terminal"
11451158
subtitle={headerSubtitle}
1146-
onBack={navigation.canGoBack() ? () => navigation.goBack() : undefined}
1159+
onBack={handleCloseTerminal}
11471160
trailing={
11481161
<>
11491162
{layout.usesSplitView ? (
@@ -1179,6 +1192,12 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
11791192

11801193
{layout.usesSplitView ? (
11811194
<NativeHeaderToolbar placement="left">
1195+
<NativeHeaderToolbar.Button
1196+
accessibilityLabel="Close terminal"
1197+
icon="xmark"
1198+
onPress={handleCloseTerminal}
1199+
separateBackground
1200+
/>
11821201
<NativeHeaderToolbar.Button
11831202
accessibilityLabel={panes.primarySidebarVisible ? "Maximize terminal" : "Show threads"}
11841203
icon={

‎apps/mobile/src/features/threads/thread-list-items.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ export const THREAD_LIST_COMPACT_INSET = HOME_HORIZONTAL_INSET;
4444
const SIDEBAR_ROW_RADIUS = 12;
4545

4646
function pullRequestTintColor(
47-
pr: Pick<ThreadPrPresentation, "state" | "isDraft">,
47+
pr: Pick<ThreadPrPresentation, "state" | "isDraft" | "others">,
4848
colorScheme: "light" | "dark",
4949
) {
5050
const dark = colorScheme === "dark";
51-
if (pr.state === "open" && pr.isDraft === true) {
51+
if (pr.others > 0 || (pr.state === "open" && pr.isDraft === true)) {
5252
return dark ? "#a1a1aa" : "#71717a";
5353
}
5454
switch (pr.state) {

‎apps/mobile/src/features/threads/thread-list-v2-items.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -871,9 +871,9 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
871871
)}
872872
{pr ? (
873873
<View className="flex-row items-center gap-1" accessibilityLabel={pr.accessibilityLabel}>
874-
{pr.kind === "stack" ? (
874+
{pr.kind === "stack" || pr.others > 0 ? (
875875
<SymbolView
876-
name="square.3.layers.3d"
876+
name={pr.kind === "stack" ? "square.3.layers.3d" : "arrow.triangle.pull"}
877877
size={12}
878878
tintColorClassName={
879879
selected
@@ -896,7 +896,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
896896
)}
897897
style={{ fontFamily: MONO_FONT }}
898898
>
899-
{pr.kind === "stack" ? pr.label : `#${pr.label}`}
899+
{pr.kind === "stack" || pr.others > 0 ? pr.label : `#${pr.label}`}
900900
</Text>
901901
</View>
902902
) : null}

‎apps/mobile/src/features/threads/thread-work-log.tsx‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export const THREAD_DISCLOSURE_TRANSITION_MS = 180;
7676
const WORK_LOG_LAYOUT_TRANSITION = LinearTransition.duration(THREAD_DISCLOSURE_TRANSITION_MS);
7777
const WORK_LOG_DETAIL_ENTER_TRANSITION = FadeIn.duration(140);
7878
const WORK_LOG_DETAIL_EXIT_TRANSITION = FadeOut.duration(120);
79-
type WorkContentIcon = AppSymbolName | "browser" | "t3-code" | "pull-request";
79+
type WorkContentIcon = AppSymbolName | "browser" | "device" | "t3-code" | "pull-request";
8080

8181
function WorkLogIcon(props: {
8282
readonly icon: WorkContentIcon;
@@ -97,7 +97,9 @@ function WorkLogIcon(props: {
9797
? "arrow.triangle.pull"
9898
: props.icon === "browser"
9999
? { ios: "globe", android: "public" }
100-
: props.icon
100+
: props.icon === "device"
101+
? { ios: "iphone", android: "smartphone" }
102+
: props.icon
101103
}
102104
size={14}
103105
weight="medium"
@@ -899,7 +901,7 @@ export function ThreadWorkGroupToggle(props: {
899901
readonly iconSubtleColor: import("react-native").ColorValue;
900902
readonly summary: string;
901903
readonly summaryKind: ToolGroupSummaryKind;
902-
readonly summaryToolIcon?: "browser" | "t3-code" | "pull-request";
904+
readonly summaryToolIcon?: "browser" | "device" | "t3-code" | "pull-request";
903905
readonly themeAppearance: "light" | "dark";
904906
readonly toolSurface?: import("@t3tools/contracts").ToolActivitySurface;
905907
readonly toolIcon?: ToolActivityIcon;
@@ -1248,6 +1250,8 @@ function toolGroupSummarySymbolName(kind: ToolGroupSummaryKind): AppSymbolName {
12481250
return { ios: "square.and.pencil", android: "edit" };
12491251
case "command":
12501252
return { ios: "terminal", android: "terminal" };
1253+
case "device":
1254+
return { ios: "iphone", android: "smartphone" };
12511255
case "browser":
12521256
case "search":
12531257
return { ios: "globe", android: "public" };

‎apps/mobile/src/lib/threadActivity.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export type ThreadFeedEntry =
167167
readonly summaryKind: ToolGroupSummaryKind;
168168
readonly toolSurface?: WorkLogEntry["toolSurface"];
169169
readonly toolIcon?: WorkLogEntry["toolIcon"];
170-
readonly summaryToolIcon?: "browser" | "t3-code" | "pull-request";
170+
readonly summaryToolIcon?: "browser" | "device" | "t3-code" | "pull-request";
171171
readonly hasFailure: boolean;
172172
readonly live: boolean;
173173
readonly shimmer: boolean;

‎apps/mobile/src/state/thread-pr-presentation.ts‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ export interface ThreadPrPresentation {
1717
readonly number: number;
1818
readonly state: ThreadPr["state"] | null;
1919
readonly kind: "pull-request" | "stack";
20+
readonly others: number;
2021
readonly isDraft: boolean;
2122
/** Provider-side last activity, bounding when a terminal state landed. */
2223
readonly updatedAt: string | null;
2324
readonly url: string;
24-
/** Compact pull request number label, e.g. "3774". */
25+
/** Compact pull request number or linked count, e.g. "3774" or "+2". */
2526
readonly label: string;
2627
/** Full, provider-aware label for assistive technologies. */
2728
readonly accessibilityLabel: string;
@@ -42,6 +43,7 @@ export function presentThreadPr(
4243
const isDraft = pr.state === "open" && pr.isDraft === true;
4344
return {
4445
kind: "pull-request",
46+
others: 0,
4547
number: pr.number,
4648
state: pr.state,
4749
isDraft,
@@ -63,12 +65,16 @@ export function presentThreadLinkedPullRequests(
6365
const snapshot = link.snapshot;
6466
const state = badge.kind === "stack" ? badge.state : (snapshot?.state ?? null);
6567
const isDraft = snapshot?.isDraft === true && state === "open";
68+
const linkedCount = badge.kind === "pull-request" && badge.others > 0 ? badge.others + 1 : null;
6669
const label =
6770
badge.kind === "stack"
6871
? String(badge.layers)
69-
: `${link.number}${badge.others > 0 ? ` +${badge.others}` : ""}`;
72+
: linkedCount !== null
73+
? `+${linkedCount}`
74+
: String(link.number);
7075
return {
7176
kind: badge.kind,
77+
others: badge.kind === "pull-request" ? badge.others : 0,
7278
number: link.number,
7379
state,
7480
isDraft,
@@ -79,7 +85,10 @@ export function presentThreadLinkedPullRequests(
7985
badge.kind === "stack"
8086
? `${badge.layers} pull requests in stack, ${state ?? "status pending"}`
8187
: `#${link.number} pull request ${state === null ? "status pending" : isDraft ? "draft" : state}${badge.others > 0 ? `, ${badge.others} more linked` : ""}`,
82-
textClassName: state === null || isDraft ? "text-foreground-muted" : PR_STATE_TEXT_CLASS[state],
88+
textClassName:
89+
linkedCount !== null || state === null || isDraft
90+
? "text-foreground-muted"
91+
: PR_STATE_TEXT_CLASS[state],
8392
};
8493
}
8594

0 commit comments

Comments
 (0)