@parallelworks/tandem-web 0.189.5 → 0.189.7

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.
@@ -0,0 +1,207 @@
1
+ import { api as e, unwrap as t } from "../api/client.js";
2
+ import { meQuery as n, statusesQuery as r, teamsQuery as i } from "../api/queries.js";
3
+ import { useIssuePicker as a } from "../lib/issuePicker.js";
4
+ import { useCanTriage as o } from "../lib/roles.js";
5
+ import { TriageIcon as s } from "./icons.js";
6
+ import { Button as c, Checkbox as l, Combobox as u, Popover as d, Select as f, Textarea as p } from "@parallelworks/ui";
7
+ import { useId as m, useState as h } from "react";
8
+ import { useErrorMessage as g } from "@parallelworks/problem/react";
9
+ import { useTranslations as _ } from "use-intl";
10
+ import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
11
+ import { useMutation as x, useQuery as S, useQueryClient as C } from "@tanstack/react-query";
12
+ import { CheckIcon as w, CloseIcon as T, DuplicateIcon as E } from "@parallelworks/ui/icons";
13
+ // src/components/TriageBanner.tsx
14
+ function D({ workspace: e, issue: t }) {
15
+ let n = _("triage");
16
+ return /* @__PURE__ */ b("div", {
17
+ className: "mb-5 flex flex-wrap items-center gap-3 rounded-xl border border-border bg-muted/40 px-4 py-3",
18
+ children: [
19
+ /* @__PURE__ */ y(s, { className: "size-4 shrink-0 text-muted-foreground" }),
20
+ /* @__PURE__ */ y("p", {
21
+ className: "min-w-48 flex-1 text-sm",
22
+ children: n("waiting")
23
+ }),
24
+ /* @__PURE__ */ y(O, {
25
+ workspace: e,
26
+ issue: t
27
+ })
28
+ ]
29
+ });
30
+ }
31
+ function O({ workspace: s, issue: D, compact: O = !1 }) {
32
+ let k = _("triage"), A = g(), j = C(), M = o(s, D.teamId), { data: N = [] } = S(i(s)), P = N.find((e) => e.id === D.teamId)?.key ?? "", { data: F = [] } = S({
33
+ ...r(s, P),
34
+ enabled: !!P
35
+ }), { data: I } = S(n), L = { params: { path: {
36
+ workspace: s,
37
+ identifier: D.identifier
38
+ } } }, R = (t) => e.POST("/api/v1/workspaces/{workspace}/issues/{identifier}/triage", {
39
+ ...L,
40
+ body: { decision: t }
41
+ }), z = () => j.invalidateQueries({ queryKey: [
42
+ "workspace",
43
+ s,
44
+ "issues"
45
+ ] }), [B, V] = h(""), [H, U] = h(!1), W = x({
46
+ mutationFn: async () => {
47
+ let n = I?.user.username, r = H && n ? [{
48
+ kind: "user",
49
+ handle: n
50
+ }] : void 0;
51
+ B ? t(await e.PATCH("/api/v1/workspaces/{workspace}/issues/{identifier}", {
52
+ ...L,
53
+ body: {
54
+ statusId: B,
55
+ ...r && { addAssignees: r }
56
+ }
57
+ })) : (t(await R("accept")), r && t(await e.PATCH("/api/v1/workspaces/{workspace}/issues/{identifier}", {
58
+ ...L,
59
+ body: { addAssignees: r }
60
+ })));
61
+ },
62
+ onSuccess: z
63
+ }), [G, K] = h(""), q = x({
64
+ mutationFn: async () => {
65
+ G.trim() && t(await e.POST("/api/v1/workspaces/{workspace}/issues/{identifier}/comments", {
66
+ ...L,
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",
85
+ children: [
86
+ /* @__PURE__ */ y(u, {
87
+ "aria-label": k("markDuplicate"),
88
+ ...Y,
89
+ value: null,
90
+ onValueChange: (e) => e && J.mutate(e),
91
+ placeholder: k("findIssue"),
92
+ trigger: O ? /* @__PURE__ */ y(c, {
93
+ variant: "ghost",
94
+ size: "sm",
95
+ "aria-label": k("markDuplicate"),
96
+ title: k("markDuplicate"),
97
+ disabled: Q,
98
+ children: /* @__PURE__ */ y(E, {})
99
+ }) : /* @__PURE__ */ y(c, {
100
+ variant: "ghost",
101
+ size: "sm",
102
+ disabled: Q,
103
+ children: k("markDuplicate")
104
+ })
105
+ }),
106
+ /* @__PURE__ */ y(d, {
107
+ trigger: O ? /* @__PURE__ */ y(c, {
108
+ variant: "ghost",
109
+ size: "sm",
110
+ "aria-label": k("decline"),
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",
136
+ variant: "primary",
137
+ size: "sm",
138
+ loading: q.isPending,
139
+ className: "self-end",
140
+ children: k("decline")
141
+ })]
142
+ })
143
+ }),
144
+ /* @__PURE__ */ y(d, {
145
+ trigger: O ? /* @__PURE__ */ y(c, {
146
+ variant: "ghost",
147
+ size: "sm",
148
+ "aria-label": k("accept"),
149
+ title: k("accept"),
150
+ disabled: Q,
151
+ children: /* @__PURE__ */ y(w, {})
152
+ }) : /* @__PURE__ */ y(c, {
153
+ variant: "primary",
154
+ size: "sm",
155
+ disabled: Q,
156
+ children: k("accept")
157
+ }),
158
+ align: "end",
159
+ className: "w-72",
160
+ "aria-label": k("accept"),
161
+ children: /* @__PURE__ */ b("form", {
162
+ className: "flex flex-col gap-3",
163
+ onSubmit: (e) => {
164
+ e.preventDefault(), W.mutate();
165
+ },
166
+ children: [
167
+ /* @__PURE__ */ y(f, {
168
+ "aria-label": k("acceptInto"),
169
+ value: B,
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
+ })]
189
+ }),
190
+ /* @__PURE__ */ y(c, {
191
+ type: "submit",
192
+ variant: "primary",
193
+ size: "sm",
194
+ loading: W.isPending,
195
+ className: "self-end",
196
+ children: k("accept")
197
+ })
198
+ ]
199
+ })
200
+ })
201
+ ]
202
+ }), Z && /* @__PURE__ */ y("p", {
203
+ className: "basis-full text-xs text-danger",
204
+ children: A(Z)
205
+ })] }) : null;
206
+ }
207
+ export { O as TriageActions, D as TriageBanner };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parallelworks/tandem-web",
3
- "version": "0.189.5",
3
+ "version": "0.189.7",
4
4
  "description": "Tandem's pages, for a host app to render in its own",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -18,26 +18,26 @@
18
18
  "@dagrejs/dagre": "3.1.3",
19
19
  "@fontsource-variable/public-sans": "^5.3.0",
20
20
  "@parallelworks/api-docs": "^0.4.0",
21
- "@parallelworks/i18n": "^0.3.0",
22
- "@parallelworks/problem": "^0.6.1",
21
+ "@parallelworks/i18n": "^0.3.1",
22
+ "@parallelworks/problem": "^0.6.2",
23
23
  "@tanstack/react-query": "^5.107.1",
24
24
  "@tanstack/react-virtual": "3.14.26",
25
- "@tiptap/extension-blockquote": "3.33.0",
26
- "@tiptap/extension-code-block-lowlight": "3.33.0",
27
- "@tiptap/extension-collaboration": "^3.33.0",
28
- "@tiptap/extension-collaboration-caret": "^3.33.0",
29
- "@tiptap/extension-details": "3.33.0",
30
- "@tiptap/extension-drag-handle": "3.33.0",
31
- "@tiptap/extension-drag-handle-react": "3.33.0",
32
- "@tiptap/extension-image": "^3.33.0",
33
- "@tiptap/extension-list": "^3.33.0",
34
- "@tiptap/extension-node-range": "3.33.0",
35
- "@tiptap/extension-table": "3.33.0",
36
- "@tiptap/extensions": "^3.33.0",
37
- "@tiptap/markdown": "^3.33.0",
38
- "@tiptap/pm": "^3.33.0",
39
- "@tiptap/react": "^3.33.0",
40
- "@tiptap/starter-kit": "^3.33.0",
25
+ "@tiptap/extension-blockquote": "3.34.0",
26
+ "@tiptap/extension-code-block-lowlight": "3.34.0",
27
+ "@tiptap/extension-collaboration": "^3.34.0",
28
+ "@tiptap/extension-collaboration-caret": "^3.34.0",
29
+ "@tiptap/extension-details": "3.34.0",
30
+ "@tiptap/extension-drag-handle": "3.34.0",
31
+ "@tiptap/extension-drag-handle-react": "3.34.0",
32
+ "@tiptap/extension-image": "^3.34.0",
33
+ "@tiptap/extension-list": "^3.34.0",
34
+ "@tiptap/extension-node-range": "3.34.0",
35
+ "@tiptap/extension-table": "3.34.0",
36
+ "@tiptap/extensions": "^3.34.0",
37
+ "@tiptap/markdown": "^3.34.0",
38
+ "@tiptap/pm": "^3.34.0",
39
+ "@tiptap/react": "^3.34.0",
40
+ "@tiptap/starter-kit": "^3.34.0",
41
41
  "@xyflow/react": "12.12.1",
42
42
  "highlight.js": "11.12.0",
43
43
  "katex": "^0.19.1",
@@ -49,10 +49,10 @@
49
49
  "yjs": "^13.6.33"
50
50
  },
51
51
  "peerDependencies": {
52
- "@parallelworks/ui": ">=0.119.0 <1",
52
+ "@parallelworks/ui": ">=0.131.0 <1",
53
53
  "@tanstack/react-router": "^1.170.0",
54
54
  "react": "^19.3.0",
55
55
  "react-dom": "^19.3.0",
56
- "use-intl": "^4.14.0"
56
+ "use-intl": "^4.15.0"
57
57
  }
58
58
  }