opencode-github-pr 0.1.0 → 0.2.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-github-pr",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "GitHub pull request dashboard for the OpenCode sidebar: CI, review and merge status for your PRs.",
5
5
  "keywords": [
6
6
  "opencode",
@@ -21,12 +21,12 @@
21
21
  "type": "module",
22
22
  "exports": {
23
23
  ".": "./plugins/pr-dashboard.ts",
24
- "./tui": "./plugins/pr-dashboard.tui.tsx"
24
+ "./tui": "./dist/pr-dashboard.tui.js"
25
25
  },
26
26
  "files": [
27
27
  "plugins/",
28
+ "dist/",
28
29
  "demo/fixtures.ts",
29
- "demo/demo.gif",
30
30
  "README.md",
31
31
  "LICENSE"
32
32
  ],
@@ -36,23 +36,32 @@
36
36
  "test:integration": "make test-integration",
37
37
  "test:e2e": "make test-e2e",
38
38
  "test:watch": "make test-watch",
39
+ "build:tui": "bun build plugins/pr-dashboard.tui.tsx --outfile dist/pr-dashboard.tui.js --target bun --external @opencode/plugin/tui --external @opentui/core --external @opentui/solid --external @opencode/theme/tui --external solid-js",
40
+ "prepare": "bun run build:tui",
39
41
  "typecheck": "make typecheck",
40
42
  "format:check": "make format-check"
41
43
  },
42
44
  "devDependencies": {
43
- "@types/bun": "latest",
44
- "bun-types": "latest",
45
+ "@opencode/plugin": "2.0.20",
46
+ "@opencode/theme": "2.0.20",
47
+ "@opentui/core": "0.6.6",
48
+ "@opentui/solid": "0.6.6",
49
+ "@types/bun": "1.3.14",
50
+ "bun-types": "1.3.14",
51
+ "solid-js": "^1.9.14",
45
52
  "typescript": "^5.9.3"
46
53
  },
47
54
  "dependencies": {
48
55
  "@octokit/plugin-retry": "^8.1.0",
49
56
  "@octokit/plugin-throttling": "^11.0.3",
50
57
  "@octokit/rest": "^22.0.1",
51
- "@opencode/plugin": "2.0.20",
52
- "@opencode/theme": "2.0.20",
53
- "@opentui/core": "0.6.6",
54
- "@opentui/solid": "0.6.6",
55
- "open": "^11.0.4",
56
- "solid-js": "^1.9.14"
58
+ "open": "^11.0.4"
59
+ },
60
+ "peerDependencies": {
61
+ "@opencode/plugin": "^2.0.20",
62
+ "@opencode/theme": "^2.0.20",
63
+ "@opentui/core": "^0.6.6",
64
+ "@opentui/solid": "^0.6.6",
65
+ "solid-js": "^1.9.12"
57
66
  }
58
67
  }
@@ -1,5 +1,5 @@
1
1
  /** @jsxImportSource @opentui/solid */
2
- import { createSignal, For, onCleanup, onMount, Show } from "solid-js"
2
+ import { createEffect, createMemo, createSignal, For, onCleanup, onMount, Show } from "solid-js"
3
3
  import type { ResolvedTheme } from "@opencode/theme/tui"
4
4
  import type { BoxRenderable } from "@opentui/core"
5
5
  import { useRenderer } from "@opentui/solid"
@@ -15,10 +15,8 @@ import { filterPRs } from "../domain/pr-filters"
15
15
  import { skin, type Skin } from "./theme"
16
16
  import { errorMessages } from "../domain/messages"
17
17
  import { PRRow } from "./PRRow"
18
- import type { DashboardIcons } from "./config"
19
-
20
- // GitHub returns up to 100 PRs per GraphQL page (see PULL_REQUESTS_QUERY).
21
- const PRS_PER_PAGE = 100
18
+ import type { DashboardIcons, DashboardSpacing } from "./config"
19
+ import { StatusMessage } from "./StatusMessage"
22
20
 
23
21
  export function DashboardView(props: {
24
22
  theme: ResolvedTheme
@@ -29,12 +27,14 @@ export function DashboardView(props: {
29
27
  statusFilter: PRStatusFilter
30
28
  onCycleScope: () => void
31
29
  onCycleStatus: () => void
30
+ onLoadMore: () => Promise<void>
32
31
  pageSize: number
33
- maxPRPages: number
34
32
  colors: Partial<Skin>
35
33
  icons: DashboardIcons
34
+ spacing: DashboardSpacing
35
+ showSingleStatusCount: boolean
36
36
  }) {
37
- const sk = skin(props.theme, props.colors)
37
+ const sk = createMemo(() => skin(props.theme, props.colors))
38
38
  const [scopeHovered, setScopeHovered] = createSignal(false)
39
39
  const [statusHovered, setStatusHovered] = createSignal(false)
40
40
  const [page, setPage] = createSignal(0)
@@ -43,16 +43,33 @@ export function DashboardView(props: {
43
43
  let view: BoxRenderable | undefined
44
44
  const [titleWidth, setTitleWidth] = createSignal(48)
45
45
  const renderer = useRenderer()
46
+ createEffect(() => {
47
+ props.statusFilter
48
+ props.scope
49
+ setPage(0)
50
+ })
46
51
  onMount(() => {
52
+ const iconWidth = Math.max(
53
+ Bun.stringWidth(props.icons.openPR),
54
+ Bun.stringWidth(props.icons.closedPR),
55
+ Bun.stringWidth(props.icons.draftPR),
56
+ Bun.stringWidth(props.icons.mergedPR),
57
+ )
47
58
  const updateTitleWidth = () => {
48
- if (!view) return
49
- const nextWidth = Math.max(1, Math.floor(view.width) - 2)
59
+ const measuredWidth = view?.width
60
+ const availableWidth = measuredWidth && measuredWidth > 0 ? measuredWidth : renderer.width
61
+ if (availableWidth <= 0) return
62
+ const nextWidth = Math.max(1, Math.floor(availableWidth) - iconWidth - 1)
50
63
  setTitleWidth((current) => current === nextWidth ? current : nextWidth)
51
64
  }
52
- renderer.on("frame", updateTitleWidth)
65
+ updateTitleWidth()
66
+ const needsPostLayoutMeasurement = !view || view.width <= 0
67
+ if (needsPostLayoutMeasurement) renderer.once("frame", updateTitleWidth)
68
+ view?.on("resize", updateTitleWidth)
53
69
  renderer.on("resize", updateTitleWidth)
54
70
  onCleanup(() => {
55
71
  renderer.off("frame", updateTitleWidth)
72
+ view?.off("resize", updateTitleWidth)
56
73
  renderer.off("resize", updateTitleWidth)
57
74
  })
58
75
  })
@@ -65,23 +82,50 @@ export function DashboardView(props: {
65
82
  props.state.viewerLogin,
66
83
  )
67
84
  const pageCount = () => Math.max(1, Math.ceil(prs().length / props.pageSize))
85
+ const totalPageCount = () => {
86
+ const totalCount = props.state.pagination.totalCount
87
+ return totalCount === null ? null : Math.max(1, Math.ceil(totalCount / props.pageSize))
88
+ }
68
89
  const currentPage = () => Math.min(page(), pageCount() - 1)
69
90
  const pagePRs = () =>
70
91
  prs().slice(currentPage() * props.pageSize, (currentPage() + 1) * props.pageSize)
92
+ const filtersMatch = () =>
93
+ props.state.pagination.listing === props.statusFilter &&
94
+ props.state.pagination.scope === props.scope &&
95
+ props.state.pagination.scopeValue === (props.scope === "branch" ? props.state.currentBranch : null)
71
96
  const canGoPrevious = () => currentPage() > 0
72
- const canGoNext = () => currentPage() < pageCount() - 1
97
+ const canGoNext = () =>
98
+ currentPage() < pageCount() - 1 ||
99
+ (filtersMatch() &&
100
+ props.state.pagination.hasMore &&
101
+ !props.state.pagination.loading)
73
102
  const listIsAvailable = () =>
74
103
  props.state.status === DashboardStatus.Ok ||
75
104
  (props.state.status === DashboardStatus.Error && props.state.prs.length > 0)
76
- // Closed PRs load the first time a status filter shows them.
77
- const closedPending = () =>
78
- props.statusFilter !== "open" && !props.state.closedLoaded && props.state.status === DashboardStatus.Ok
79
- const truncationNotice = () => {
80
- const open = props.statusFilter !== "closed" && props.state.truncated.open
81
- const closed = props.statusFilter !== "open" && props.state.truncated.closed
82
- if (!open && !closed) return null
83
- const which = open && closed ? "open and closed" : open ? "open" : "closed"
84
- return `Showing ${props.maxPRPages * PRS_PER_PAGE} newest ${which} PRs`
105
+ const listingPending = () => !filtersMatch()
106
+ const scopeListingPending = () =>
107
+ props.state.pagination.scope !== props.scope ||
108
+ props.state.pagination.scopeValue !== (props.scope === "branch" ? props.state.currentBranch : null)
109
+
110
+ const goNext = async () => {
111
+ if (currentPage() < pageCount() - 1) {
112
+ const next = currentPage() + 1
113
+ setPage(next)
114
+ if (
115
+ filtersMatch() &&
116
+ props.state.pagination.hasMore
117
+ ) void props.onLoadMore()
118
+ return
119
+ }
120
+ if (
121
+ !filtersMatch() ||
122
+ !props.state.pagination.hasMore ||
123
+ props.state.pagination.loading
124
+ ) return
125
+
126
+ const previousPage = currentPage()
127
+ await props.onLoadMore()
128
+ if (pageCount() > previousPage + 1) setPage(previousPage + 1)
85
129
  }
86
130
 
87
131
  const errorPresentation = (): { title: string; description: string } => {
@@ -91,7 +135,7 @@ export function DashboardView(props: {
91
135
  case "authentication":
92
136
  return {
93
137
  title: "GitHub sign-in failed",
94
- description: "Set GITHUB_TOKEN or GH_TOKEN.",
138
+ description: "Run gh auth login or set GITHUB_TOKEN or GH_TOKEN.",
95
139
  }
96
140
  case "forbidden":
97
141
  return {
@@ -141,11 +185,9 @@ export function DashboardView(props: {
141
185
  <box
142
186
  ref={(element) => { view = element }}
143
187
  flexDirection="column"
144
- paddingTop={1}
145
188
  paddingBottom={1}
146
189
  gap={0}
147
190
  width="100%"
148
- backgroundColor={sk.panel}
149
191
  >
150
192
  <box
151
193
  flexDirection="row"
@@ -153,81 +195,93 @@ export function DashboardView(props: {
153
195
  paddingLeft={0}
154
196
  paddingRight={0}
155
197
  >
156
- <text fg={sk.text}>
198
+ <text fg={sk().text}>
157
199
  <b>Pull Requests</b>
158
200
  </text>
159
201
  <box flexGrow={1}></box>
160
- <box flexDirection="row" gap={2}>
161
- <text
162
- fg={scopeHovered() ? sk.accent : sk.muted}
163
- selectable={false}
202
+ <box flexDirection="row" gap={1}>
203
+ <box
204
+ flexDirection="row"
205
+ gap={1}
164
206
  onMouseOver={() => setScopeHovered(true)}
165
207
  onMouseOut={() => setScopeHovered(false)}
166
208
  onMouseUp={() => props.onCycleScope()}
167
209
  >
168
- {`${props.icons.scope} ${props.scope}`}
169
- </text>
210
+ <Show when={props.icons.scope}>
211
+ <text fg={sk().muted} selectable={false}>{props.icons.scope}</text>
212
+ </Show>
213
+ <text fg={scopeHovered() ? sk().accent : sk().muted} selectable={false}>
214
+ {props.scope}
215
+ </text>
216
+ </box>
170
217
  <text
171
- fg={statusHovered() ? sk.accent : sk.muted}
218
+ fg={statusHovered() ? sk().accent : sk().muted}
172
219
  selectable={false}
173
220
  onMouseOver={() => setStatusHovered(true)}
174
221
  onMouseOut={() => setStatusHovered(false)}
175
222
  onMouseUp={() => props.onCycleStatus()}
176
223
  >
177
- {`${props.icons.status} ${props.statusFilter}`}
224
+ {props.statusFilter}
178
225
  </text>
179
226
  </box>
180
227
  </box>
181
228
 
182
229
  <Show when={props.state.status === DashboardStatus.Loading}>
183
- <box flexDirection="column" paddingLeft={1} paddingTop={1} paddingRight={1}>
184
- <text fg={sk.muted} selectable={false}>{props.icons.loading} Loading PRs</text>
185
- <text fg={sk.muted} selectable={false}> Checking GitHub…</text>
186
- </box>
230
+ <StatusMessage
231
+ icon={props.icons.loading}
232
+ title="Loading PRs"
233
+ titleColor={sk().muted}
234
+ descriptionColor={sk().muted}
235
+ />
187
236
  </Show>
188
237
 
189
- <Show when={closedPending()}>
190
- <box flexDirection="column" paddingLeft={1} paddingTop={1} paddingRight={1}>
191
- <text fg={sk.muted} selectable={false}>{props.icons.loading} Loading closed PRs</text>
192
- </box>
193
- </Show>
194
-
195
- <Show when={truncationNotice()}>
196
- <box flexDirection="column" paddingLeft={1}>
197
- <text fg={sk.warning} selectable={false}>{truncationNotice()}</text>
198
- <text fg={sk.muted} selectable={false}> More exist; raise maxPRPages to load them.</text>
199
- </box>
238
+ <Show when={listingPending() && props.state.status !== DashboardStatus.Loading}>
239
+ <StatusMessage
240
+ icon={props.icons.loading}
241
+ title={scopeListingPending() ? `Loading ${props.scope} PRs` : "Loading PRs"}
242
+ titleColor={sk().muted}
243
+ descriptionColor={sk().muted}
244
+ />
200
245
  </Show>
201
246
 
202
247
  <Show when={props.state.status === DashboardStatus.NoRepo}>
203
- <box flexDirection="column" paddingLeft={1} paddingTop={1} paddingRight={1}>
204
- <text fg={sk.muted} selectable={false}>{props.icons.info} No GitHub repo</text>
205
- <text fg={sk.muted} selectable={false}> Add a GitHub remote or switch to the right project.</text>
206
- </box>
248
+ <StatusMessage
249
+ icon={props.icons.info}
250
+ title="No GitHub repo"
251
+ description="Add a GitHub remote or switch to the right project."
252
+ titleColor={sk().muted}
253
+ descriptionColor={sk().muted}
254
+ />
207
255
  </Show>
208
256
 
209
257
  <Show when={props.state.status === DashboardStatus.Error}>
210
- <box flexDirection="column" paddingLeft={1} paddingTop={1} paddingRight={1}>
211
- <text fg={sk.error} selectable={false}>{props.icons.error} {errorPresentation().title}</text>
212
- <text fg={sk.muted} selectable={false}> {errorPresentation().description}</text>
213
- </box>
258
+ <StatusMessage
259
+ icon={props.icons.error}
260
+ title={errorPresentation().title}
261
+ description={errorPresentation().description}
262
+ titleColor={sk().error}
263
+ descriptionColor={sk().muted}
264
+ />
214
265
  </Show>
215
266
 
216
267
  <Show
217
268
  when={
218
269
  listIsAvailable() &&
219
- !closedPending() &&
270
+ !listingPending() &&
271
+ filtersMatch() &&
220
272
  prs().length === 0 &&
221
273
  (props.state.status === DashboardStatus.Ok || props.state.prs.length > 0)
222
274
  }
223
275
  >
224
- <box flexDirection="column" paddingLeft={1} paddingTop={1} paddingRight={1}>
225
- <text fg={sk.muted} selectable={false}>{props.icons.info} {errorMessages.noMatchingPRs}</text>
226
- <text fg={sk.muted} selectable={false}> Try a different scope or status.</text>
227
- </box>
276
+ <StatusMessage
277
+ icon={props.icons.info}
278
+ title={errorMessages.noMatchingPRs}
279
+ titleColor={sk().muted}
280
+ descriptionColor={sk().muted}
281
+ />
228
282
  </Show>
229
283
 
230
- <Show when={listIsAvailable() && prs().length > 0}>
284
+ <Show when={listIsAvailable() && filtersMatch() && prs().length > 0}>
231
285
  <box flexDirection="column" gap={0} width="100%">
232
286
  <box flexDirection="column" gap={1} paddingTop={1} width="100%">
233
287
  <For each={pagePRs()}>
@@ -235,54 +289,83 @@ export function DashboardView(props: {
235
289
  <PRRow
236
290
  pr={pr}
237
291
  titleWidth={titleWidth()}
238
- secondaryBackground={sk.panelAlt}
292
+ secondaryBackground={sk().panelAlt}
239
293
  onClick={(target) => {
240
294
  props.setSelectedIdx(currentPage() * props.pageSize + i())
241
295
  props.onOpen(pr.number, target)
242
296
  }}
243
- text={sk.text}
244
- muted={sk.muted}
245
- pass={sk.success}
246
- fail={sk.error}
247
- warn={sk.warning}
248
- draft={sk.draft}
249
- merged={sk.merged}
297
+ text={sk().text}
298
+ muted={sk().muted}
299
+ pass={sk().success}
300
+ fail={sk().error}
301
+ warn={sk().warning}
302
+ draft={sk().draft}
303
+ merged={sk().merged}
250
304
  icons={props.icons}
305
+ spacing={props.spacing}
306
+ showSingleStatusCount={props.showSingleStatusCount}
251
307
  />
252
308
  )}
253
309
  </For>
254
310
  </box>
255
- <Show when={pageCount() > 1}>
311
+ <Show when={pageCount() > 1 || (filtersMatch() && props.state.pagination.hasMore)}>
256
312
  <box
257
313
  flexDirection="row"
258
314
  justifyContent="flex-end"
259
315
  gap={1}
260
316
  paddingTop={1}
317
+ paddingRight={1}
261
318
  width="100%"
262
- border={["top"]}
263
- borderColor={previousHovered() || nextHovered() ? sk.borderActive : sk.border}
264
319
  >
265
- <text
266
- fg={canGoPrevious() && previousHovered() ? sk.accent : sk.muted}
267
- selectable={false}
320
+ <box
321
+ width={Bun.stringWidth(props.icons.previousPage) + 2}
322
+ marginLeft={-1}
323
+ marginRight={-1}
324
+ flexDirection="row"
325
+ justifyContent="center"
326
+ alignItems="center"
268
327
  onMouseOver={() => canGoPrevious() && setPreviousHovered(true)}
269
328
  onMouseOut={() => setPreviousHovered(false)}
270
329
  onMouseUp={() => canGoPrevious() && setPage(currentPage() - 1)}
271
330
  >
272
- {props.icons.previousPage}
331
+ <text
332
+ fg={canGoPrevious() && previousHovered() ? sk().accent : sk().muted}
333
+ selectable={false}
334
+ >
335
+ {props.icons.previousPage}
336
+ </text>
337
+ </box>
338
+ <text fg={sk().muted} selectable={false}>
339
+ {`${currentPage() + 1} of ${totalPageCount() ?? pageCount()}${totalPageCount() === null && filtersMatch() && props.state.pagination.hasMore ? "+" : ""}`}
273
340
  </text>
274
- <text fg={sk.muted} selectable={false}>{`${currentPage() + 1} of ${pageCount()}`}</text>
275
- <text
276
- fg={canGoNext() && nextHovered() ? sk.accent : sk.muted}
277
- selectable={false}
341
+ <box
342
+ width={Bun.stringWidth(props.icons.nextPage) + 2}
343
+ marginLeft={-1}
344
+ marginRight={-1}
345
+ flexDirection="row"
346
+ justifyContent="center"
347
+ alignItems="center"
278
348
  onMouseOver={() => canGoNext() && setNextHovered(true)}
279
349
  onMouseOut={() => setNextHovered(false)}
280
- onMouseUp={() => canGoNext() && setPage(currentPage() + 1)}
350
+ onMouseUp={() => canGoNext() && void goNext()}
281
351
  >
282
- {props.icons.nextPage}
283
- </text>
352
+ <text
353
+ fg={canGoNext() && nextHovered() ? sk().accent : sk().muted}
354
+ selectable={false}
355
+ >
356
+ {props.icons.nextPage}
357
+ </text>
358
+ </box>
284
359
  </box>
285
360
  </Show>
361
+ <Show when={filtersMatch() && props.state.pagination.limitReached}>
362
+ <StatusMessage
363
+ icon={props.icons.info}
364
+ title="GitHub search is limited to 1,000 matching PRs"
365
+ titleColor={sk().muted}
366
+ descriptionColor={sk().muted}
367
+ />
368
+ </Show>
286
369
  </box>
287
370
  </Show>
288
371
  </box>
@@ -5,9 +5,11 @@ import { truncateTitle } from "../domain/format"
5
5
  import {
6
6
  checkStatusGroups,
7
7
  commentThreadCounts,
8
+ mergeReadiness,
8
9
  reviewStatusGroups,
9
10
  type StatusCategory,
10
11
  } from "../domain/pr-status"
12
+ import type { DashboardSpacing } from "./config"
11
13
 
12
14
  function statusColor(status: StatusCategory, props: {
13
15
  pass: string
@@ -53,17 +55,19 @@ function ClickableText(props: {
53
55
  )
54
56
  }
55
57
 
56
- function ClickableComment(props: {
58
+ function ClickableIndicator(props: {
57
59
  icon: string
58
- count: number
60
+ count?: number | string
61
+ gap: number
59
62
  color: string
63
+ target: PRLinkTarget
60
64
  onClick: (target: PRLinkTarget) => void
61
65
  }) {
62
66
  const [hovered, setHovered] = createSignal(false)
63
67
  return (
64
68
  <box
65
69
  flexDirection="row"
66
- gap={1}
70
+ gap={props.count === undefined ? 0 : props.gap}
67
71
  onMouseOver={(event) => {
68
72
  event.stopPropagation()
69
73
  setHovered(true)
@@ -74,15 +78,17 @@ function ClickableComment(props: {
74
78
  }}
75
79
  onMouseUp={(event) => {
76
80
  event.stopPropagation()
77
- props.onClick("files")
81
+ props.onClick(props.target)
78
82
  }}
79
83
  >
80
84
  <text fg={props.color} selectable={false}>
81
85
  {hovered() ? <u>{props.icon}</u> : props.icon}
82
86
  </text>
83
- <text fg={props.color} selectable={false}>
84
- {hovered() ? <u>{props.count}</u> : props.count}
85
- </text>
87
+ <Show when={props.count !== undefined}>
88
+ <text fg={props.color} selectable={false}>
89
+ {hovered() ? <u>{props.count}</u> : props.count}
90
+ </text>
91
+ </Show>
86
92
  </box>
87
93
  )
88
94
  }
@@ -101,30 +107,38 @@ export function PRRow(props: {
101
107
  merged: string
102
108
  icons: {
103
109
  openPR: string
110
+ closedPR: string
111
+ draftPR: string
104
112
  mergedPR: string
105
113
  review: string
106
114
  openComment: string
107
115
  check: string
108
116
  }
117
+ spacing: DashboardSpacing
118
+ showSingleStatusCount: boolean
109
119
  }) {
110
120
  const [titleHovered, setTitleHovered] = createSignal(false)
111
121
  const title = () => truncateTitle(props.pr.title, props.titleWidth)
112
- const icon = props.pr.isMerged ? props.icons.mergedPR : props.icons.openPR
113
- const iconColor = props.pr.isMerged
122
+ const icon = () => props.pr.isMerged
123
+ ? props.icons.mergedPR
124
+ : props.pr.isDraft
125
+ ? props.icons.draftPR
126
+ : props.pr.isClosed
127
+ ? props.icons.closedPR
128
+ : props.icons.openPR
129
+ const iconColor = () => props.pr.isMerged
114
130
  ? props.merged
115
131
  : props.pr.isDraft
116
132
  ? props.draft
117
- : props.pr.mergeable === "MERGEABLE"
118
- ? props.pass
119
- : props.pr.mergeable === "CONFLICTING"
120
- ? props.fail
121
- : props.muted
122
- const checks = checkStatusGroups(props.pr)
123
- const reviews = reviewStatusGroups(props.pr)
124
- const comments = commentThreadCounts(props.pr)
125
- const commentStatuses = comments?.open
126
- ? [{ icon: props.icons.openComment, count: comments.open }]
127
- : []
133
+ : statusColor(mergeReadiness(props.pr), props)
134
+ const checks = () => checkStatusGroups(props.pr)
135
+ const reviews = () => reviewStatusGroups(props.pr)
136
+ const comments = () => commentThreadCounts(props.pr)
137
+ const commentStatuses = () => {
138
+ const open = comments()?.open
139
+ const truncated = comments()?.truncated
140
+ return open ? [{ icon: props.icons.openComment, count: `${open}${truncated ? "+" : ""}` }] : []
141
+ }
128
142
 
129
143
  return (
130
144
  <box
@@ -142,8 +156,8 @@ export function PRRow(props: {
142
156
  onMouseUp={() => props.onClick("overview")}
143
157
  >
144
158
  <ClickableText
145
- label={icon}
146
- color={iconColor}
159
+ label={icon()}
160
+ color={iconColor()}
147
161
  target="mergeStatus"
148
162
  onClick={props.onClick}
149
163
  />
@@ -171,38 +185,56 @@ export function PRRow(props: {
171
185
  onClick={props.onClick}
172
186
  />
173
187
  <box flexGrow={1}></box>
174
- <Show when={commentStatuses.length > 0}>
175
- <For each={commentStatuses}>
176
- {(comment) => (
177
- <ClickableComment
178
- icon={comment.icon}
179
- count={comment.count}
180
- color={props.muted}
181
- onClick={props.onClick}
182
- />
183
- )}
184
- </For>
185
- </Show>
186
- <For each={reviews}>
187
- {(group) => (
188
- <ClickableText
189
- label={`${props.icons.review}${reviews.length > 1 ? group.count : ""}`}
190
- color={statusColor(group.status, props)}
191
- target="overview"
192
- onClick={props.onClick}
193
- />
194
- )}
195
- </For>
196
- <For each={checks}>
197
- {(group) => (
198
- <ClickableText
199
- label={`${props.icons.check}${checks.length > 1 ? group.count : ""}`}
200
- color={statusColor(group.status, props)}
201
- target="checks"
202
- onClick={props.onClick}
203
- />
204
- )}
205
- </For>
188
+ <box flexDirection="row" gap={props.spacing.differentTypeGroups}>
189
+ <Show when={commentStatuses().length > 0}>
190
+ <For each={commentStatuses()}>
191
+ {(comment) => (
192
+ <ClickableIndicator
193
+ icon={comment.icon}
194
+ count={comment.count}
195
+ gap={props.spacing.iconToCount}
196
+ color={props.muted}
197
+ target="files"
198
+ onClick={props.onClick}
199
+ />
200
+ )}
201
+ </For>
202
+ </Show>
203
+ <Show when={reviews().length > 0}>
204
+ <box flexDirection="row" gap={props.spacing.sameTypeGroups}>
205
+ <For each={reviews()}>
206
+ {(group) => (
207
+ <ClickableIndicator
208
+ icon={props.icons.review}
209
+ count={reviews().length > 1 || (props.showSingleStatusCount && group.count > 0)
210
+ ? group.count
211
+ : undefined}
212
+ gap={props.spacing.iconToCount}
213
+ color={statusColor(group.status, props)}
214
+ target="overview"
215
+ onClick={props.onClick}
216
+ />
217
+ )}
218
+ </For>
219
+ </box>
220
+ </Show>
221
+ <box flexDirection="row" gap={props.spacing.sameTypeGroups}>
222
+ <For each={checks()}>
223
+ {(group) => (
224
+ <ClickableIndicator
225
+ icon={props.icons.check}
226
+ count={checks().length > 1 || (props.showSingleStatusCount && group.count > 0)
227
+ ? group.count
228
+ : undefined}
229
+ gap={props.spacing.iconToCount}
230
+ color={statusColor(group.status, props)}
231
+ target="checks"
232
+ onClick={props.onClick}
233
+ />
234
+ )}
235
+ </For>
236
+ </box>
237
+ </box>
206
238
  </box>
207
239
  </box>
208
240
  )