@kitlangton/ghui 0.1.20 → 0.1.22

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.
@@ -69,6 +69,7 @@ export const buildPullRequestListRows = ({
69
69
  loadedCount,
70
70
  hasMore,
71
71
  isLoadingMore,
72
+ loadingIndicator = "-",
72
73
  }: {
73
74
  readonly groups: PullRequestGroups
74
75
  readonly status: LoadStatus
@@ -78,6 +79,7 @@ export const buildPullRequestListRows = ({
78
79
  readonly loadedCount: number
79
80
  readonly hasMore: boolean
80
81
  readonly isLoadingMore: boolean
82
+ readonly loadingIndicator?: string
81
83
  }): readonly PullRequestListRow[] => {
82
84
  const itemCount = groups.reduce((count, [, pullRequests]) => count + pullRequests.length, 0)
83
85
  const rows: PullRequestListRow[] = [{ _tag: "title" }]
@@ -90,7 +92,7 @@ export const buildPullRequestListRows = ({
90
92
  for (const pullRequest of pullRequests) rows.push({ _tag: "pull-request", pullRequest, groupPullRequests: pullRequests })
91
93
  }
92
94
  if (status === "ready" && itemCount > 0 && (hasMore || isLoadingMore)) {
93
- rows.push({ _tag: "load-more", text: isLoadingMore ? `- Loading more pull requests... (${loadedCount} loaded)` : `- ${loadedCount} loaded, more available` })
95
+ rows.push({ _tag: "load-more", text: isLoadingMore ? `${loadingIndicator} Loading more pull requests... (${loadedCount} loaded)` : `- ${loadedCount} loaded, more available` })
94
96
  }
95
97
  return rows
96
98
  }
@@ -152,6 +154,7 @@ export const PullRequestList = ({
152
154
  loadedCount,
153
155
  hasMore,
154
156
  isLoadingMore,
157
+ loadingIndicator,
155
158
  onSelectPullRequest,
156
159
  }: {
157
160
  groups: PullRequestGroups
@@ -165,9 +168,10 @@ export const PullRequestList = ({
165
168
  loadedCount: number
166
169
  hasMore: boolean
167
170
  isLoadingMore: boolean
171
+ loadingIndicator: string
168
172
  onSelectPullRequest: (url: string) => void
169
173
  }) => {
170
- const rows = buildPullRequestListRows({ groups, status, error, filterText, showFilterBar, loadedCount, hasMore, isLoadingMore })
174
+ const rows = buildPullRequestListRows({ groups, status, error, filterText, showFilterBar, loadedCount, hasMore, isLoadingMore, loadingIndicator })
171
175
 
172
176
  return (
173
177
  <box width={contentWidth} flexDirection="column">
package/src/ui/diff.ts CHANGED
@@ -214,6 +214,12 @@ export const diffCommentLocationKey = (location: Pick<PullRequestReviewComment,
214
214
 
215
215
  export const diffCommentAnchorKey = diffCommentLocationKey
216
216
 
217
+ export const diffCommentSideLabel = (anchor: Pick<DiffCommentAnchor, "side">) => anchor.side === "RIGHT" ? "right" : "left"
218
+
219
+ export const diffCommentLineLabel = (anchor: Pick<DiffCommentAnchor, "side" | "line">) => `${anchor.side === "RIGHT" ? "+" : "-"}${anchor.line}`
220
+
221
+ export const diffCommentAnchorLabel = (anchor: Pick<DiffCommentAnchor, "side" | "line">) => `${diffCommentSideLabel(anchor)} ${diffCommentLineLabel(anchor)}`
222
+
217
223
  type PendingDiffCommentAnchor = Omit<DiffCommentAnchor, "renderLine">
218
224
 
219
225
  const diffContentWidth = (lines: readonly string[], view: DiffView, width: number) => {