@agimon-ai/po-git 0.0.0-alpha.36 → 0.0.0-alpha.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -78,6 +78,14 @@ function branchOptions(branches, query) {
78
78
  }));
79
79
  return [...local, ...remote].slice(0, MAX_LISTED);
80
80
  }
81
+ /** Every base a new branch can start from: the default first, then remote-tracking names, then local branches. */
82
+ function baseOptions(branches) {
83
+ return [.../* @__PURE__ */ new Set([
84
+ ...branches.defaultBase === void 0 ? [] : [branches.defaultBase],
85
+ ...branches.remote.map((branch) => `${branch.remote}/${branch.name}`),
86
+ ...branches.local.map((branch) => branch.name)
87
+ ])];
88
+ }
81
89
  /** Why the form cannot be submitted yet, or undefined when it can. */
82
90
  function formProblem(state) {
83
91
  if (state.mode === "existing") {
@@ -132,6 +140,7 @@ function GitNewSessionSheetView({ workspaceRoot, branches, loadError = "", initi
132
140
  ...initialForm
133
141
  });
134
142
  const [query, setQuery] = useState("");
143
+ const [basesOpen, setBasesOpen] = useState(false);
135
144
  const ready = branches?.repository === true && loadError === "";
136
145
  const loading = branches === null && loadError === "";
137
146
  const mode = ready || loading ? form.mode : "plain";
@@ -146,6 +155,7 @@ function GitNewSessionSheetView({ workspaceRoot, branches, loadError = "", initi
146
155
  ...patch
147
156
  }));
148
157
  const options = branches === null ? [] : branchOptions(branches, query);
158
+ const bases = branches === null ? [] : baseOptions(branches);
149
159
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SheetHeader, { children: /* @__PURE__ */ jsx(SheetTitle, { children: "New session" }) }), /* @__PURE__ */ jsxs(SheetBody, {
150
160
  style: styles$3.body,
151
161
  children: [
@@ -220,16 +230,29 @@ function GitNewSessionSheetView({ workspaceRoot, branches, loadError = "", initi
220
230
  })]
221
231
  }), /* @__PURE__ */ jsxs(View, {
222
232
  style: styles$3.field,
223
- children: [/* @__PURE__ */ jsx(Label, { children: "From" }), /* @__PURE__ */ jsx(Input, {
224
- testID: "git-new-session-base",
225
- accessibilityLabel: "From",
226
- placeholder: branches?.defaultBase ?? "Current branch",
227
- autoCapitalize: "none",
228
- autoCorrect: false,
229
- style: styles$3.mono,
230
- value: form.baseRef,
231
- onChangeText: (baseRef) => update({ baseRef }),
232
- disabled: busy
233
+ children: [/* @__PURE__ */ jsx(Label, { children: "From" }), /* @__PURE__ */ jsxs(View, {
234
+ style: styles$3.list,
235
+ children: [/* @__PURE__ */ jsx(ListRow, {
236
+ accessibilityLabel: "From",
237
+ title: /* @__PURE__ */ jsx(Text, {
238
+ style: styles$3.mono,
239
+ children: state.baseRef || "Current branch"
240
+ }),
241
+ disabled: busy,
242
+ onPress: () => setBasesOpen((open) => !open)
243
+ }), basesOpen ? bases.map((base) => /* @__PURE__ */ jsx(ListRow, {
244
+ title: /* @__PURE__ */ jsx(Text, {
245
+ style: styles$3.mono,
246
+ children: base
247
+ }),
248
+ selected: state.baseRef === base,
249
+ disabled: busy,
250
+ disclosure: false,
251
+ onPress: () => {
252
+ update({ baseRef: base });
253
+ setBasesOpen(false);
254
+ }
255
+ }, base)) : null]
233
256
  })]
234
257
  })] }) : /* @__PURE__ */ jsx(Text, {
235
258
  style: styles$3.dim,