From 4db082a2d22717c93be0087a793aae5176458167 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 21 May 2026 19:18:55 -0700 Subject: [PATCH] Unify mobile new-task and project sheet headers - Extract shared new-task sheet header - Refresh add-project form spacing and controls - Align project creation screens with the new sheet layout --- apps/mobile/src/app/new/index.tsx | 13 +- .../features/projects/AddProjectScreen.tsx | 137 ++++++++++-------- .../features/threads/NewTaskDraftScreen.tsx | 52 ++----- .../features/threads/NewTaskSheetHeader.tsx | 46 ++++++ 4 files changed, 133 insertions(+), 115 deletions(-) create mode 100644 apps/mobile/src/features/threads/NewTaskSheetHeader.tsx diff --git a/apps/mobile/src/app/new/index.tsx b/apps/mobile/src/app/new/index.tsx index 535a2676f8..d68d882008 100644 --- a/apps/mobile/src/app/new/index.tsx +++ b/apps/mobile/src/app/new/index.tsx @@ -8,6 +8,7 @@ import { useThemeColor } from "../../lib/useThemeColor"; import { AppText as Text } from "../../components/AppText"; import { ProjectFavicon } from "../../components/ProjectFavicon"; +import { NewTaskSheetHeader } from "../../features/threads/NewTaskSheetHeader"; import { groupProjectsByRepository } from "../../lib/repositoryGroups"; import { type RemoteCatalogState, useRemoteCatalog } from "../../state/use-remote-catalog"; import { useRemoteEnvironmentState } from "../../state/use-remote-environment-registry"; @@ -103,17 +104,7 @@ export default function NewTaskRoute() { - - - - - New task - - Choose project - + - - router.back()} - /> - {props.title} - - + router.back(), + }} + /> {props.children}; + return {props.children}; } function ListRow(props: { @@ -196,6 +196,48 @@ function ListRow(props: { ); } +function PrimaryActionButton(props: { + readonly label: string; + readonly disabled?: boolean; + readonly loading?: boolean; + readonly onPress: () => void; +}) { + const primaryForeground = useThemeColor("--color-primary-foreground"); + + return ( + + {props.loading ? ( + + ) : ( + {props.label} + )} + + ); +} + +function ProjectPathInput(props: { + readonly value: string; + readonly onChangeText: (value: string) => void; + readonly onSubmit: () => void; +}) { + return ( + + ); +} + function useEnvironmentOptions(): ReadonlyArray { const { serverConfigByEnvironmentId } = useRemoteCatalog(); const { savedConnectionsById } = useRemoteEnvironmentState(); @@ -321,7 +363,7 @@ export function AddProjectSourceScreen() { }, [selectedEnvironment]); return ( - + {environmentOptions.length === 0 ? : null} {environmentOptions.length > 1 ? ( @@ -362,7 +404,6 @@ export function AddProjectSourceScreen() { {selectedEnvironment ? ( <> - Sources (); const environment = useEnvironmentFromParam(); const source = sourceFromParam(params.source); - const primaryForeground = useThemeColor("--color-primary-foreground"); const [repositoryInput, setRepositoryInput] = useState(""); const [isSubmitting, setIsSubmitting] = useState(false); const [error, setError] = useState(null); @@ -524,7 +564,7 @@ export function AddProjectRepositoryScreen() { {error ? : null} void lookupRepository()} /> - void lookupRepository()} - className="h-11 items-center justify-center rounded-full bg-primary active:opacity-70 disabled:opacity-45" - > - {isSubmitting ? ( - - ) : ( - - {source === "url" ? "Continue" : "Lookup repository"} - - )} - + loading={isSubmitting} + /> ); } @@ -643,7 +676,6 @@ function FolderBrowser(props: { export function AddProjectLocalFolderScreen() { const environment = useEnvironmentFromParam(); const createProject = useCreateProject(environment); - const primaryForeground = useThemeColor("--color-primary-foreground"); const [pathInput, setPathInput] = useState(() => getAddProjectInitialQuery(environment?.baseDirectory), ); @@ -683,27 +715,17 @@ export function AddProjectLocalFolderScreen() { {error ? : null} {environment ? ( <> - void submitPath()} + onSubmit={() => void submitPath()} /> - void submitPath()} - className="h-11 items-center justify-center rounded-full bg-primary active:opacity-70" - > - {isSubmitting ? ( - - ) : ( - Add project - )} - + loading={isSubmitting} + /> (); const environment = useEnvironmentFromParam(); const createProject = useCreateProject(environment); - const primaryForeground = useThemeColor("--color-primary-foreground"); const remoteUrl = stringParam(params.remoteUrl); const repositoryTitle = stringParam(params.repositoryTitle); const [pathInput, setPathInput] = useState(() => @@ -772,7 +793,7 @@ export function AddProjectDestinationScreen() { {error ? : null} {repositoryTitle ? ( - + {repositoryTitle} {remoteUrl} @@ -781,29 +802,17 @@ export function AddProjectDestinationScreen() { ) : null} {environment ? ( <> - void submitPath()} + onSubmit={() => void submitPath()} /> - void submitPath()} - className="h-11 items-center justify-center rounded-full bg-primary active:opacity-70 disabled:opacity-45" - > - {isSubmitting ? ( - - ) : ( - - Clone project - - )} - + loading={isSubmitting} + /> { @@ -394,48 +393,21 @@ export function NewTaskDraftScreen(props: { if (!selectedProject) { return ( - - - - New task - - Loading task - + ); } return ( - - - - {flow.logicalProjects.length > 1 ? ( - router.back()} - > - - - ) : null} - - New task - - {selectedProject.title} - + 1 + ? { icon: "chevron.left", onPress: () => router.back() } + : undefined + } + /> void; + }; +}) { + const iconColor = useThemeColor("--color-icon"); + + return ( + <> + + + {props.control ? ( + + + + ) : null} + + {props.eyebrow ?? "New task"} + + {props.title} + + + ); +}