Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

AddProjectRepositoryRoute.tsx

35 lines1.2 KB

1import type { StaticScreenProps } from "@react-navigation/native";
2import { NativeStackScreenOptions } from "../../native/StackHeader";
3import { addProjectRemoteTargetLabel } from "@t3tools/client-runtime/operations/projects";
4​
5import { AddProjectRepositoryScreen } from "./AddProjectScreen";
6​
7type AddProjectRepositoryRouteParams = {
8 readonly environmentId?: string | string[];
9 readonly source?: string | string[];
10 readonly host?: string | string[];
11};
12​
13export function AddProjectRepositoryRoute({
14 route,
15}: StaticScreenProps<AddProjectRepositoryRouteParams>) {
16 const params = route.params ?? {};
17 const source = Array.isArray(params.source) ? params.source[0] : params.source;
18 const host = Array.isArray(params.host) ? params.host[0] : params.host;
19 const title =
20 source === "github" ||
21 source === "github-enterprise" ||
22 source === "gitlab" ||
23 source === "forgejo" ||
24 source === "bitbucket" ||
25 source === "azure-devops"
26 ? addProjectRemoteTargetLabel({ id: source, source, host: host ?? null })
27 : "Git URL";
28​
29 return (
30 <>
31 <NativeStackScreenOptions options={{ title }} />
32 <AddProjectRepositoryScreen {...params} />
33 </>
34 );