feat(pull_request): continue work on the pr flow
+ 84
- 5
@@ -1,5 +1,5 @@
 {
-  "_generatedAtUnix": 1665025556931,
+  "_generatedAtUnix": 1665028457692,
   "_hashAlgorithm": "sha1",
   "_version": 2,
   "islands": {

...
@@ -58,7 +58,7 @@
       "pathSourceMap": "./public/.islands/RepositoryInitialSetup.bundle.js.map"
     },
     "RepositoryPullRequestCreateForm": {
-      "hash": "2b062b98a7da02483b72dd96f7093dfee181c638",
+      "hash": "e83dae6dd37566500d8c76f6bebf9203863b75bf",
       "pathSource": "./app/islands/RepositoryPullRequestCreateForm.tsx",
       "pathBundle": "./public/.islands/RepositoryPullRequestCreateForm.bundle.js",
       "pathSourceMap": "./public/.islands/RepositoryPullRequestCreateForm.bundle.js.map"

app/controllers/repository/getRepositoryPullRequestCreateView.ts
@@ -32,10 +32,13 @@ const getRepositoryPullRequestCreateView: ReqHandler = async (
     return reply.status(404).callNotFound();
   }
 
+  const branches = await repoService.getRepositoryBranches(repo);
+
   const variant: RepositoryPullRequestCreateFormVariant = {
     state: PullRequestFormState.CONFIGURE,
     data: {
       source: {
+        branches,
         parentOrg,
         repo,
         isFork: repo.forkedFromRepoId != null,

app/islands/RepositoryPullRequestCreateForm.tsx
@@ -24,6 +24,7 @@ export type RepositoryPullRequestCreateFormPropsByState<
 > = S extends PullRequestFormState.CONFIGURE
   ? {
       source: {
+        branches: string[];
         parentOrg: Organization;
         repo: Repository;
         isFork: boolean;

...
@@ -138,7 +139,74 @@ const RepositoryPullRequestCreateForm: ReactIsland<RepositoryPullRequestCreateFo
               name={"state_dest"}
               value={PullRequestFormState.COMPARE}
             />
-            <button type={"submit"}>Go to compare</button>
+            <input
+              type={"hidden"}
+              name={"source_parent_org_slug"}
+              value={data.source.parentOrg.slug}
+            />
+            <input
+              type={"hidden"}
+              name={"source_repository_slug"}
+              value={data.source.repo.slug}
+            />
+
+            <div>
+              <span>Source:</span>
+            </div>
+            <input
+              disabled
+              type={"text"}
+              name={"source_parent_org_display_name"}
+              value={
+                data.source.parentOrg.displayName || data.source.parentOrg.slug
+              }
+            />
+            {" / "}
+            <input
+              disabled
+              type={"text"}
+              name={"source_repository_display_name"}
+              value={data.source.repo.displayName || data.source.repo.slug}
+            />
+            {" / "}
+            <select name={"source_repository_from_branch"}>
+              {data.source.branches.map((branch, idx) => (
+                <option key={[branch, idx].join(":")} value={branch}>
+                  {branch}
+                </option>
+              ))}
+            </select>
+
+            {/* VS. */}
+            <div>
+              <span>Target:</span>
+            </div>
+
+            <input
+              disabled
+              type={"text"}
+              name={"target_parent_org_display_name"}
+              value={
+                data.source.parentOrg.displayName || data.source.parentOrg.slug
+              }
+            />
+            {" / "}
+            <input
+              disabled
+              type={"text"}
+              name={"target_repository_display_name"}
+              value={data.source.repo.displayName || data.source.repo.slug}
+            />
+            {" / "}
+            <select name={"target_repository_from_branch"}>
+              {data.source.branches.map((branch, idx) => (
+                <option key={[branch, idx].join(":")} value={branch}>
+                  {branch}
+                </option>
+              ))}
+            </select>
+
+            <button type={"submit"}>Go to COMPARE step</button>
           </form>
           <div>
             <pre>

...
@@ -163,7 +231,7 @@ const RepositoryPullRequestCreateForm: ReactIsland<RepositoryPullRequestCreateFo
               name={"state_dest"}
               value={PullRequestFormState.DETAILS}
             />
-            <button type={"submit"}>Go to add details</button>
+            <button type={"submit"}>Go to DETAILS step</button>
           </form>
           <div>
             <pre>

...
@@ -178,6 +246,13 @@ const RepositoryPullRequestCreateForm: ReactIsland<RepositoryPullRequestCreateFo
       return (
         <Grid.Col fluid nowrap>
           <h1>Add details about the Pull Request:</h1>
+          <form
+            method={"POST"}
+            // action={`/${data.source.parentOrg.slug}/${data.source.repo.slug}/pulls/new`}
+          >
+            <input type={"hidden"} name={"state_from"} value={state} />
+            <button type={"submit"}>Submit the Pull Request</button>
+          </form>
           <div>
             <pre>
               <code>{JSON.stringify(data, null, 2)}</code>

app/services/repository/getRepositoryBranches.ts
@@ -53,7 +53,8 @@ const makeGetRepositoryBranches: ServiceMethodFactory<
 
       return gitBranchResult
         .split("\n")
-        .map((branch) => branch.trim().replace(/^\* /i, ""));
+        .map((branch) => branch.trim().replace(/^\* /i, ""))
+        .filter((x) => x != null && x.trim() !== "");
     } catch (_) {
       return [];
     }