Open History to see the last commit
1import * as Dialog from "../../components/ui/Dialog";
2import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
3import { NavigationRow } from "../../components/ui/NavigationRow";
4import { SettingsScreen } from "../settings/components/SettingsScreen";
5import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
6import { Button } from "../../components/ui/Button";
7import {
8 addProjectRemoteSourceLabel,
9 addProjectRemoteSourcePathHint,
10 addProjectRemoteSourceProvider,
11 buildAddProjectRemoteSourceReadiness,
12 buildProjectCreateCommand,
13 canCreateProjectInEnvironment,
14 findExistingAddProject,
15 getAddProjectInitialQuery,
16 getCloneDestinationBrowsePath,
17 getCloneDestinationPath,
18 getCloneDirectoryName,
19 getDefaultCloneUrl,
20 getNewProjectPathPreview,
21 getNewProjectPublishTarget,
22 getNewProjectPublishTargets,
23 getNewProjectRepository,
24 normalizePastedCloneUrl,
25 parseAddProjectRemoteSource,
26 resolveAddProjectPath,
27 sortAddProjectProviderSources,
28 type AddProjectRemoteSource,
29} from "@t3tools/client-runtime/operations/projects";
30import {
31 connectionStatusText,
32 type EnvironmentConnectionPhase,
33} from "@t3tools/client-runtime/connection";
34import {
35 canPreloadBrowsePath,
36 createBrowseNavigationCoordinator,
37 filterFilesystemBrowseEntries,
38 getFilesystemBrowsePath,
39 resolveFilesystemReadAccess,
40} from "@t3tools/client-runtime/state/filesystem";
41import {
42 appendBrowsePathSegment,
43 inferProjectTitleFromPath,
44 isWindowsPlatform,
45} from "@t3tools/client-runtime/state/projects";
46import {
47 AuthOrchestrationOperateScope,
48 AuthSourceControlWriteScope,
49 AuthFilesystemReadScope,
50 CommandId,
51 type EnvironmentId,
52 type EnvironmentMachineKind,
53 ProjectId,
54 resolveEnvironmentMachineKind,
55 SourceControlProviderKind,
56} from "@t3tools/contracts";
57import { CommonActions, StackActions, useNavigation } from "@react-navigation/native";
58import { SymbolView } from "../../components/ui/AppSymbol";
59import { useEffect, useRef, useState, type ReactNode } from "react";
60import { Platform, Pressable, View } from "react-native";
61import { useSafeAreaInsets } from "react-native-safe-area-context";
62import * as Arr from "effect/Array";
63import * as Cause from "effect/Cause";
64import * as Order from "effect/Order";
65import { AsyncResult } from "effect/reactivity";
66import { cn } from "../../lib/cn";
67import { useProjects, useServerConfigs, waitForProject } from "../../state/entities";
68import { filesystemEnvironment } from "../../state/filesystem";
69import { projectEnvironment } from "../../state/projects";
70import { useEnvironmentQuery } from "../../state/query";
71import { environmentSession, useEnvironmentScope, readEnvironmentScope } from "../../state/session";
72import { useEnvironmentPresentation } from "../../state/presentation";
73import { sourceControlEnvironment } from "../../state/sourceControl";
74import { AppText as Text, AppTextInput as TextInput } from "../../components/ui/AppText";
75import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
76import { ErrorBanner } from "../../components/ui/ErrorBanner";
77import { SourceControlIcon } from "./SourceControlIcon";
78import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients";
79import { ThemedSwitch } from "../../components/ui/ThemedSwitch";
80import { uuidv4 } from "../../lib/uuid";
81import { useAtomCommand } from "../../state/use-atom-command";
82import { useAtomQueryRunner } from "../../state/use-atom-query-runner";
83import {
84 useRemoteConnectionStatus,
85 useRemoteEnvironmentRuntime,
86 useSavedRemoteConnections,
87} from "../../state/use-remote-environment-registry";
88import { resolveAddProjectEnvironment } from "./AddProjectScreen.logic";
89import {
90 createNewTaskDraft,
91 setComposerDraftText,
92 waitForComposerDraftsLoaded,
93} from "../../state/use-composer-drafts";
94
95interface EnvironmentOption {
96 readonly environmentId: EnvironmentId;
97 readonly label: string;
98 readonly platform: string;
99 readonly machine: EnvironmentMachineKind;
100 readonly baseDirectory: string | null;
101 readonly newProjectsRoot: string | null;
102 readonly connectionState: EnvironmentConnectionPhase;
103 readonly connectionError: string | null;
104 readonly connectionErrorTraceId: string | null;
105 readonly supportsCloneTracking: boolean;
106}
107
108const environmentOptionOrder = Order.mapInput(
109 Order.Struct({
110 label: Order.String,
111 }),
112 (environment: EnvironmentOption) => ({ label: environment.label }),
113);
114
115function platformFromOs(os: string | null | undefined): string {
116 if (os === "windows") return "Win32";
117 if (os === "darwin") return "MacIntel";
118 if (os === "linux") return "Linux";
119 return "";
120}
121
122function errorMessage(error: unknown): string {
123 return error instanceof Error && error.message.trim().length > 0
124 ? error.message
125 : "An error occurred.";
126}
127
128function stringParam(value: string | string[] | undefined): string | null {
129 if (Array.isArray(value)) return value[0] ?? null;
130 return value ?? null;
131}
132
133function sourceFromParam(value: string | string[] | undefined): AddProjectRemoteSource {
134 return parseAddProjectRemoteSource(stringParam(value));
135}
136
137function SectionTitle(props: { readonly children: string }) {
138 return (
139 <Text
140 className={
141 Platform.OS === "android"
142 ? "px-4 text-sm font-t3-medium text-primary-text"
143 : "px-1 text-2xs font-t3-bold tracking-[0.7px] uppercase text-foreground-muted"
144 }
145 >
146 {props.children}
147 </Text>
148 );
149}
150
151function AddProjectShell(props: { readonly children: ReactNode; readonly title: string }) {
152 const insets = useSafeAreaInsets();
153
154 return (
155 // collapsable={false} is load-bearing: if this wrapper is flattened, the
156 // ScrollView lands directly under RNSSafeAreaView and RNS's formSheet
157 // scroll-view frame correction mistakes this full-height wrapper for a
158 // "header" sibling, coercing the ScrollView to zero height (blank sheet
159 // as soon as the sheet re-lays-out, e.g. when the keyboard opens).
160 <SettingsScreen title={props.title}>
161 <ScrollView
162 keyboardShouldPersistTaps="handled"
163 contentInsetAdjustmentBehavior="automatic"
164 contentContainerStyle={{
165 paddingHorizontal: Platform.OS === "android" ? 16 : 20,
166 paddingTop: 16,
167 paddingBottom: Math.max(insets.bottom, 18) + 18,
168 gap: Platform.OS === "android" ? 16 : 10,
169 }}
170 >
171 {props.children}
172 </ScrollView>
173 </SettingsScreen>
174 );
175}
176
177function ListSection(props: { readonly children: ReactNode }) {
178 return (
179 <View
180 className={
181 Platform.OS === "android"
182 ? "overflow-hidden rounded-[28px] bg-grouped-card"
183 : "overflow-hidden rounded-[24px] bg-grouped-card"
184 }
185 >
186 {props.children}
187 </View>
188 );
189}
190
191function ListRow(props: {
192 readonly title: string;
193 readonly subtitle?: string | null;
194 readonly icon: ReactNode;
195 readonly disabled?: boolean;
196 readonly selected?: boolean;
197 readonly isFirst?: boolean;
198 readonly right?: ReactNode;
199 readonly onPress?: () => void;
200}) {
201 if (Platform.OS === "android") {
202 return (
203 <NavigationRow
204 className="bg-grouped-card"
205 title={props.title}
206 subtitle={props.subtitle}
207 leading={props.icon}
208 trailing={props.right}
209 disabled={props.disabled}
210 onPress={props.onPress}
211 accessibilityRole={props.selected !== undefined ? "radio" : "button"}
212 accessibilityState={props.selected !== undefined ? { checked: props.selected } : undefined}
213 />
214 );
215 }
216 return (
217 <Pressable
218 disabled={props.disabled}
219 onPress={props.onPress}
220 className={cn(
221 "bg-grouped-card px-3.5 py-2.5 active:opacity-70",
222 !props.isFirst && "border-t border-border-subtle",
223 props.disabled && "opacity-[0.45]",
224 )}
225 >
226 <View className="flex-row items-center gap-3">
227 <View
228 className={
229 props.selected
230 ? "h-7 w-7 items-center justify-center rounded-full bg-primary"
231 : "h-7 w-7 items-center justify-center"
232 }
233 >
234 {props.icon}
235 </View>
236 <View className="flex-1 gap-0.5">
237 <Text className="text-base leading-snug font-t3-bold">{props.title}</Text>
238 {props.subtitle ? (
239 <Text className="text-sm leading-snug text-foreground-muted" numberOfLines={2}>
240 {props.subtitle}
241 </Text>
242 ) : null}
243 </View>
244 {"right" in props ? (
245 props.right
246 ) : !props.disabled ? (
247 <SymbolView
248 name="chevron.right"
249 size={13}
250 tintColorClassName="accent-chevron"
251 type="monochrome"
252 />
253 ) : null}
254 </View>
255 </Pressable>
256 );
257}
258
259function PrimaryActionButton(props: {
260 readonly label: string;
261 readonly disabled?: boolean;
262 readonly loading?: boolean;
263 readonly onPress: () => void;
264}) {
265 if (Platform.OS === "android") return <Button {...props} tone="primary" fullWidth />;
266 return (
267 <Pressable
268 disabled={props.disabled}
269 onPress={props.onPress}
270 className="h-12 items-center justify-center rounded-full bg-primary active:opacity-70 disabled:opacity-45"
271 >
272 {props.loading ? (
273 <AppActivityIndicator colorClassName={String("accent-primary-foreground")} />
274 ) : (
275 <Text className="text-base font-t3-bold text-primary-foreground">{props.label}</Text>
276 )}
277 </Pressable>
278 );
279}
280
281function ProjectPathInput(props: {
282 readonly value: string;
283 readonly onChangeText: (value: string) => void;
284 readonly onSubmit: () => void;
285}) {
286 return (
287 <TextInput
288 className="h-12 min-h-12 rounded-[24px] px-4 py-0 text-base leading-snug"
289 value={props.value}
290 onChangeText={props.onChangeText}
291 autoCapitalize="none"
292 autoCorrect={false}
293 placeholder="~/projects/my-app"
294 returnKeyType="done"
295 onSubmitEditing={props.onSubmit}
296 />
297 );
298}
299
300function useBrowsePathInput(environment: EnvironmentOption | null, pinnedDirectoryName = "") {
301 const environmentId = environment?.environmentId ?? null;
302 const environmentBaseDirectory = environment?.baseDirectory ?? null;
303 const clonePathCaseSensitive = !isWindowsPlatform(environment?.platform ?? "");
304 const [pathInput, commitPathInput] = useState(() =>
305 getCloneDestinationPath(
306 getAddProjectInitialQuery(environmentBaseDirectory),
307 pinnedDirectoryName,
308 ),
309 );
310 const previousEnvironmentIdRef = useRef(environmentId);
311 const environmentRuntime = useRemoteEnvironmentRuntime(environmentId);
312 const loadBrowsePath = useAtomQueryRunner(filesystemEnvironment.browse, {
313 reportFailure: false,
314 reportDefect: false,
315 });
316 const [browseNavigation] = useState(createBrowseNavigationCoordinator);
317 const [isBrowseNavigating, setIsBrowseNavigating] = useState(false);
318 const setPathInput = (path: string) => {
319 browseNavigation.invalidate();
320 setIsBrowseNavigating(false);
321 commitPathInput(path);
322 };
323 const navigateToBrowsePath = async (input: {
324 readonly browseDirectoryPath: string;
325 readonly selectedDirectoryName?: string;
326 }) => {
327 const selectedDirectoryPath = input.selectedDirectoryName
328 ? appendBrowsePathSegment(input.browseDirectoryPath, input.selectedDirectoryName)
329 : input.browseDirectoryPath;
330 const nextPathInput =
331 pinnedDirectoryName && input.selectedDirectoryName
332 ? getCloneDestinationBrowsePath({
333 browseDirectoryPath: input.browseDirectoryPath,
334 selectedDirectoryName: input.selectedDirectoryName,
335 cloneDirectoryName: pinnedDirectoryName,
336 caseSensitive: clonePathCaseSensitive,
337 })
338 : getCloneDestinationPath(selectedDirectoryPath, pinnedDirectoryName);
339 setIsBrowseNavigating(true);
340 const committed = await browseNavigation.run(
341 async () => {
342 if (
343 environment &&
344 readEnvironmentScope(environment.environmentId, AuthFilesystemReadScope) &&
345 canPreloadBrowsePath(environmentRuntime?.connectionState)
346 ) {
347 await loadBrowsePath({
348 environmentId: environment.environmentId,
349 input: { partialPath: selectedDirectoryPath },
350 });
351 }
352 },
353 () => commitPathInput(nextPathInput),
354 );
355 if (committed) {
356 setIsBrowseNavigating(false);
357 }
358 return committed;
359 };
360
361 useEffect(() => {
362 if (environmentId !== null && environmentId !== previousEnvironmentIdRef.current) {
363 previousEnvironmentIdRef.current = environmentId;
364 setPathInput(
365 getCloneDestinationPath(
366 getAddProjectInitialQuery(environmentBaseDirectory),
367 pinnedDirectoryName,
368 ),
369 );
370 }
371 }, [environmentBaseDirectory, environmentId, pinnedDirectoryName, setPathInput]);
372
373 useEffect(
374 () => () => {
375 browseNavigation.invalidate();
376 },
377 [browseNavigation],
378 );
379
380 return { isBrowseNavigating, pathInput, setPathInput, navigateToBrowsePath };
381}
382
383function useEnvironmentOptions(): ReadonlyArray<EnvironmentOption> {
384 const serverConfigByEnvironmentId = useServerConfigs();
385 const { savedConnectionsById } = useSavedRemoteConnections();
386 const { connectedEnvironments } = useRemoteConnectionStatus();
387
388 return ((): ReadonlyArray<EnvironmentOption> => {
389 const runtimeByEnvironmentId = new Map(
390 connectedEnvironments.map((environment) => [environment.environmentId, environment] as const),
391 );
392 const options = Object.values(savedConnectionsById).map((connection) => {
393 const config = serverConfigByEnvironmentId.get(connection.environmentId);
394 const runtime = runtimeByEnvironmentId.get(connection.environmentId);
395 return {
396 environmentId: connection.environmentId,
397 label: connection.environmentLabel,
398 platform: platformFromOs(config?.environment.platform.os ?? null),
399 machine: resolveEnvironmentMachineKind(config ?? null),
400 baseDirectory: config?.settings.addProjectBaseDirectory ?? null,
401 newProjectsRoot: config?.newProjectsRoot ?? null,
402 connectionState: runtime?.connectionState ?? "available",
403 connectionError: runtime?.connectionError ?? null,
404 connectionErrorTraceId: runtime?.connectionErrorTraceId ?? null,
405 supportsCloneTracking: config?.environment.capabilities.projectCloneTracking === true,
406 };
407 });
408 return Arr.sort(
409 options.filter((environment) => canCreateProjectInEnvironment(environment.connectionState)),
410 environmentOptionOrder,
411 );
412 })();
413}
414
415function useSelectedEnvironment(): {
416 readonly environmentOptions: ReadonlyArray<EnvironmentOption>;
417 readonly selectedEnvironment: EnvironmentOption | null;
418 readonly setSelectedEnvironmentId: (environmentId: EnvironmentId) => void;
419} {
420 const [selectedEnvironmentId, setSelectedEnvironmentId] = useState<EnvironmentId | null>(null);
421 const environmentOptions = useEnvironmentOptions();
422 const selectedEnvironment =
423 environmentOptions.find(
424 (environment) =>
425 environment.environmentId === selectedEnvironmentId &&
426 canCreateProjectInEnvironment(environment.connectionState),
427 ) ??
428 environmentOptions.find((environment) =>
429 canCreateProjectInEnvironment(environment.connectionState),
430 ) ??
431 null;
432
433 return {
434 environmentOptions,
435 selectedEnvironment,
436 setSelectedEnvironmentId,
437 };
438}
439
440function EmptyEnvironmentState() {
441 const navigation = useNavigation();
442
443 return (
444 <View className="items-center gap-3 rounded-2xl bg-grouped-card px-5 py-8">
445 <Text className="text-center text-lg font-t3-bold">Environment unavailable</Text>
446 <Text className="text-center text-sm leading-normal text-foreground-muted">
447 Start or reconnect an environment before adding a project.
448 </Text>
449 <Pressable
450 onPress={() => navigation.dispatch(StackActions.replace("ConnectionsNew"))}
451 className="mt-1 rounded-full bg-primary px-4 py-2.5 active:opacity-70"
452 >
453 <Text className="text-sm font-t3-bold text-primary-foreground">Add environment</Text>
454 </Pressable>
455 </View>
456 );
457}
458
459function SourceControlRow(props: {
460 readonly source: AddProjectRemoteSource;
461 readonly selectedEnvironmentId: EnvironmentId;
462 readonly ready: boolean;
463 readonly hint: string;
464 readonly isFirst: boolean;
465}) {
466 const navigation = useNavigation();
467 const title =
468 props.source === "url" ? "Git URL" : `${addProjectRemoteSourceLabel(props.source)} repository`;
469 const subtitle =
470 props.source === "url"
471 ? "Clone from a remote URL"
472 : `Clone ${addProjectRemoteSourceLabel(props.source)} ${props.hint}`;
473 const icon =
474 props.source === "url" ? (
475 <SymbolView
476 name="link"
477 size={Platform.OS === "android" ? 24 : 17}
478 tintColorClassName="accent-icon"
479 type="monochrome"
480 />
481 ) : (
482 <SourceControlIcon
483 kind={sourceControlClients.get(props.source).icon}
484 size={Platform.OS === "android" ? 24 : 18}
485 colorClassName="accent-icon"
486 />
487 );
488
489 if (!props.ready) {
490 return (
491 <ListRow title={title} subtitle={props.hint} icon={icon} disabled isFirst={props.isFirst} />
492 );
493 }
494
495 return (
496 <ListRow
497 title={title}
498 subtitle={subtitle}
499 icon={icon}
500 isFirst={props.isFirst}
501 onPress={() =>
502 navigation.dispatch(
503 StackActions.push("AddProjectRepository", {
504 environmentId: props.selectedEnvironmentId,
505 source: props.source,
506 }),
507 )
508 }
509 />
510 );
511}
512
513export function AddProjectSourceScreen() {
514 const navigation = useNavigation();
515 const { environmentOptions, selectedEnvironment, setSelectedEnvironmentId } =
516 useSelectedEnvironment();
517 const canWriteSourceControl = useEnvironmentScope(
518 selectedEnvironment?.environmentId ?? null,
519 AuthSourceControlWriteScope,
520 );
521 const canCreateProject = useEnvironmentScope(
522 selectedEnvironment?.environmentId ?? null,
523 AuthOrchestrationOperateScope,
524 );
525 const canCloneProject = canWriteSourceControl && canCreateProject;
526 const discoveryState = useEnvironmentQuery(
527 selectedEnvironment === null
528 ? null
529 : sourceControlEnvironment.discovery({
530 environmentId: selectedEnvironment.environmentId,
531 input: {},
532 }),
533 );
534 const readiness = buildAddProjectRemoteSourceReadiness(discoveryState.data);
535
536 return (
537 <AddProjectShell title="Add project">
538 {selectedEnvironment === null ? <EmptyEnvironmentState /> : null}
539
540 {environmentOptions.length > 1 ? (
541 <>
542 <SectionTitle>Environments</SectionTitle>
543 <ListSection>
544 {environmentOptions.map((environment, index) => (
545 <ListRow
546 key={environment.environmentId}
547 title={environment.label}
548 subtitle={
549 canCreateProjectInEnvironment(environment.connectionState)
550 ? undefined
551 : connectionStatusText({
552 phase: environment.connectionState,
553 error: environment.connectionError,
554 traceId: environment.connectionErrorTraceId,
555 })
556 }
557 icon={
558 <EnvironmentMachineSymbol
559 kind={environment.machine}
560 size={Platform.OS === "android" ? 24 : 17}
561 tintColorClassName="accent-icon"
562 />
563 }
564 selected={environment.environmentId === selectedEnvironment?.environmentId}
565 disabled={!canCreateProjectInEnvironment(environment.connectionState)}
566 isFirst={index === 0}
567 right={
568 environment.environmentId === selectedEnvironment?.environmentId ? (
569 <SymbolView
570 name="checkmark"
571 size={Platform.OS === "android" ? 20 : 14}
572 tintColorClassName="accent-icon"
573 type="monochrome"
574 />
575 ) : null
576 }
577 onPress={() => setSelectedEnvironmentId(environment.environmentId)}
578 />
579 ))}
580 </ListSection>
581 </>
582 ) : null}
583
584 {selectedEnvironment ? (
585 <>
586 <ListSection>
587 {selectedEnvironment.newProjectsRoot !== null ? (
588 <ListRow
589 title="New project"
590 subtitle="Start a new Git repository from a name"
591 icon={
592 <SymbolView
593 name="plus"
594 size={Platform.OS === "android" ? 24 : 17}
595 tintColorClassName="accent-icon"
596 type="monochrome"
597 />
598 }
599 isFirst
600 onPress={() =>
601 navigation.dispatch(
602 StackActions.push("AddProjectNew", {
603 environmentId: selectedEnvironment.environmentId,
604 }),
605 )
606 }
607 />
608 ) : null}
609 <ListRow
610 title="Local folder"
611 subtitle={
612 canCreateProject
613 ? "Browse a folder on disk"
614 : "This connection cannot add projects."
615 }
616 icon={
617 <SymbolView
618 name="folder.badge.plus"
619 size={Platform.OS === "android" ? 24 : 17}
620 tintColorClassName="accent-icon"
621 type="monochrome"
622 />
623 }
624 isFirst={selectedEnvironment.newProjectsRoot === null}
625 disabled={!canCreateProject}
626 onPress={() =>
627 navigation.dispatch(
628 StackActions.push("AddProjectLocal", {
629 environmentId: selectedEnvironment.environmentId,
630 }),
631 )
632 }
633 />
634 {(["url", ...sortAddProjectProviderSources(readiness)] as AddProjectRemoteSource[]).map(
635 (candidate) => (
636 <SourceControlRow
637 key={candidate}
638 source={candidate}
639 selectedEnvironmentId={selectedEnvironment.environmentId}
640 ready={canCloneProject && readiness(candidate).ready}
641 hint={
642 !canCloneProject
643 ? "This connection cannot clone projects."
644 : readiness(candidate).ready
645 ? addProjectRemoteSourcePathHint(candidate)
646 : (readiness(candidate).hint ?? "")
647 }
648 isFirst={false}
649 />
650 ),
651 )}
652 </ListSection>
653 {discoveryState.isPending ? (
654 <AppActivityIndicator colorClassName="accent-icon-muted" />
655 ) : null}
656 </>
657 ) : null}
658 </AddProjectShell>
659 );
660}
661
662function openNewTaskDraft(
663 navigation: { dispatch: (action: ReturnType<typeof CommonActions.reset>) => void },
664 params: {
665 environmentId: EnvironmentId;
666 projectId: ProjectId;
667 title: string;
668 cloning?: "1";
669 draftId?: string;
670 },
671) {
672 navigation.dispatch(
673 CommonActions.reset({ index: 0, routes: [{ name: "NewTaskDraft", params }] }),
674 );
675}
676
677async function draftWithPrompt(
678 environmentId: EnvironmentId,
679 projectId: ProjectId,
680 prompt: string,
681): Promise<string> {
682 await waitForComposerDraftsLoaded();
683 const draftId = createNewTaskDraft({ environmentId, projectId });
684 setComposerDraftText(draftId, prompt);
685 return draftId;
686}
687
688function useCreateProject(environment: EnvironmentOption | null) {
689 const navigation = useNavigation();
690 const createProject = useAtomCommand(projectEnvironment.create, { reportFailure: false });
691 const projects = useProjects();
692
693 return async (workspaceRoot: string) => {
694 if (
695 !environment ||
696 !canCreateProjectInEnvironment(environment.connectionState) ||
697 !readEnvironmentScope(environment.environmentId, AuthOrchestrationOperateScope)
698 ) {
699 Dialog.alert(
700 "Project not added",
701 `This connection cannot add projects right now. Any existing files remain at ${workspaceRoot}.`,
702 );
703 return;
704 }
705
706 const existing = findExistingAddProject({
707 projects,
708 environmentId: environment.environmentId,
709 path: workspaceRoot,
710 });
711 if (existing) {
712 Dialog.alert("Project already exists", existing.title);
713 navigation.dispatch(
714 CommonActions.reset({
715 index: 0,
716 routes: [
717 {
718 name: "NewTaskDraft",
719 params: {
720 environmentId: existing.environmentId,
721 projectId: existing.id,
722 title: existing.title,
723 },
724 },
725 ],
726 }),
727 );
728 return;
729 }
730
731 const projectId = ProjectId.make(uuidv4());
732 const command = buildProjectCreateCommand({
733 commandId: CommandId.make(uuidv4()),
734 projectId,
735 workspaceRoot,
736 });
737 const result = await createProject({
738 environmentId: environment.environmentId,
739 input: command,
740 });
741 if (AsyncResult.isFailure(result)) {
742 return result;
743 }
744 navigation.dispatch(
745 CommonActions.reset({
746 index: 0,
747 routes: [
748 {
749 name: "NewTaskDraft",
750 params: {
751 environmentId: environment.environmentId,
752 projectId,
753 title: inferProjectTitleFromPath(workspaceRoot),
754 },
755 },
756 ],
757 }),
758 );
759 return result;
760 };
761}
762
763function useEnvironmentFromParam(
764 environmentIdParam: string | string[] | undefined,
765): EnvironmentOption | null {
766 const environmentOptions = useEnvironmentOptions();
767 const environmentId = stringParam(environmentIdParam) as EnvironmentId | null;
768 return resolveAddProjectEnvironment(environmentOptions, environmentId);
769}
770
771export function AddProjectRepositoryScreen(props: {
772 readonly environmentId?: string | string[];
773 readonly source?: string | string[];
774}) {
775 const lookupRepositoryQuery = useAtomQueryRunner(sourceControlEnvironment.repository, {
776 reportFailure: false,
777 });
778 const navigation = useNavigation();
779 const environment = useEnvironmentFromParam(props.environmentId);
780 const source = sourceFromParam(props.source);
781 const [repositoryInput, setRepositoryInput] = useState("");
782 const [isSubmitting, setIsSubmitting] = useState(false);
783 const [error, setError] = useState<string | null>(null);
784
785 const lookupRepository = async () => {
786 if (!environment || repositoryInput.trim().length === 0 || isSubmitting) return;
787 setError(null);
788 setIsSubmitting(true);
789 const provider = addProjectRemoteSourceProvider(source);
790 if (!provider) {
791 const remoteUrl = normalizePastedCloneUrl(repositoryInput);
792 navigation.dispatch(
793 StackActions.push("AddProjectDestination", {
794 environmentId: environment.environmentId,
795 source,
796 remoteUrl,
797 repositoryTitle: remoteUrl,
798 repositoryName: getCloneDirectoryName(remoteUrl),
799 }),
800 );
801 setIsSubmitting(false);
802 return;
803 }
804
805 const result = await lookupRepositoryQuery({
806 environmentId: environment.environmentId,
807 input: {
808 provider,
809 repository: repositoryInput.trim(),
810 },
811 });
812 if (AsyncResult.isFailure(result)) {
813 setError(errorMessage(Cause.squash(result.cause)));
814 } else {
815 const repository = result.value;
816 navigation.dispatch(
817 StackActions.push("AddProjectDestination", {
818 environmentId: environment.environmentId,
819 source,
820 remoteUrl: getDefaultCloneUrl(repository),
821 repositoryTitle: repository.nameWithOwner,
822 repositoryName: getCloneDirectoryName(repository.nameWithOwner),
823 }),
824 );
825 }
826 setIsSubmitting(false);
827 };
828
829 return (
830 <AddProjectShell title={source === "url" ? "Git URL" : addProjectRemoteSourceLabel(source)}>
831 {error ? <ErrorBanner message={error} /> : null}
832 {environment ? (
833 <>
834 <TextInput
835 className="h-12 min-h-12 rounded-[24px] px-4 py-0 text-base leading-snug"
836 value={repositoryInput}
837 onChangeText={setRepositoryInput}
838 autoCapitalize="none"
839 autoCorrect={false}
840 placeholder={
841 source === "url"
842 ? "https://github.com/org/repo.git"
843 : addProjectRemoteSourcePathHint(source)
844 }
845 returnKeyType="next"
846 onSubmitEditing={() => void lookupRepository()}
847 />
848 <PrimaryActionButton
849 label={source === "url" ? "Continue" : "Lookup repository"}
850 disabled={isSubmitting || repositoryInput.trim().length === 0}
851 onPress={() => void lookupRepository()}
852 loading={isSubmitting}
853 />
854 </>
855 ) : (
856 <EmptyEnvironmentState />
857 )}
858 </AddProjectShell>
859 );
860}
861
862function FolderBrowser(props: {
863 readonly environment: EnvironmentOption;
864 readonly pathInput: string;
865 readonly setPathInput: (path: string) => void;
866 readonly navigateToBrowsePath: (input: {
867 readonly browseDirectoryPath: string;
868 readonly selectedDirectoryName?: string;
869 }) => Promise<boolean>;
870 readonly pinnedDirectoryName?: string;
871}) {
872 const browsePath = getFilesystemBrowsePath(props.pathInput, props.environment.platform);
873 const browseInput =
874 browsePath.directoryPath.length > 0 ? { partialPath: browsePath.directoryPath } : null;
875 const fileAccessSession = useEnvironmentQuery(
876 environmentSession.sessionStateAtom(props.environment.environmentId),
877 );
878 const fileEnvironment = useEnvironmentPresentation(props.environment.environmentId);
879 const fileAccess = resolveFilesystemReadAccess({
880 isCatalogReady: fileEnvironment.isReady,
881 connection: fileEnvironment.presentation?.connection ?? null,
882 session: fileAccessSession.data,
883 sessionError: fileAccessSession.error,
884 });
885 const { canReadFiles } = fileAccess;
886 const browseState = useEnvironmentQuery(
887 !canReadFiles || browseInput === null
888 ? null
889 : filesystemEnvironment.browse({
890 environmentId: props.environment.environmentId,
891 input: browseInput,
892 }),
893 );
894 const pinnedDirectoryName = props.pinnedDirectoryName ?? "";
895 const pinnedDirectoryMatches = isWindowsPlatform(props.environment.platform)
896 ? browsePath.filterQuery.toLowerCase() === pinnedDirectoryName.toLowerCase()
897 : browsePath.filterQuery === pinnedDirectoryName;
898 const browseFilterQuery = pinnedDirectoryMatches ? "" : browsePath.filterQuery;
899 const { visibleEntries: visibleBrowseEntries } = filterFilesystemBrowseEntries(
900 browseState.data?.entries ?? [],
901 browseFilterQuery,
902 );
903
904 return (
905 <>
906 <SectionTitle>Browse folders</SectionTitle>
907 {!canReadFiles && !fileAccess.isPending ? (
908 <ErrorBanner message={fileAccess.error ?? "This connection cannot browse host folders."} />
909 ) : null}
910 {browseState.error ? <ErrorBanner message={browseState.error} /> : null}
911 <ListSection>
912 {fileAccess.isPending || (browseState.isPending && browseState.data === null) ? (
913 <View className="items-center py-5">
914 <AppActivityIndicator colorClassName="accent-icon-muted" />
915 </View>
916 ) : null}
917 {browsePath.canBrowseUp ? (
918 <ListRow
919 title=".."
920 icon={
921 <SymbolView
922 name="arrow.turn.left.up"
923 size={Platform.OS === "android" ? 24 : 17}
924 tintColorClassName="accent-icon-muted"
925 type="monochrome"
926 />
927 }
928 isFirst
929 right={null}
930 onPress={() => {
931 if (browsePath.parentPath) {
932 void props.navigateToBrowsePath({
933 browseDirectoryPath: browsePath.parentPath,
934 });
935 }
936 }}
937 />
938 ) : null}
939 {visibleBrowseEntries.map((entry, index) => (
940 <ListRow
941 key={entry.fullPath}
942 title={entry.name}
943 icon={
944 <SymbolView
945 name="folder"
946 size={Platform.OS === "android" ? 24 : 17}
947 tintColorClassName="accent-icon-muted"
948 type="monochrome"
949 />
950 }
951 isFirst={index === 0 && !browsePath.canBrowseUp}
952 right={null}
953 onPress={() => {
954 void props.navigateToBrowsePath({
955 browseDirectoryPath: browsePath.directoryPath,
956 selectedDirectoryName: entry.name,
957 });
958 }}
959 />
960 ))}
961 </ListSection>
962 </>
963 );
964}
965
966export function AddProjectNewScreen(props: { readonly environmentId?: string | string[] }) {
967 const navigation = useNavigation();
968 const environmentOptions = useEnvironmentOptions().filter(
969 (option) => option.newProjectsRoot !== null,
970 );
971 const [selectedEnvironmentId, setSelectedEnvironmentId] = useState(
972 () => stringParam(props.environmentId) as EnvironmentId | null,
973 );
974 const environment = resolveAddProjectEnvironment(environmentOptions, selectedEnvironmentId);
975 const createNew = useAtomCommand(projectEnvironment.createNew, { reportFailure: false });
976 const publishRepository = useAtomCommand(sourceControlEnvironment.publishRepository, {
977 reportFailure: false,
978 });
979 const discoveryState = useEnvironmentQuery(
980 environment === null
981 ? null
982 : sourceControlEnvironment.discovery({
983 environmentId: environment.environmentId,
984 input: {},
985 }),
986 );
987 const publishTargets = getNewProjectPublishTargets(discoveryState.data);
988 const [name, setName] = useState("");
989 const [publishes, setPublishes] = useState(false);
990 const [publishKind, setPublishKind] = useState<SourceControlProviderKind | null>(null);
991 const publishTarget = getNewProjectPublishTarget(publishTargets, publishKind);
992 const [isSubmitting, setIsSubmitting] = useState(false);
993 const [error, setError] = useState<string | null>(null);
994 const trimmedName = name.trim();
995 const pathPreview =
996 environment?.newProjectsRoot != null
997 ? getNewProjectPathPreview(environment.newProjectsRoot, trimmedName)
998 : null;
999
1000 const showMachines =
1001 environmentOptions.length > 1 || (environment === null && environmentOptions.length > 0);
1002 const machineRows = showMachines ? (
1003 <ListSection>
1004 {environmentOptions.map((option, index) => {
1005 const selected = option.environmentId === environment?.environmentId;
1006 return (
1007 <ListRow
1008 key={option.environmentId}
1009 title={option.label}
1010 icon={
1011 <EnvironmentMachineSymbol
1012 kind={option.machine}
1013 size={Platform.OS === "android" ? 24 : 17}
1014 tintColorClassName="accent-icon"
1015 />
1016 }
1017 selected={selected}
1018 disabled={isSubmitting}
1019 isFirst={index === 0}
1020 right={
1021 selected ? (
1022 <SymbolView
1023 name="checkmark"
1024 size={Platform.OS === "android" ? 20 : 14}
1025 tintColorClassName="accent-icon"
1026 type="monochrome"
1027 />
1028 ) : null
1029 }
1030 onPress={() => setSelectedEnvironmentId(option.environmentId)}
1031 />
1032 );
1033 })}
1034 </ListSection>
1035 ) : null;
1036
1037 // State lags a render behind, so a double tap could start a second create.
1038 const submittingRef = useRef(false);
1039 const submit = async () => {
1040 if (!environment || trimmedName.length === 0 || submittingRef.current) return;
1041 submittingRef.current = true;
1042 setError(null);
1043 setIsSubmitting(true);
1044 const result = await createNew({
1045 environmentId: environment.environmentId,
1046 input: { name: trimmedName },
1047 });
1048 if (AsyncResult.isFailure(result)) {
1049 submittingRef.current = false;
1050 setIsSubmitting(false);
1051 setError(errorMessage(Cause.squash(result.cause)));
1052 return;
1053 }
1054 const { projectId, workspaceRoot, commitError } = result.value;
1055 if (commitError !== undefined) {
1056 Dialog.alert("Created without a first commit", commitError);
1057 }
1058 if (publishes && publishTarget !== null) {
1059 void publishRepository({
1060 environmentId: environment.environmentId,
1061 input: {
1062 cwd: workspaceRoot,
1063 provider: publishTarget.definition.kind,
1064 repository: getNewProjectRepository(publishTarget, workspaceRoot),
1065 visibility: "private",
1066 },
1067 }).then((publishResult) => {
1068 if (AsyncResult.isFailure(publishResult)) {
1069 Dialog.alert(
1070 `Could not create the ${publishTarget.definition.label} repository`,
1071 errorMessage(Cause.squash(publishResult.cause)),
1072 );
1073 }
1074 });
1075 }
1076 // The draft screen resolves its project from the client store, so it
1077 // must not open before the create event has arrived.
1078 const project = await waitForProject(
1079 { environmentId: environment.environmentId, projectId },
1080 15_000,
1081 );
1082 submittingRef.current = false;
1083 setIsSubmitting(false);
1084 if (project === null) {
1085 setName("");
1086 setError(
1087 "The project was created but has not reached this device yet. It will appear in the project list once the connection catches up.",
1088 );
1089 return;
1090 }
1091 openNewTaskDraft(navigation, {
1092 environmentId: environment.environmentId,
1093 projectId,
1094 title: trimmedName,
1095 });
1096 };
1097
1098 return (
1099 <AddProjectShell title="New project">
1100 {error ? <ErrorBanner message={error} /> : null}
1101 {environment ? (
1102 <>
1103 <TextInput
1104 className="h-12 min-h-12 rounded-[24px] px-4 py-0 text-base leading-snug"
1105 value={name}
1106 onChangeText={setName}
1107 autoCorrect={false}
1108 autoFocus
1109 placeholder="Project name"
1110 returnKeyType="done"
1111 onSubmitEditing={() => void submit()}
1112 />
1113 {pathPreview !== null ? (
1114 <Text className="px-1 text-sm leading-snug text-foreground-muted" numberOfLines={2}>
1115 {trimmedName.length > 0
1116 ? `Creates ${pathPreview}`
1117 : `Goes in ${environment.newProjectsRoot}`}
1118 {showMachines ? ` on ${environment.label}` : null}
1119 </Text>
1120 ) : null}
1121 {machineRows}
1122 {publishTarget !== null ? (
1123 <ListSection>
1124 <ListRow
1125 title={`Create private repository on ${publishTarget.definition.label}`}
1126 subtitle={
1127 trimmedName.length > 0 && pathPreview !== null
1128 ? getNewProjectRepository(publishTarget, pathPreview)
1129 : publishTarget.owner
1130 }
1131 icon={
1132 <SourceControlIcon
1133 kind={publishTarget.definition.icon}
1134 size={Platform.OS === "android" ? 24 : 18}
1135 colorClassName="accent-icon"
1136 />
1137 }
1138 isFirst
1139 right={
1140 <ThemedSwitch
1141 accessibilityLabel={`Create private repository on ${publishTarget.definition.label}`}
1142 value={publishes}
1143 onValueChange={setPublishes}
1144 />
1145 }
1146 onPress={() => setPublishes((current) => !current)}
1147 />
1148 {publishes && publishTargets.length > 1
1149 ? publishTargets.map((target) => {
1150 const selected = target.definition.kind === publishTarget.definition.kind;
1151 return (
1152 <ListRow
1153 key={target.definition.kind}
1154 title={target.definition.label}
1155 icon={
1156 <SourceControlIcon
1157 kind={target.definition.icon}
1158 size={Platform.OS === "android" ? 24 : 17}
1159 colorClassName="accent-icon"
1160 />
1161 }
1162 selected={selected}
1163 disabled={isSubmitting}
1164 right={
1165 selected ? (
1166 <SymbolView
1167 name="checkmark"
1168 size={Platform.OS === "android" ? 20 : 14}
1169 tintColorClassName="accent-icon"
1170 type="monochrome"
1171 />
1172 ) : null
1173 }
1174 onPress={() => setPublishKind(target.definition.kind)}
1175 />
1176 );
1177 })
1178 : null}
1179 </ListSection>
1180 ) : null}
1181 <PrimaryActionButton
1182 label="Create project"
1183 disabled={isSubmitting || trimmedName.length === 0}
1184 onPress={() => void submit()}
1185 loading={isSubmitting}
1186 />
1187 <ListSection>
1188 <ListRow
1189 title="Add existing project"
1190 subtitle="Open a folder or clone a repository"
1191 icon={
1192 <SymbolView
1193 name="folder.badge.plus"
1194 size={Platform.OS === "android" ? 24 : 17}
1195 tintColorClassName="accent-icon"
1196 type="monochrome"
1197 />
1198 }
1199 isFirst
1200 onPress={() =>
1201 navigation.canGoBack()
1202 ? navigation.goBack()
1203 : navigation.dispatch(StackActions.replace("AddProject"))
1204 }
1205 />
1206 </ListSection>
1207 </>
1208 ) : environmentOptions.length > 0 ? (
1209 machineRows
1210 ) : (
1211 <EmptyEnvironmentState />
1212 )}
1213 </AddProjectShell>
1214 );
1215}
1216
1217export function AddProjectLocalFolderScreen(props: { readonly environmentId?: string | string[] }) {
1218 const environment = useEnvironmentFromParam(props.environmentId);
1219 const canCreateProject = useEnvironmentScope(
1220 environment?.environmentId ?? null,
1221 AuthOrchestrationOperateScope,
1222 );
1223 const createProject = useCreateProject(environment);
1224 const { isBrowseNavigating, navigateToBrowsePath, pathInput, setPathInput } =
1225 useBrowsePathInput(environment);
1226 const [isSubmitting, setIsSubmitting] = useState(false);
1227 const [error, setError] = useState<string | null>(null);
1228
1229 const submitPath = async () => {
1230 if (!environment || isBrowseNavigating || isSubmitting) return;
1231 setError(null);
1232 const resolved = resolveAddProjectPath({
1233 rawPath: pathInput,
1234 currentProjectCwd: null,
1235 platform: environment.platform,
1236 });
1237 if (!resolved.ok) {
1238 setError(resolved.error);
1239 return;
1240 }
1241
1242 setIsSubmitting(true);
1243 const result = await createProject(resolved.path);
1244 if (result && AsyncResult.isFailure(result)) {
1245 setError(errorMessage(Cause.squash(result.cause)));
1246 }
1247 setIsSubmitting(false);
1248 };
1249
1250 return (
1251 <AddProjectShell title="Local folder">
1252 {error ? <ErrorBanner message={error} /> : null}
1253 {environment ? (
1254 <>
1255 {!canCreateProject ? (
1256 <ErrorBanner message="This connection cannot add projects." />
1257 ) : null}
1258 <ProjectPathInput value={pathInput} onChangeText={setPathInput} onSubmit={submitPath} />
1259 <PrimaryActionButton
1260 label="Add project"
1261 disabled={!canCreateProject || isBrowseNavigating || isSubmitting}
1262 onPress={submitPath}
1263 loading={isSubmitting}
1264 />
1265 <FolderBrowser
1266 environment={environment}
1267 navigateToBrowsePath={navigateToBrowsePath}
1268 pathInput={pathInput}
1269 setPathInput={setPathInput}
1270 />
1271 </>
1272 ) : (
1273 <EmptyEnvironmentState />
1274 )}
1275 </AddProjectShell>
1276 );
1277}
1278
1279export function AddProjectDestinationScreen(props: {
1280 readonly environmentId?: string | string[];
1281 readonly remoteUrl?: string | string[];
1282 readonly repositoryTitle?: string | string[];
1283 readonly repositoryName?: string | string[];
1284 readonly prompt?: string | string[];
1285}) {
1286 const cloneRepository = useAtomCommand(sourceControlEnvironment.cloneRepository, {
1287 reportFailure: false,
1288 });
1289 const startProjectClone = useAtomCommand(sourceControlEnvironment.startProjectClone, {
1290 reportFailure: false,
1291 });
1292 const navigation = useNavigation();
1293 const environment = useEnvironmentFromParam(props.environmentId);
1294 const canWriteSourceControl = useEnvironmentScope(
1295 environment?.environmentId ?? null,
1296 AuthSourceControlWriteScope,
1297 );
1298 const canCreateProject = useEnvironmentScope(
1299 environment?.environmentId ?? null,
1300 AuthOrchestrationOperateScope,
1301 );
1302 const canCloneProject = canWriteSourceControl && canCreateProject;
1303 const createProject = useCreateProject(environment);
1304 const remoteUrl = stringParam(props.remoteUrl);
1305 const repositoryTitle = stringParam(props.repositoryTitle);
1306 const prompt = stringParam(props.prompt);
1307 const repositoryName = stringParam(props.repositoryName)?.trim() ?? "";
1308 const { isBrowseNavigating, navigateToBrowsePath, pathInput, setPathInput } = useBrowsePathInput(
1309 environment,
1310 repositoryName,
1311 );
1312 const [isSubmitting, setIsSubmitting] = useState(false);
1313 const [error, setError] = useState<string | null>(null);
1314
1315 const submitPath = async () => {
1316 if (
1317 !environment ||
1318 !readEnvironmentScope(environment.environmentId, AuthSourceControlWriteScope) ||
1319 !readEnvironmentScope(environment.environmentId, AuthOrchestrationOperateScope) ||
1320 !remoteUrl ||
1321 isBrowseNavigating ||
1322 isSubmitting
1323 ) {
1324 return;
1325 }
1326 setError(null);
1327 const resolved = resolveAddProjectPath({
1328 rawPath: pathInput,
1329 currentProjectCwd: null,
1330 platform: environment.platform,
1331 });
1332 if (!resolved.ok) {
1333 setError(resolved.error);
1334 return;
1335 }
1336
1337 setIsSubmitting(true);
1338 if (environment.supportsCloneTracking) {
1339 const projectId = ProjectId.make(uuidv4());
1340 const title = inferProjectTitleFromPath(resolved.path);
1341 const startResult = await startProjectClone({
1342 environmentId: environment.environmentId,
1343 input: {
1344 projectId,
1345 title,
1346 createdAt: new Date().toISOString(),
1347 remoteUrl,
1348 destinationPath: resolved.path,
1349 },
1350 });
1351 if (AsyncResult.isFailure(startResult)) {
1352 setError(errorMessage(Cause.squash(startResult.cause)));
1353 } else {
1354 // The draft screen resolves its project from the client store, so it
1355 // must not open before the create event has arrived (it would fall back
1356 // to the project picker and lose the clone controls).
1357 const project = await waitForProject(
1358 { environmentId: environment.environmentId, projectId },
1359 15_000,
1360 );
1361 if (project === null) {
1362 setError(
1363 "The project was created but has not reached this device yet. It will appear in the project list once the connection catches up.",
1364 );
1365 } else {
1366 openNewTaskDraft(navigation, {
1367 environmentId: environment.environmentId,
1368 projectId,
1369 title,
1370 cloning: "1",
1371 ...(prompt
1372 ? await draftWithPrompt(environment.environmentId, projectId, prompt).then(
1373 (draftId) => ({ draftId }),
1374 () => ({}),
1375 )
1376 : {}),
1377 });
1378 }
1379 }
1380 setIsSubmitting(false);
1381 return;
1382 }
1383 const cloneResult = await cloneRepository({
1384 environmentId: environment.environmentId,
1385 input: {
1386 remoteUrl,
1387 destinationPath: resolved.path,
1388 },
1389 });
1390 if (AsyncResult.isFailure(cloneResult)) {
1391 setError(errorMessage(Cause.squash(cloneResult.cause)));
1392 } else {
1393 const createResult = await createProject(cloneResult.value.cwd);
1394 if (createResult && AsyncResult.isFailure(createResult)) {
1395 setError(errorMessage(Cause.squash(createResult.cause)));
1396 }
1397 }
1398 setIsSubmitting(false);
1399 };
1400
1401 return (
1402 <AddProjectShell title="Clone destination">
1403 {error ? <ErrorBanner message={error} /> : null}
1404 {repositoryTitle ? (
1405 <View className="rounded-[24px] bg-grouped-card px-4 py-3">
1406 <Text className="text-base font-t3-bold">{repositoryTitle}</Text>
1407 <Text className="mt-0.5 text-xs text-foreground-muted" numberOfLines={2}>
1408 {remoteUrl}
1409 </Text>
1410 </View>
1411 ) : null}
1412 {environment ? (
1413 <>
1414 <ProjectPathInput value={pathInput} onChangeText={setPathInput} onSubmit={submitPath} />
1415 <PrimaryActionButton
1416 label="Clone project"
1417 disabled={!canCloneProject || isBrowseNavigating || isSubmitting || !remoteUrl}
1418 onPress={submitPath}
1419 loading={isSubmitting}
1420 />
1421 {!canCloneProject ? (
1422 <Text className="text-sm text-foreground-muted">
1423 This connection cannot clone projects.
1424 </Text>
1425 ) : null}
1426 <FolderBrowser
1427 environment={environment}
1428 navigateToBrowsePath={navigateToBrowsePath}
1429 pathInput={pathInput}
1430 setPathInput={setPathInput}
1431 pinnedDirectoryName={repositoryName}
1432 />
1433 </>
1434 ) : (
1435 <EmptyEnvironmentState />
1436 )}
1437 </AddProjectShell>
1438 );
1439}