@parallelworks/tandem-web 0.190.0 → 0.190.2
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/_virtual/_virtual_i18n/en/common.js +20 -7
- package/_virtual/_virtual_i18n/es/common.js +20 -7
- package/_virtual/_virtual_i18n/ja/common.js +20 -7
- package/_virtual/_virtual_i18n/ko/common.js +20 -7
- package/_virtual/_virtual_i18n/zh/common.js +20 -7
- package/components/IssueView.js +477 -469
- package/components/TriageBanner.js +16 -145
- package/components/TriageDecisions.js +347 -0
- package/lib/issuePicker.js +14 -11
- package/package.json +1 -1
- package/pages/triage.js +133 -109
|
@@ -1,152 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useShortcuts as o } from "../lib/shortcuts.js";
|
|
6
|
-
import { TriageIcon as s } from "./icons.js";
|
|
7
|
-
import { Button as c, Checkbox as l, Combobox as u, Select as d, Textarea as f } from "@parallelworks/ui";
|
|
8
|
-
import { useId as p, useState as m } from "react";
|
|
9
|
-
import { useErrorMessage as h } from "@parallelworks/problem/react";
|
|
10
|
-
import { useTranslations as g } from "use-intl";
|
|
11
|
-
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
12
|
-
import { useMutation as y, useQuery as b, useQueryClient as x } from "@tanstack/react-query";
|
|
13
|
-
import { CheckIcon as S, CloseIcon as C, DuplicateIcon as w } from "@parallelworks/ui/icons";
|
|
1
|
+
import { TriageIcon as e } from "./icons.js";
|
|
2
|
+
import { TriageDecisions as t } from "./TriageDecisions.js";
|
|
3
|
+
import { useTranslations as n } from "use-intl";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
14
5
|
// src/components/TriageBanner.tsx
|
|
15
|
-
function
|
|
16
|
-
let
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
className: "mb-5 flex flex-
|
|
19
|
-
children: [/* @__PURE__ */ v("p", {
|
|
20
|
-
className: "flex items-center gap-2 text-sm",
|
|
21
|
-
children: [/* @__PURE__ */ _(s, { className: "size-4 shrink-0 text-muted-foreground" }), r("waiting")]
|
|
22
|
-
}), /* @__PURE__ */ _(D, {
|
|
23
|
-
workspace: e,
|
|
24
|
-
issue: t,
|
|
25
|
-
shortcuts: n
|
|
26
|
-
})]
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
function E(e) {
|
|
30
|
-
let t = e.filter((e) => e.category !== "triage" && e.category !== "completed" && e.category !== "canceled");
|
|
31
|
-
return t.find((e) => e.category === "unstarted") ?? t[0];
|
|
32
|
-
}
|
|
33
|
-
function D({ workspace: s, issue: T, shortcuts: D = !1 }) {
|
|
34
|
-
let O = g("triage"), k = h(), A = x(), j = a(s, T.teamId), { data: M = [] } = b(r(s)), N = M.find((e) => e.id === T.teamId)?.key ?? "", { data: P = [] } = b({
|
|
35
|
-
...n(s, N),
|
|
36
|
-
enabled: !!N
|
|
37
|
-
}), F = y({
|
|
38
|
-
mutationFn: async (n) => t(await e.POST("/api/v1/workspaces/{workspace}/issues/{identifier}/triage", {
|
|
39
|
-
params: { path: {
|
|
40
|
-
workspace: s,
|
|
41
|
-
identifier: T.identifier
|
|
42
|
-
} },
|
|
43
|
-
body: n
|
|
44
|
-
})),
|
|
45
|
-
onSuccess: () => A.invalidateQueries({ queryKey: [
|
|
46
|
-
"workspace",
|
|
47
|
-
s,
|
|
48
|
-
"issues"
|
|
49
|
-
] })
|
|
50
|
-
}), I = P.filter((e) => e.category !== "triage" && e.category !== "completed" && e.category !== "canceled"), [L, R] = m(null), z = L ?? E(P)?.id ?? "", [B, V] = m(T.assignees.length === 0), [H, U] = m(!1), [W, G] = m(""), K = i(s, (e) => e.identifier !== T.identifier), q = p(), J = () => F.mutate({
|
|
51
|
-
decision: "accept",
|
|
52
|
-
...z && { statusId: z },
|
|
53
|
-
assignToMe: B
|
|
54
|
-
}), Y = () => F.mutate({
|
|
55
|
-
decision: "decline",
|
|
56
|
-
reason: W.trim()
|
|
57
|
-
});
|
|
58
|
-
if (o({
|
|
59
|
-
1: J,
|
|
60
|
-
2: Y
|
|
61
|
-
}, D && j && !F.isPending), !j) return null;
|
|
62
|
-
let X = F.isPending;
|
|
63
|
-
return /* @__PURE__ */ v("div", {
|
|
64
|
-
className: "flex flex-col gap-2",
|
|
6
|
+
function a({ workspace: a, issue: o }) {
|
|
7
|
+
let s = n("triage");
|
|
8
|
+
return /* @__PURE__ */ i("div", {
|
|
9
|
+
className: "mb-5 flex flex-wrap items-center gap-3 rounded-xl border border-border bg-muted/40 px-4 py-3",
|
|
65
10
|
children: [
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"aria-label": O("acceptInto"),
|
|
71
|
-
value: z,
|
|
72
|
-
items: I.map((e) => ({
|
|
73
|
-
value: e.id,
|
|
74
|
-
label: e.name
|
|
75
|
-
})),
|
|
76
|
-
onValueChange: (e) => e && R(e),
|
|
77
|
-
className: "w-36"
|
|
78
|
-
}),
|
|
79
|
-
/* @__PURE__ */ v("span", {
|
|
80
|
-
className: "flex items-center gap-1.5 text-sm",
|
|
81
|
-
children: [/* @__PURE__ */ _(l, {
|
|
82
|
-
id: q,
|
|
83
|
-
checked: B,
|
|
84
|
-
onCheckedChange: (e) => V(e === !0)
|
|
85
|
-
}), /* @__PURE__ */ _("label", {
|
|
86
|
-
htmlFor: q,
|
|
87
|
-
children: O("assignToMe")
|
|
88
|
-
})]
|
|
89
|
-
}),
|
|
90
|
-
/* @__PURE__ */ v(c, {
|
|
91
|
-
variant: "primary",
|
|
92
|
-
size: "sm",
|
|
93
|
-
onClick: J,
|
|
94
|
-
disabled: X,
|
|
95
|
-
title: O("acceptKey"),
|
|
96
|
-
children: [/* @__PURE__ */ _(S, {}), O("accept")]
|
|
97
|
-
})
|
|
98
|
-
]
|
|
99
|
-
}),
|
|
100
|
-
/* @__PURE__ */ v("div", {
|
|
101
|
-
className: "flex flex-wrap items-center gap-2",
|
|
102
|
-
children: [
|
|
103
|
-
/* @__PURE__ */ v(c, {
|
|
104
|
-
variant: "outline",
|
|
105
|
-
size: "sm",
|
|
106
|
-
onClick: Y,
|
|
107
|
-
disabled: X,
|
|
108
|
-
title: O("declineKey"),
|
|
109
|
-
children: [/* @__PURE__ */ _(C, {}), O("decline")]
|
|
110
|
-
}),
|
|
111
|
-
!H && /* @__PURE__ */ _(c, {
|
|
112
|
-
variant: "ghost",
|
|
113
|
-
size: "sm",
|
|
114
|
-
onClick: () => U(!0),
|
|
115
|
-
disabled: X,
|
|
116
|
-
children: O("addReason")
|
|
117
|
-
}),
|
|
118
|
-
/* @__PURE__ */ _(u, {
|
|
119
|
-
"aria-label": O("markDuplicate"),
|
|
120
|
-
...K,
|
|
121
|
-
value: null,
|
|
122
|
-
onValueChange: (e) => e && F.mutate({
|
|
123
|
-
decision: "duplicate",
|
|
124
|
-
duplicateOf: e,
|
|
125
|
-
reason: W.trim()
|
|
126
|
-
}),
|
|
127
|
-
placeholder: O("findIssue"),
|
|
128
|
-
trigger: /* @__PURE__ */ v(c, {
|
|
129
|
-
variant: "ghost",
|
|
130
|
-
size: "sm",
|
|
131
|
-
disabled: X,
|
|
132
|
-
children: [/* @__PURE__ */ _(w, {}), O("markDuplicate")]
|
|
133
|
-
})
|
|
134
|
-
})
|
|
135
|
-
]
|
|
136
|
-
}),
|
|
137
|
-
H && /* @__PURE__ */ _(f, {
|
|
138
|
-
value: W,
|
|
139
|
-
onChange: (e) => G(e.target.value),
|
|
140
|
-
placeholder: O("declineReason"),
|
|
141
|
-
"aria-label": O("declineReason"),
|
|
142
|
-
rows: 2,
|
|
143
|
-
autoFocus: !0
|
|
11
|
+
/* @__PURE__ */ r(e, { className: "size-4 shrink-0 text-muted-foreground" }),
|
|
12
|
+
/* @__PURE__ */ r("p", {
|
|
13
|
+
className: "min-w-48 flex-1 text-sm",
|
|
14
|
+
children: s("waiting")
|
|
144
15
|
}),
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
16
|
+
/* @__PURE__ */ r(t, {
|
|
17
|
+
workspace: a,
|
|
18
|
+
issue: o
|
|
148
19
|
})
|
|
149
20
|
]
|
|
150
21
|
});
|
|
151
22
|
}
|
|
152
|
-
export {
|
|
23
|
+
export { a as TriageBanner };
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { api as e, unwrap as t } from "../api/client.js";
|
|
2
|
+
import { cyclesQuery as n, issueQuery as r, labelsQuery as i, projectsQuery as a, statusesQuery as o, teamsQuery as s } from "../api/queries.js";
|
|
3
|
+
import { assigneeKey as c, parseAssigneeKey as l, useAssigneeOptions as u } from "../lib/assignees.js";
|
|
4
|
+
import { useIssuePicker as d } from "../lib/issuePicker.js";
|
|
5
|
+
import { useCanTriage as f } from "../lib/roles.js";
|
|
6
|
+
import { useShortcuts as p } from "../lib/shortcuts.js";
|
|
7
|
+
import { CycleIcon as m, EstimateIcon as h, FolderIcon as g, PriorityIcon as _, StatusIcon as v, TagIcon as y, UserIcon as b, usePriorityNames as ee } from "./icons.js";
|
|
8
|
+
import { scalePoints as te, useEstimateLabel as ne } from "./Planning.js";
|
|
9
|
+
import { Button as x, Combobox as S, CreateModal as C, CreateModalSelect as w, Switch as re, Textarea as T, Tooltip as ie, toast as ae } from "@parallelworks/ui";
|
|
10
|
+
import { useId as oe, useState as E } from "react";
|
|
11
|
+
import { useErrorMessage as D } from "@parallelworks/problem/react";
|
|
12
|
+
import { useTranslations as O } from "use-intl";
|
|
13
|
+
import { Fragment as k, jsx as A, jsxs as j } from "react/jsx-runtime";
|
|
14
|
+
import { useQuery as M, useQueryClient as N } from "@tanstack/react-query";
|
|
15
|
+
import { CheckIcon as P, CloseIcon as F, DuplicateIcon as I } from "@parallelworks/ui/icons";
|
|
16
|
+
// src/components/TriageDecisions.tsx
|
|
17
|
+
function L(e) {
|
|
18
|
+
let t = e.filter((e) => e.category !== "triage" && e.category !== "completed" && e.category !== "canceled");
|
|
19
|
+
return t.find((e) => e.category === "backlog") ?? t.find((e) => e.category === "unstarted") ?? t[0];
|
|
20
|
+
}
|
|
21
|
+
function R(e) {
|
|
22
|
+
let t = N(), n = D();
|
|
23
|
+
return async (i, a) => {
|
|
24
|
+
await t.invalidateQueries({ queryKey: [
|
|
25
|
+
"workspace",
|
|
26
|
+
e,
|
|
27
|
+
"issues"
|
|
28
|
+
] });
|
|
29
|
+
let o = await t.fetchQuery(r(e, a)).catch(() => void 0);
|
|
30
|
+
return {
|
|
31
|
+
left: !!o && !o.triage,
|
|
32
|
+
message: n(i)
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function z({ workspace: e, issue: t, icons: n = !1, shortcuts: r = !1, duplicateOf: i, onDecided: a }) {
|
|
37
|
+
let o = O("triage"), s = f(e, t.teamId), [c, l] = E(null);
|
|
38
|
+
if (p({
|
|
39
|
+
1: () => l("accept"),
|
|
40
|
+
2: () => l("decline")
|
|
41
|
+
}, r && s && c === null), !s) return null;
|
|
42
|
+
let u = (e) => {
|
|
43
|
+
l(null), a?.(e);
|
|
44
|
+
}, d = (e, t, r, i) => n ? /* @__PURE__ */ A(ie, {
|
|
45
|
+
content: r,
|
|
46
|
+
shortcut: i,
|
|
47
|
+
children: /* @__PURE__ */ A(x, {
|
|
48
|
+
variant: "ghost",
|
|
49
|
+
size: "sm",
|
|
50
|
+
"aria-label": r,
|
|
51
|
+
onClick: () => l(e),
|
|
52
|
+
children: t
|
|
53
|
+
})
|
|
54
|
+
}) : /* @__PURE__ */ j(x, {
|
|
55
|
+
variant: e === "accept" ? "primary" : "outline",
|
|
56
|
+
size: "sm",
|
|
57
|
+
onClick: () => l(e),
|
|
58
|
+
children: [t, r]
|
|
59
|
+
});
|
|
60
|
+
return /* @__PURE__ */ j(k, { children: [
|
|
61
|
+
/* @__PURE__ */ j("span", {
|
|
62
|
+
className: n ? "flex items-center gap-0.5" : "flex flex-wrap gap-2",
|
|
63
|
+
children: [
|
|
64
|
+
d("accept", /* @__PURE__ */ A(P, {}), o("acceptIssue"), "1"),
|
|
65
|
+
d("decline", /* @__PURE__ */ A(F, {}), o("declineIssue"), "2"),
|
|
66
|
+
d("duplicate", /* @__PURE__ */ A(I, {}), o("markDuplicate"))
|
|
67
|
+
]
|
|
68
|
+
}),
|
|
69
|
+
c === "accept" && /* @__PURE__ */ A(B, {
|
|
70
|
+
workspace: e,
|
|
71
|
+
issue: t,
|
|
72
|
+
onClose: () => l(null),
|
|
73
|
+
onDone: u
|
|
74
|
+
}),
|
|
75
|
+
(c === "decline" || c === "duplicate") && /* @__PURE__ */ A(V, {
|
|
76
|
+
workspace: e,
|
|
77
|
+
issue: t,
|
|
78
|
+
duplicate: c === "duplicate",
|
|
79
|
+
duplicateOf: i,
|
|
80
|
+
onClose: () => l(null),
|
|
81
|
+
onDone: u
|
|
82
|
+
})
|
|
83
|
+
] });
|
|
84
|
+
}
|
|
85
|
+
function B({ workspace: r, issue: d, onClose: f, onDone: p }) {
|
|
86
|
+
let x = O("triage"), S = O("common"), ie = R(r), D = N(), F = ee(), I = ne(), { data: z = [] } = M(s(r)), B = z.find((e) => e.id === d.teamId), V = B?.key ?? "", { data: H = [] } = M({
|
|
87
|
+
...o(r, V),
|
|
88
|
+
enabled: !!V
|
|
89
|
+
}), { data: se = [] } = M({
|
|
90
|
+
...n(r, V),
|
|
91
|
+
enabled: !!V
|
|
92
|
+
}), { data: ce = [] } = M(a(r)), { data: U = [] } = M(i(r)), le = u(r), [ue, de] = E(null), W = ue ?? L(H)?.id ?? "", [G, fe] = E(d.priority), [K, pe] = E(d.assignees[0] ? c(d.assignees[0]) : ""), [q, me] = E(d.project?.id ?? ""), [J, he] = E(d.estimate ?? 0), [Y, ge] = E(d.cycle?.id ?? ""), [X, _e] = E(d.labels.map((e) => e.id)), [Z, ve] = E(""), [ye, be] = E(!0), [xe, Se] = E(), Ce = oe(), we = H.filter((e) => e.category !== "triage" && e.category !== "completed" && e.category !== "canceled"), Te = B?.estimateScale ? te(B.estimateScale) : [], Q = { params: { path: {
|
|
93
|
+
workspace: r,
|
|
94
|
+
identifier: d.identifier
|
|
95
|
+
} } }, Ee = async () => {
|
|
96
|
+
Se(void 0);
|
|
97
|
+
try {
|
|
98
|
+
let n = d.assignees.map(c), i = d.labels.map((e) => e.id), a = K && !n.includes(K) ? [l(K)] : [], o = Y !== (d.cycle?.id ?? "") && Y !== "" ? Y : void 0;
|
|
99
|
+
Z.trim() && t(await e.POST("/api/v1/workspaces/{workspace}/issues/{identifier}/comments", {
|
|
100
|
+
...Q,
|
|
101
|
+
body: { body: Z.trim() }
|
|
102
|
+
}));
|
|
103
|
+
let s = {
|
|
104
|
+
...G !== d.priority && { priority: G },
|
|
105
|
+
...q !== (d.project?.id ?? "") && { projectId: q },
|
|
106
|
+
...Y === "" && d.cycle && { cycleId: "" },
|
|
107
|
+
...J !== (d.estimate ?? 0) && { estimate: J },
|
|
108
|
+
...n.some((e) => e !== K) && { removeAssignees: n.filter((e) => e !== K).map(l) },
|
|
109
|
+
...X.some((e) => !i.includes(e)) && { addLabels: X.filter((e) => !i.includes(e)) },
|
|
110
|
+
...i.some((e) => !X.includes(e)) && { removeLabels: i.filter((e) => !X.includes(e)) }
|
|
111
|
+
};
|
|
112
|
+
Object.keys(s).length > 0 && t(await e.PATCH("/api/v1/workspaces/{workspace}/issues/{identifier}", {
|
|
113
|
+
...Q,
|
|
114
|
+
body: s
|
|
115
|
+
}));
|
|
116
|
+
let u = t(await e.POST("/api/v1/workspaces/{workspace}/issues/{identifier}/triage", {
|
|
117
|
+
...Q,
|
|
118
|
+
body: {
|
|
119
|
+
decision: "accept",
|
|
120
|
+
statusId: W,
|
|
121
|
+
...a.length > 0 && { addAssignees: a },
|
|
122
|
+
...o && { cycleId: o }
|
|
123
|
+
}
|
|
124
|
+
}));
|
|
125
|
+
return ye && await e.PUT("/api/v1/workspaces/{workspace}/issues/{identifier}/subscription", {
|
|
126
|
+
...Q,
|
|
127
|
+
body: { state: "subscribed" }
|
|
128
|
+
}), p(u), D.invalidateQueries({ queryKey: [
|
|
129
|
+
"workspace",
|
|
130
|
+
r,
|
|
131
|
+
"issues"
|
|
132
|
+
] }), !0;
|
|
133
|
+
} catch (e) {
|
|
134
|
+
let { left: t, message: n } = await ie(e, d.identifier);
|
|
135
|
+
return t ? (ae.error(n), f(), !0) : (Se(n), !1);
|
|
136
|
+
}
|
|
137
|
+
}, $ = U.filter((e) => X.includes(e.id)).map((e) => e.name);
|
|
138
|
+
return /* @__PURE__ */ A(C, {
|
|
139
|
+
open: !0,
|
|
140
|
+
onClose: f,
|
|
141
|
+
size: "lg",
|
|
142
|
+
typeIcon: /* @__PURE__ */ A(P, { className: "size-3.5" }),
|
|
143
|
+
typeLabel: x("acceptTitle", {
|
|
144
|
+
key: d.identifier,
|
|
145
|
+
title: d.title
|
|
146
|
+
}),
|
|
147
|
+
namePlaceholder: "",
|
|
148
|
+
hideName: !0,
|
|
149
|
+
nameOptional: !0,
|
|
150
|
+
submitLabel: x("accept"),
|
|
151
|
+
error: xe,
|
|
152
|
+
dirty: Z.trim() !== "",
|
|
153
|
+
footerHint: /* @__PURE__ */ j("span", {
|
|
154
|
+
className: "flex items-center gap-2",
|
|
155
|
+
children: [/* @__PURE__ */ A(re, {
|
|
156
|
+
id: Ce,
|
|
157
|
+
size: "sm",
|
|
158
|
+
checked: ye,
|
|
159
|
+
onCheckedChange: be
|
|
160
|
+
}), /* @__PURE__ */ A("label", {
|
|
161
|
+
htmlFor: Ce,
|
|
162
|
+
children: x("subscribe")
|
|
163
|
+
})]
|
|
164
|
+
}),
|
|
165
|
+
onSubmit: Ee,
|
|
166
|
+
properties: /* @__PURE__ */ j(k, { children: [
|
|
167
|
+
B && /* @__PURE__ */ A(w, {
|
|
168
|
+
label: x("team"),
|
|
169
|
+
value: B.id,
|
|
170
|
+
items: [{
|
|
171
|
+
value: B.id,
|
|
172
|
+
label: B.name
|
|
173
|
+
}],
|
|
174
|
+
onValueChange: () => {},
|
|
175
|
+
disabled: !0
|
|
176
|
+
}),
|
|
177
|
+
/* @__PURE__ */ A(w, {
|
|
178
|
+
label: S("status"),
|
|
179
|
+
icon: (() => {
|
|
180
|
+
let e = we.find((e) => e.id === W);
|
|
181
|
+
return e && /* @__PURE__ */ A(v, {
|
|
182
|
+
category: e.category,
|
|
183
|
+
review: e.review,
|
|
184
|
+
step: e.step
|
|
185
|
+
});
|
|
186
|
+
})(),
|
|
187
|
+
value: W,
|
|
188
|
+
items: we.map((e) => ({
|
|
189
|
+
value: e.id,
|
|
190
|
+
label: e.name,
|
|
191
|
+
icon: /* @__PURE__ */ A(v, {
|
|
192
|
+
category: e.category,
|
|
193
|
+
review: e.review,
|
|
194
|
+
step: e.step
|
|
195
|
+
})
|
|
196
|
+
})),
|
|
197
|
+
onValueChange: de
|
|
198
|
+
}),
|
|
199
|
+
/* @__PURE__ */ A(w, {
|
|
200
|
+
label: S("priority"),
|
|
201
|
+
icon: /* @__PURE__ */ A(_, { priority: G }),
|
|
202
|
+
value: String(G),
|
|
203
|
+
items: F.map((e, t) => ({
|
|
204
|
+
value: String(t),
|
|
205
|
+
label: e,
|
|
206
|
+
icon: /* @__PURE__ */ A(_, { priority: t })
|
|
207
|
+
})),
|
|
208
|
+
onValueChange: (e) => fe(Number(e))
|
|
209
|
+
}),
|
|
210
|
+
/* @__PURE__ */ A(w, {
|
|
211
|
+
label: x("assignee"),
|
|
212
|
+
icon: /* @__PURE__ */ A(b, { className: "size-3.5" }),
|
|
213
|
+
value: K,
|
|
214
|
+
items: [{
|
|
215
|
+
value: "",
|
|
216
|
+
label: x("noAssignee")
|
|
217
|
+
}, ...le],
|
|
218
|
+
onValueChange: pe
|
|
219
|
+
}),
|
|
220
|
+
/* @__PURE__ */ A(w, {
|
|
221
|
+
label: x("project"),
|
|
222
|
+
icon: /* @__PURE__ */ A(g, { className: "size-3.5" }),
|
|
223
|
+
value: q,
|
|
224
|
+
items: [{
|
|
225
|
+
value: "",
|
|
226
|
+
label: x("noProject")
|
|
227
|
+
}, ...ce.map((e) => ({
|
|
228
|
+
value: e.id,
|
|
229
|
+
label: e.name
|
|
230
|
+
}))],
|
|
231
|
+
onValueChange: me
|
|
232
|
+
}),
|
|
233
|
+
Te.length > 0 && /* @__PURE__ */ A(w, {
|
|
234
|
+
label: x("estimate"),
|
|
235
|
+
icon: /* @__PURE__ */ A(h, { className: "size-3.5" }),
|
|
236
|
+
value: String(J),
|
|
237
|
+
items: [{
|
|
238
|
+
value: "0",
|
|
239
|
+
label: x("noEstimate")
|
|
240
|
+
}, ...Te.map((e) => ({
|
|
241
|
+
value: String(e),
|
|
242
|
+
label: I(e, B?.estimateScale)
|
|
243
|
+
}))],
|
|
244
|
+
onValueChange: (e) => he(Number(e))
|
|
245
|
+
}),
|
|
246
|
+
/* @__PURE__ */ A(w, {
|
|
247
|
+
label: $.length > 0 ? $.join(", ") : x("labels"),
|
|
248
|
+
icon: /* @__PURE__ */ A(y, { className: "size-3.5" }),
|
|
249
|
+
items: U.map((e) => ({
|
|
250
|
+
value: e.id,
|
|
251
|
+
label: X.includes(e.id) ? `✓ ${e.name}` : e.name
|
|
252
|
+
})),
|
|
253
|
+
onValueChange: (e) => _e((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e])
|
|
254
|
+
}),
|
|
255
|
+
B?.cyclesEnabled && /* @__PURE__ */ A(w, {
|
|
256
|
+
label: x("cycle"),
|
|
257
|
+
icon: /* @__PURE__ */ A(m, { className: "size-3.5" }),
|
|
258
|
+
value: Y,
|
|
259
|
+
items: [{
|
|
260
|
+
value: "",
|
|
261
|
+
label: x("noCycle")
|
|
262
|
+
}, ...se.filter((e) => e.state !== "past").map((e) => ({
|
|
263
|
+
value: e.id,
|
|
264
|
+
label: e.name || `#${e.number}`
|
|
265
|
+
}))],
|
|
266
|
+
onValueChange: ge
|
|
267
|
+
})
|
|
268
|
+
] }),
|
|
269
|
+
children: /* @__PURE__ */ A(T, {
|
|
270
|
+
value: Z,
|
|
271
|
+
onChange: (e) => ve(e.target.value),
|
|
272
|
+
placeholder: x("addComment"),
|
|
273
|
+
"aria-label": x("addComment"),
|
|
274
|
+
rows: 3,
|
|
275
|
+
autoFocus: !0
|
|
276
|
+
})
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
function V({ workspace: n, issue: r, duplicate: i, duplicateOf: a, onClose: o, onDone: s }) {
|
|
280
|
+
let c = O("triage"), l = R(n), u = N(), [f, p] = E(""), [m, h] = E(a ?? null), [g, _] = E(i && !a), [v, y] = E(), b = d(n, (e) => e.identifier !== r.identifier, { triage: "include" });
|
|
281
|
+
return /* @__PURE__ */ j(C, {
|
|
282
|
+
open: !0,
|
|
283
|
+
onClose: o,
|
|
284
|
+
size: "lg",
|
|
285
|
+
typeIcon: A(i ? I : F, { className: "size-3.5" }),
|
|
286
|
+
typeLabel: c(i ? "duplicateTitle" : "declineTitle", {
|
|
287
|
+
key: r.identifier,
|
|
288
|
+
title: r.title
|
|
289
|
+
}),
|
|
290
|
+
namePlaceholder: "",
|
|
291
|
+
hideName: !0,
|
|
292
|
+
nameOptional: !0,
|
|
293
|
+
submitLabel: c(i ? "markDuplicate" : "decline"),
|
|
294
|
+
submitDisabled: i && !m,
|
|
295
|
+
error: v,
|
|
296
|
+
dirty: f.trim() !== "",
|
|
297
|
+
onSubmit: async () => {
|
|
298
|
+
y(void 0);
|
|
299
|
+
try {
|
|
300
|
+
return s(t(await e.POST("/api/v1/workspaces/{workspace}/issues/{identifier}/triage", {
|
|
301
|
+
params: { path: {
|
|
302
|
+
workspace: n,
|
|
303
|
+
identifier: r.identifier
|
|
304
|
+
} },
|
|
305
|
+
body: i ? {
|
|
306
|
+
decision: "duplicate",
|
|
307
|
+
duplicateOf: m ?? "",
|
|
308
|
+
reason: f.trim()
|
|
309
|
+
} : {
|
|
310
|
+
decision: "decline",
|
|
311
|
+
reason: f.trim()
|
|
312
|
+
}
|
|
313
|
+
}))), u.invalidateQueries({ queryKey: [
|
|
314
|
+
"workspace",
|
|
315
|
+
n,
|
|
316
|
+
"issues"
|
|
317
|
+
] }), !0;
|
|
318
|
+
} catch (e) {
|
|
319
|
+
let { left: t, message: n } = await l(e, r.identifier);
|
|
320
|
+
return t ? (ae.error(n), o(), !0) : (y(n), !1);
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
children: [i && /* @__PURE__ */ A(S, {
|
|
324
|
+
"aria-label": c("findIssue"),
|
|
325
|
+
...b,
|
|
326
|
+
open: g,
|
|
327
|
+
onOpenChange: _,
|
|
328
|
+
value: m,
|
|
329
|
+
onValueChange: h,
|
|
330
|
+
placeholder: c("findIssue"),
|
|
331
|
+
trigger: /* @__PURE__ */ j(x, {
|
|
332
|
+
variant: "outline",
|
|
333
|
+
size: "sm",
|
|
334
|
+
className: "self-start",
|
|
335
|
+
children: [/* @__PURE__ */ A(I, {}), m ? c("duplicateOf", { key: m }) : c("findIssue")]
|
|
336
|
+
})
|
|
337
|
+
}), /* @__PURE__ */ A(T, {
|
|
338
|
+
value: f,
|
|
339
|
+
onChange: (e) => p(e.target.value),
|
|
340
|
+
placeholder: c("addComment"),
|
|
341
|
+
"aria-label": c("addComment"),
|
|
342
|
+
rows: 3,
|
|
343
|
+
autoFocus: !i
|
|
344
|
+
})]
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
export { z as TriageDecisions, L as acceptStatus, R as useDecisionFailure };
|
package/lib/issuePicker.js
CHANGED
|
@@ -4,19 +4,22 @@ import { useEffect as n, useState as r } from "react";
|
|
|
4
4
|
import { jsx as i } from "react/jsx-runtime";
|
|
5
5
|
import { keepPreviousData as a, useQuery as o } from "@tanstack/react-query";
|
|
6
6
|
// src/lib/issuePicker.tsx
|
|
7
|
-
function s(s, c) {
|
|
8
|
-
let [
|
|
7
|
+
function s(s, c, l = {}) {
|
|
8
|
+
let [u, d] = r(""), [f, p] = r("");
|
|
9
9
|
n(() => {
|
|
10
|
-
let e = setTimeout(() =>
|
|
10
|
+
let e = setTimeout(() => p(u.trim()), 150);
|
|
11
11
|
return () => clearTimeout(e);
|
|
12
|
-
}, [
|
|
13
|
-
let { data:
|
|
14
|
-
...e(s, {
|
|
15
|
-
|
|
12
|
+
}, [u]);
|
|
13
|
+
let { data: m } = o(e(s, l)), { data: h, isFetching: g } = o({
|
|
14
|
+
...e(s, {
|
|
15
|
+
...l,
|
|
16
|
+
q: f
|
|
17
|
+
}),
|
|
18
|
+
enabled: f !== "",
|
|
16
19
|
placeholderData: a
|
|
17
|
-
}),
|
|
20
|
+
}), _ = u.trim().toLowerCase(), v = /* @__PURE__ */ new Set();
|
|
18
21
|
return {
|
|
19
|
-
items: [...(
|
|
22
|
+
items: [...(m?.issues ?? []).filter((e) => `${e.identifier} ${e.title}`.toLowerCase().includes(_)), ...f ? h?.issues ?? [] : []].filter((e) => c(e) && !v.has(e.identifier) && v.add(e.identifier)).map((e) => ({
|
|
20
23
|
value: e.identifier,
|
|
21
24
|
label: `${e.identifier} ${e.title}`,
|
|
22
25
|
icon: /* @__PURE__ */ i(t, {
|
|
@@ -25,8 +28,8 @@ function s(s, c) {
|
|
|
25
28
|
step: e.status.step
|
|
26
29
|
})
|
|
27
30
|
})),
|
|
28
|
-
onQueryChange:
|
|
29
|
-
loading:
|
|
31
|
+
onQueryChange: d,
|
|
32
|
+
loading: f !== "" && g
|
|
30
33
|
};
|
|
31
34
|
}
|
|
32
35
|
export { s as useIssuePicker };
|