Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,20 @@ export function NewTaskDraftScreen(props: {
const controlsBottomPadding = Math.max(insets.bottom, 10);
const keyboardOpenedOffset = Math.max(0, controlsBottomPadding - 8);
const { projectScopes, selectedProject, selectedProjectKey, setProject } = flow;
// The picker and sidebar name a project by its repository scope; a workspace
// inside it (e.g. apps/server) is titled by its folder, which reads as
// ambiguous on its own.
const selectedProjectLabel = useMemo(() => {
if (!selectedProject) return null;
const scope = projectScopes.find((candidate) =>
candidate.projectRefs.some(
(ref) =>
ref.environmentId === selectedProject.environmentId &&
ref.projectId === selectedProject.id,
),
);
return scope?.title ?? selectedProject.title;
}, [projectScopes, selectedProject]);
const { connectedEnvironments } = useRemoteConnectionStatus();
const selectedEnvironmentServerConfig = useEnvironmentServerConfig(
selectedProject?.environmentId ?? null,
Expand Down Expand Up @@ -506,7 +520,7 @@ export function NewTaskDraftScreen(props: {
});
const voiceInput = useVoiceInputController({
ownerKey: flow.draftKey,
label: selectedProject ? `New task in ${selectedProject.title}` : "New task",
label: selectedProjectLabel ? `New task in ${selectedProjectLabel}` : "New task",
readDraftMessage: () => (flow.draftKey ? getComposerDraftSnapshot(flow.draftKey).text : null),
subscribeToDraftChanges: (onChange) => appAtomRegistry.subscribe(composerDraftsAtom, onChange),
selection: composerMenu.selection,
Expand Down Expand Up @@ -1553,7 +1567,7 @@ export function NewTaskDraftScreen(props: {
<Text className="text-2xl font-t3-medium tracking-tight text-foreground">in </Text>
<Pressable
accessibilityHint="Opens the project picker"
accessibilityLabel={selectedProject.title}
accessibilityLabel={selectedProjectLabel ?? selectedProject.title}
accessibilityRole="button"
disabled={isComposerInteractionLocked}
onPress={chooseProject}
Expand All @@ -1563,7 +1577,7 @@ export function NewTaskDraftScreen(props: {
className="text-2xl font-t3-medium tracking-tight text-foreground"
numberOfLines={1}
>
{selectedProject.title}
{selectedProjectLabel ?? selectedProject.title}
</Text>
</Pressable>
<Text className="text-2xl font-t3-medium tracking-tight text-foreground">?</Text>
Expand Down Expand Up @@ -1869,7 +1883,7 @@ export function NewTaskDraftScreen(props: {
options={{
headerBackVisible: false,
headerShadowVisible: false,
title: "",
title: "New thread",
}}
/>
<NativeHeaderToolbar placement="left">
Expand Down
Loading