Skip to content

Commit 0fc902e

Browse files
committed
fix(web,mobile): draft headers show the thread's title, not always "New thread"
1 parent 35c1210 commit 0fc902e

8 files changed

Lines changed: 19 additions & 10 deletions

File tree

‎apps/mobile/src/features/home/HomeRouteScreen.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ export function HomeRouteScreen() {
259259
requestId: uuidv4(),
260260
environmentId: String(project.environmentId),
261261
projectId: String(project.id),
262-
title: project.title,
263262
},
264263
});
265264
}}

‎apps/mobile/src/features/keyboard/CommandPalette.tsx‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,6 @@ export function CommandPalette(props: {
378378
requestId: uuidv4(),
379379
environmentId: activeProject.environmentId,
380380
projectId: activeProject.id,
381-
title: activeProject.title,
382381
},
383382
},
384383
}),
@@ -416,7 +415,6 @@ export function CommandPalette(props: {
416415
requestId: uuidv4(),
417416
environmentId: project.environmentId,
418417
projectId: project.id,
419-
title: project.title,
420418
},
421419
},
422420
}),

‎apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,6 @@ function AdaptiveWorkspaceLayoutContent(
617617
requestId: uuidv4(),
618618
environmentId: String(project.environmentId),
619619
projectId: String(project.id),
620-
title: project.title,
621620
},
622621
});
623622
};

‎apps/mobile/src/features/prompt-links/newTaskPromptLink.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ async function openProjectDraft(project: EnvironmentProject, request: LinkedDraf
263263
StackActions.push("Thread", {
264264
draft: {
265265
draftId: draftKey,
266-
title: request.pullRequest ? `PR #${request.pullRequest.number}` : project.title,
266+
...(request.pullRequest ? { title: `PR #${request.pullRequest.number}` } : {}),
267267
},
268268
}),
269269
);

‎apps/mobile/src/features/threads/DraftThreadHeader.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { useVcsActionState } from "../../state/use-vcs-action-state";
1818
import { ThreadHeader } from "./ThreadHeader";
1919

2020
export function DraftThreadHeader(props: {
21+
readonly title: string;
2122
readonly thread: EnvironmentThreadShell;
2223
readonly project: EnvironmentProject;
2324
readonly cwd: string | null;
@@ -49,7 +50,7 @@ export function DraftThreadHeader(props: {
4950
return (
5051
<ThreadHeader
5152
draft
52-
title="New thread"
53+
title={props.title}
5354
subtitle=""
5455
headerColor={themeVariables["--color-header"]}
5556
usesNativeHeaderGlass={NATIVE_LIQUID_GLASS_SUPPORTED}

‎apps/mobile/src/features/threads/NewTaskDraftRouteScreen.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export function NewTaskDraftRouteScreen({ route }: StaticScreenProps<NewTaskDraf
9191
const currentRoute = useRoute();
9292
const params = route.params ?? {};
9393
const draftId = Array.isArray(params.draftId) ? params.draftId[0] : params.draftId;
94+
const title = (Array.isArray(params.title) ? params.title[0] : params.title) || "New thread";
9495
const projects = useProjects();
9596
const { state: catalogState } = useWorkspaceState();
9697

@@ -198,13 +199,14 @@ export function NewTaskDraftRouteScreen({ route }: StaticScreenProps<NewTaskDraf
198199
<>
199200
{preparingBranch ? (
200201
<ThreadScreenFallback>
201-
<NativeStackScreenOptions options={{ title: "New thread" }} />
202+
<NativeStackScreenOptions options={{ title }} />
202203
<View className="flex-1 items-center justify-center bg-screen">
203204
<Text className="text-foreground">Switching branch...</Text>
204205
</View>
205206
</ThreadScreenFallback>
206207
) : (
207208
<NewTaskDraftScreen
209+
title={title}
208210
initialProjectRef={preparedProjectRef}
209211
incomingShareId={
210212
Array.isArray(params.incomingShareId)

‎apps/mobile/src/features/threads/NewTaskDraftScreen.tsx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ function NewTaskWorkspaceIcon(props: {
142142
}
143143

144144
export function NewTaskDraftScreen(props: {
145+
readonly title: string;
145146
readonly initialProjectRef?: {
146147
readonly environmentId?: string;
147148
readonly projectId?: string;
@@ -848,7 +849,7 @@ export function NewTaskDraftScreen(props: {
848849
<ThreadScreenFallback
849850
header={
850851
<AppBar
851-
title="New thread"
852+
title={props.title}
852853
sidebar={false}
853854
onBack={goBack}
854855
options={{
@@ -893,7 +894,12 @@ export function NewTaskDraftScreen(props: {
893894
<ThreadScreenBinding
894895
environmentId={selectedProject.environmentId}
895896
header={
896-
<DraftThreadHeader thread={thread} project={selectedProject} cwd={composerWorkspaceCwd} />
897+
<DraftThreadHeader
898+
title={props.title}
899+
thread={thread}
900+
project={selectedProject}
901+
cwd={composerWorkspaceCwd}
902+
/>
897903
}
898904
draftMode={{
899905
content: heroViewport,

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ import {
201201
import { useNowMinute } from "../hooks/useNowMinute";
202202
import { usePanelAnimationSettings, usePanelPresence } from "../panelAnimations";
203203
import { useNewThreadHandler } from "../hooks/useHandleNewThread";
204+
import { isTriagePrompt } from "../hooks/useStartTriage";
204205
import { useOpenPanelPullRequestUrl } from "../hooks/useOpenPanelPullRequestUrl";
205206
import { isPreviewFocused } from "../lib/previewFocus";
206207
import { focusTerminalOnThreadEnter, getTerminalFocusOwner } from "../lib/terminalFocus";
@@ -611,6 +612,9 @@ export default function ChatView(props: ChatViewProps) {
611612
const draft = store.getComposerDraft(composerDraftTarget);
612613
return draft ? composerDraftHasUserContent({ ...draft, prompt: "" }) : false;
613614
});
615+
const isTriageDraft = useComposerDraftStore((store) =>
616+
draftId ? isTriagePrompt(store.getComposerDraft(draftId)?.prompt ?? "") : false,
617+
);
614618
const setComposerDraftPrompt = useComposerDraftStore((store) => store.setPrompt);
615619
const setDraftThreadContext = useComposerDraftStore((store) => store.setDraftThreadContext);
616620
const composerImagesRef = useRef<ComposerImageAttachment[]>([]);
@@ -3234,7 +3238,7 @@ export default function ChatView(props: ChatViewProps) {
32343238
activeThreadEnvironmentId={activeThread.environmentId}
32353239
activeThreadId={activeThread.id}
32363240
isServerThread={isServerThread}
3237-
activeThreadTitle={activeThread.title}
3241+
activeThreadTitle={!isServerThread && isTriageDraft ? "Triage" : activeThread.title}
32383242
activeThreadLinkOrigin={activeThreadShell?.linkOrigin?.label ?? null}
32393243
activeProject={activeProject ?? null}
32403244
parentThreadLink={headerParentThreadLink}

0 commit comments

Comments
 (0)