patchrelay 0.49.3 → 0.50.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/dist/build-info.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
3
|
import { issueTokenFor, prTokenFor } from "./issue-token.js";
|
|
4
|
-
import { truncate } from "./format-utils.js";
|
|
4
|
+
import { formatIssueAge, truncate } from "./format-utils.js";
|
|
5
5
|
const KEY_WIDTH = 8;
|
|
6
6
|
const GLYPH_WIDTH = 3;
|
|
7
7
|
const PHRASE_WIDTH = 18;
|
|
8
|
+
const AGE_WIDTH = 4;
|
|
9
|
+
const WIDE_PR_PHRASE_THRESHOLD = 34;
|
|
10
|
+
function shouldShowVerbosePrToken(titleWidth, compact) {
|
|
11
|
+
return !compact && (titleWidth ?? 60) >= WIDE_PR_PHRASE_THRESHOLD;
|
|
12
|
+
}
|
|
8
13
|
export function IssueRow({ issue, selected, titleWidth, compact = false, }) {
|
|
9
14
|
const key = issue.issueKey ?? issue.projectId;
|
|
10
15
|
const token = issueTokenFor(issue);
|
|
@@ -12,11 +17,18 @@ export function IssueRow({ issue, selected, titleWidth, compact = false, }) {
|
|
|
12
17
|
const cursorChar = selected ? "\u25b8" : " ";
|
|
13
18
|
const paddedKey = key.padEnd(KEY_WIDTH, " ");
|
|
14
19
|
const paddedPhrase = token.phrase.padEnd(PHRASE_WIDTH, " ");
|
|
15
|
-
const
|
|
20
|
+
const age = formatIssueAge(issue.updatedAt);
|
|
21
|
+
const verbosePr = pr && shouldShowVerbosePrToken(titleWidth, compact);
|
|
22
|
+
const prWidth = pr
|
|
23
|
+
? verbosePr
|
|
24
|
+
? `#${pr.prNumber} ${pr.glyph} ${pr.phrase}`.length
|
|
25
|
+
: `#${pr.prNumber} ${pr.glyph}`.length
|
|
26
|
+
: 0;
|
|
27
|
+
const availableTitleWidth = Math.max(0, (titleWidth ?? 60) - prWidth - (pr ? 2 : 0) - (AGE_WIDTH + 2));
|
|
16
28
|
const title = !compact && selected && issue.title
|
|
17
29
|
? ` ${truncate(issue.title, Math.max(0, availableTitleWidth))}`
|
|
18
30
|
: "";
|
|
19
|
-
return (_jsxs(Box, { children: [_jsx(Text, { color: selected ? "cyan" : "gray", children: cursorChar }), _jsx(Text, { bold: selected, color: token.color, children: ` ${paddedKey}` }), _jsx(Text, { color: token.color, children: ` ${token.glyph.padEnd(GLYPH_WIDTH - 1, " ")}` }), _jsx(Text, { children: ` ${paddedPhrase}` }), pr ? (_jsx(_Fragment, { children: _jsx(Text, { color: pr.color, children: `#${pr.prNumber} ${pr.glyph}` }) })) : null, title ? _jsx(Text, { dimColor: true, children: title }) : null] }));
|
|
31
|
+
return (_jsxs(Box, { children: [_jsx(Text, { color: selected ? "cyan" : "gray", children: cursorChar }), _jsx(Text, { bold: selected, color: token.color, children: ` ${paddedKey}` }), _jsx(Text, { color: token.color, children: ` ${token.glyph.padEnd(GLYPH_WIDTH - 1, " ")}` }), _jsx(Text, { children: ` ${paddedPhrase}` }), pr ? (_jsx(_Fragment, { children: _jsx(Text, { color: pr.color, children: verbosePr ? `#${pr.prNumber} ${pr.glyph} ${pr.phrase}` : `#${pr.prNumber} ${pr.glyph}` }) })) : null, _jsx(Text, { dimColor: true, children: ` ${age}` }), title ? _jsx(Text, { dimColor: true, children: title }) : null] }));
|
|
20
32
|
}
|
|
21
33
|
export function estimateIssueRowHeight(_issue, _selected, _cols, _titleWidth, _compact = false) {
|
|
22
34
|
return 1;
|
|
@@ -19,6 +19,9 @@ export function relativeTime(iso) {
|
|
|
19
19
|
const days = Math.floor(hours / 24);
|
|
20
20
|
return `${days}d`;
|
|
21
21
|
}
|
|
22
|
+
export function formatIssueAge(updatedAt) {
|
|
23
|
+
return relativeTime(updatedAt).padStart(4, " ");
|
|
24
|
+
}
|
|
22
25
|
/** Format millisecond duration as "2m 30s" or "45s". */
|
|
23
26
|
export function formatDuration(ms) {
|
|
24
27
|
const seconds = Math.floor(ms / 1000);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isUndelegatedPausedIssue } from "../../paused-issue-state.js";
|
|
2
|
+
import { hasFailedPrChecks, hasPendingPrChecks, isApprovedReviewState, isAwaitingReviewState, isChangesRequestedReviewState, prChecksFact, } from "./pr-status.js";
|
|
2
3
|
const GLYPH = {
|
|
3
4
|
running: "\u25cf",
|
|
4
5
|
queued: "\u25cb",
|
|
@@ -84,6 +85,7 @@ export function prTokenFor(issue) {
|
|
|
84
85
|
glyph: GLYPH[kind],
|
|
85
86
|
color: COLOR[kind],
|
|
86
87
|
kind,
|
|
88
|
+
phrase: prPhraseFor(issue),
|
|
87
89
|
};
|
|
88
90
|
}
|
|
89
91
|
function prKind(issue) {
|
|
@@ -101,3 +103,20 @@ function prKind(issue) {
|
|
|
101
103
|
return "approved";
|
|
102
104
|
return "running";
|
|
103
105
|
}
|
|
106
|
+
function prPhraseFor(issue) {
|
|
107
|
+
if (issue.prState === "merged")
|
|
108
|
+
return "merged";
|
|
109
|
+
if (issue.prState === "closed")
|
|
110
|
+
return "closed";
|
|
111
|
+
if (isChangesRequestedReviewState(issue.prReviewState))
|
|
112
|
+
return "changes req";
|
|
113
|
+
if (isApprovedReviewState(issue.prReviewState))
|
|
114
|
+
return "approved";
|
|
115
|
+
if (isAwaitingReviewState(issue.prReviewState))
|
|
116
|
+
return "awaiting review";
|
|
117
|
+
if (hasFailedPrChecks(issue))
|
|
118
|
+
return prChecksFact(issue)?.text ?? "checks failed";
|
|
119
|
+
if (hasPendingPrChecks(issue))
|
|
120
|
+
return prChecksFact(issue)?.text ?? "checks running";
|
|
121
|
+
return prChecksFact(issue)?.text ?? "open";
|
|
122
|
+
}
|