Skip to content

Commit e244607

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

10 files changed

Lines changed: 19 additions & 12 deletions

File tree

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ export function HomeRouteScreen() {
264264
requestId: uuidv4(),
265265
environmentId: String(project.environmentId),
266266
projectId: String(project.id),
267-
title: project.title,
268267
},
269268
});
270269
}}

‎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
}),
@@ -420,7 +419,6 @@ export function CommandPalette(props: {
420419
requestId: uuidv4(),
421420
environmentId: project.environmentId,
422421
projectId: project.id,
423-
title: project.title,
424422
},
425423
},
426424
}),

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,6 @@ function AdaptiveWorkspaceLayoutContent(
662662
requestId: uuidv4(),
663663
environmentId: String(project.environmentId),
664664
projectId: String(project.id),
665-
title: project.title,
666665
},
667666
});
668667
};

‎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
@@ -143,6 +143,7 @@ function NewTaskWorkspaceIcon(props: {
143143
}
144144

145145
export function NewTaskDraftScreen(props: {
146+
readonly title: string;
146147
readonly initialProjectRef?: {
147148
readonly environmentId?: string;
148149
readonly projectId?: string;
@@ -854,7 +855,7 @@ export function NewTaskDraftScreen(props: {
854855
<ThreadScreenFallback
855856
header={
856857
<AppBar
857-
title="New thread"
858+
title={props.title}
858859
sidebar={false}
859860
onBack={goBack}
860861
options={{
@@ -899,7 +900,12 @@ export function NewTaskDraftScreen(props: {
899900
<ThreadScreenBinding
900901
environmentId={selectedProject.environmentId}
901902
header={
902-
<DraftThreadHeader thread={thread} project={selectedProject} cwd={composerWorkspaceCwd} />
903+
<DraftThreadHeader
904+
title={props.title}
905+
thread={thread}
906+
project={selectedProject}
907+
cwd={composerWorkspaceCwd}
908+
/>
903909
}
904910
draftMode={{
905911
content: heroViewport,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRoutePara
296296
draft: {
297297
environmentId: reservedDestinationProject.environmentId,
298298
projectId: reservedDestinationProject.id,
299-
title: reservedDestinationProject.title,
300299
incomingShareId: incomingShare.id,
301300
},
302301
},

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,6 @@ function ThreadRouteContent(
878878
draftId: restoredNewTaskDraftKey(creation.messageId),
879879
environmentId: String(creation.environmentId),
880880
projectId: String(creation.creation.projectId),
881-
...(selectedThreadProject ? { title: selectedThreadProject.title } : {}),
882881
},
883882
}),
884883
);

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ import {
202202
import { useNowMinute } from "../hooks/useNowMinute";
203203
import { usePanelAnimationSettings, usePanelPresence } from "../panelAnimations";
204204
import { useNewThreadHandler } from "../hooks/useHandleNewThread";
205+
import { isTriagePrompt } from "../hooks/useStartTriage";
205206
import { useOpenPanelPullRequestUrl } from "../hooks/useOpenPanelPullRequestUrl";
206207
import { isPreviewFocused } from "../lib/previewFocus";
207208
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[]>([]);
@@ -3328,7 +3332,7 @@ export default function ChatView(props: ChatViewProps) {
33283332
activeThreadEnvironmentId={activeThread.environmentId}
33293333
activeThreadId={activeThread.id}
33303334
isServerThread={isServerThread}
3331-
activeThreadTitle={activeThread.title}
3335+
activeThreadTitle={!isServerThread && isTriageDraft ? "Triage" : activeThread.title}
33323336
activeThreadLinkOrigin={activeThreadShell?.linkOrigin?.label ?? null}
33333337
activeProject={activeProject ?? null}
33343338
parentThreadLink={headerParentThreadLink}

0 commit comments

Comments
 (0)