@parallelworks/tandem-web 0.189.8 → 0.189.9
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 +11 -2
- package/_virtual/_virtual_i18n/es/common.js +11 -2
- package/_virtual/_virtual_i18n/ja/common.js +11 -2
- package/_virtual/_virtual_i18n/ko/common.js +11 -2
- package/_virtual/_virtual_i18n/zh/common.js +11 -2
- package/components/IssueView.js +98 -101
- package/components/TriageBanner.js +137 -192
- package/package.json +1 -1
- package/pages/triage.js +229 -160
|
@@ -1,207 +1,152 @@
|
|
|
1
1
|
import { api as e, unwrap as t } from "../api/client.js";
|
|
2
|
-
import {
|
|
3
|
-
import { useIssuePicker as
|
|
4
|
-
import { useCanTriage as
|
|
2
|
+
import { statusesQuery as n, teamsQuery as r } from "../api/queries.js";
|
|
3
|
+
import { useIssuePicker as i } from "../lib/issuePicker.js";
|
|
4
|
+
import { useCanTriage as a } from "../lib/roles.js";
|
|
5
|
+
import { useShortcuts as o } from "../lib/shortcuts.js";
|
|
5
6
|
import { TriageIcon as s } from "./icons.js";
|
|
6
|
-
import { Button as c, Checkbox as l, Combobox as u,
|
|
7
|
-
import { useId as
|
|
8
|
-
import { useErrorMessage as
|
|
9
|
-
import { useTranslations as
|
|
10
|
-
import {
|
|
11
|
-
import { useMutation as
|
|
12
|
-
import { CheckIcon as
|
|
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";
|
|
13
14
|
// src/components/TriageBanner.tsx
|
|
14
|
-
function
|
|
15
|
-
let
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
className: "mb-5 flex flex-
|
|
18
|
-
children: [
|
|
19
|
-
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
issue: t
|
|
27
|
-
})
|
|
28
|
-
]
|
|
15
|
+
function T({ workspace: e, issue: t, shortcuts: n = !1 }) {
|
|
16
|
+
let r = g("triage");
|
|
17
|
+
return /* @__PURE__ */ v("div", {
|
|
18
|
+
className: "mb-5 flex flex-col gap-3 rounded-xl border border-border bg-muted/40 px-4 py-3",
|
|
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
|
+
})]
|
|
29
27
|
});
|
|
30
28
|
}
|
|
31
|
-
function
|
|
32
|
-
let
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
body: { body: G.trim() }
|
|
68
|
-
})), t(await R("decline"));
|
|
69
|
-
},
|
|
70
|
-
onSuccess: z
|
|
71
|
-
}), J = x({
|
|
72
|
-
mutationFn: async (n) => {
|
|
73
|
-
t(await e.POST("/api/v1/workspaces/{workspace}/issues/{identifier}/relations", {
|
|
74
|
-
...L,
|
|
75
|
-
body: {
|
|
76
|
-
type: "duplicate",
|
|
77
|
-
issue: n
|
|
78
|
-
}
|
|
79
|
-
})), t(await R("decline"));
|
|
80
|
-
},
|
|
81
|
-
onSuccess: z
|
|
82
|
-
}), Y = a(s, (e) => e.identifier !== D.identifier), X = m(), Z = W.error ?? q.error ?? J.error, Q = W.isPending || q.isPending || J.isPending, $ = F.filter((e) => e.category !== "triage" && e.category !== "canceled");
|
|
83
|
-
return M ? /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ b("span", {
|
|
84
|
-
className: O ? "flex items-center gap-0.5" : "flex flex-wrap gap-2",
|
|
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",
|
|
85
65
|
children: [
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
title: k("decline"),
|
|
112
|
-
disabled: Q,
|
|
113
|
-
children: /* @__PURE__ */ y(T, {})
|
|
114
|
-
}) : /* @__PURE__ */ y(c, {
|
|
115
|
-
variant: "outline",
|
|
116
|
-
size: "sm",
|
|
117
|
-
disabled: Q,
|
|
118
|
-
children: k("decline")
|
|
119
|
-
}),
|
|
120
|
-
align: "end",
|
|
121
|
-
className: "w-80",
|
|
122
|
-
"aria-label": k("decline"),
|
|
123
|
-
children: /* @__PURE__ */ b("form", {
|
|
124
|
-
className: "flex flex-col gap-2",
|
|
125
|
-
onSubmit: (e) => {
|
|
126
|
-
e.preventDefault(), q.mutate();
|
|
127
|
-
},
|
|
128
|
-
children: [/* @__PURE__ */ y(p, {
|
|
129
|
-
value: G,
|
|
130
|
-
onChange: (e) => K(e.target.value),
|
|
131
|
-
placeholder: k("declineReason"),
|
|
132
|
-
"aria-label": k("declineReason"),
|
|
133
|
-
rows: 3
|
|
134
|
-
}), /* @__PURE__ */ y(c, {
|
|
135
|
-
type: "submit",
|
|
66
|
+
/* @__PURE__ */ v("div", {
|
|
67
|
+
className: "flex flex-wrap items-center gap-2",
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ _(d, {
|
|
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, {
|
|
136
91
|
variant: "primary",
|
|
137
92
|
size: "sm",
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
93
|
+
onClick: J,
|
|
94
|
+
disabled: X,
|
|
95
|
+
title: O("acceptKey"),
|
|
96
|
+
children: [/* @__PURE__ */ _(S, {}), O("accept")]
|
|
97
|
+
})
|
|
98
|
+
]
|
|
143
99
|
}),
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
items: [{
|
|
171
|
-
value: "",
|
|
172
|
-
label: k("acceptWhereItIs")
|
|
173
|
-
}, ...$.map((e) => ({
|
|
174
|
-
value: e.id,
|
|
175
|
-
label: e.name
|
|
176
|
-
}))],
|
|
177
|
-
onValueChange: (e) => V(e ?? "")
|
|
178
|
-
}),
|
|
179
|
-
/* @__PURE__ */ b("span", {
|
|
180
|
-
className: "flex items-center gap-2 text-sm",
|
|
181
|
-
children: [/* @__PURE__ */ y(l, {
|
|
182
|
-
id: X,
|
|
183
|
-
checked: H,
|
|
184
|
-
onCheckedChange: (e) => U(e === !0)
|
|
185
|
-
}), /* @__PURE__ */ y("label", {
|
|
186
|
-
htmlFor: X,
|
|
187
|
-
children: k("assignToMe")
|
|
188
|
-
})]
|
|
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()
|
|
189
126
|
}),
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
variant: "
|
|
127
|
+
placeholder: O("findIssue"),
|
|
128
|
+
trigger: /* @__PURE__ */ v(c, {
|
|
129
|
+
variant: "ghost",
|
|
193
130
|
size: "sm",
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
children: k("accept")
|
|
131
|
+
disabled: X,
|
|
132
|
+
children: [/* @__PURE__ */ _(w, {}), O("markDuplicate")]
|
|
197
133
|
})
|
|
198
|
-
|
|
199
|
-
|
|
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
|
|
144
|
+
}),
|
|
145
|
+
F.error && /* @__PURE__ */ _("p", {
|
|
146
|
+
className: "text-xs text-danger",
|
|
147
|
+
children: k(F.error)
|
|
200
148
|
})
|
|
201
149
|
]
|
|
202
|
-
})
|
|
203
|
-
className: "basis-full text-xs text-danger",
|
|
204
|
-
children: A(Z)
|
|
205
|
-
})] }) : null;
|
|
150
|
+
});
|
|
206
151
|
}
|
|
207
|
-
export {
|
|
152
|
+
export { D as TriageActions, T as TriageBanner, E as acceptStatus };
|