@parallelworks/tandem-web 0.189.5 → 0.189.6

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.
@@ -1,1439 +1,15 @@
1
- import { api as e, unwrap as t } from "../../../api/client.js";
2
- import { invalidateIssueViews as n, useUpdateIssue as r } from "../../../api/mutations.js";
3
- import { areasQuery as i, attachmentsQuery as a, commentsQuery as o, cyclesQuery as s, eventsQuery as c, issueDocsQuery as l, issueLinksQuery as u, issueQuery as d, labelsQuery as f, meQuery as p, projectsQuery as m, reactionsQuery as h, statusesQuery as g, teamsQuery as _ } from "../../../api/queries.js";
4
- import { Timeline as v } from "../../../components/ActivityTimeline.js";
5
- import { ActorLink as y } from "../../../components/ActorLink.js";
6
- import { AgentPage as b } from "../../../components/AgentPage.js";
7
- import { AgentWork as x } from "../../../components/AgentWork.js";
8
- import { AreaLink as S } from "../../../components/AreaLink.js";
9
- import { AttachButton as C, IssueAttachments as w, UploadStatus as T, useAttachmentUpload as E } from "../../../components/Attachments.js";
10
- import { CollabEditor as D } from "../../../components/CollabEditor.js";
11
- import { CustomerRequests as O } from "../../../components/CustomerRequests.js";
12
- import { IssueFields as k } from "../../../components/CustomFields.js";
13
- import { Editor as A } from "../../../components/Editor.js";
14
- import { FavoriteStar as j } from "../../../components/FavoriteStar.js";
15
- import { IssueDesigns as ee } from "../../../components/Figma.js";
16
- import { IssueLinkChips as M, IssueLinks as te, SharedThreadHeader as N } from "../../../components/GitHub.js";
17
- import { IssueCode as ne } from "../../../components/IssueCode.js";
18
- import { EventLine as P } from "../../../components/IssueEvent.js";
19
- import { IssueIntercom as re } from "../../../components/IssueIntercom.js";
20
- import { ParentProperty as F, SubIssuesAndRelations as ie } from "../../../components/IssueRelations.js";
21
- import { IssueSentry as ae } from "../../../components/IssueSentry.js";
22
- import { TypeIcon as I } from "../../../components/IssueTypes.js";
23
- import { IssueZendesk as oe } from "../../../components/IssueZendesk.js";
24
- import { AreaIcon as L, BranchIcon as se, CalendarIcon as ce, CloseIcon as le, CycleIcon as ue, EstimateIcon as de, FileTextIcon as fe, InboxIcon as pe, PriorityIcon as me, ProjectIcon as he, StatusIcon as ge, TriageIcon as _e, usePriorityNames as ve } from "../../../components/icons.js";
25
- import { PersonHoverCard as ye } from "../../../components/PersonHoverCard.js";
26
- import { DueDate as be, ProjectStatusIcon as xe, SlaBadge as Se, scalePoints as Ce, useEstimateLabel as we } from "../../../components/Planning.js";
27
- import { FieldNote as Te, Viewers as Ee } from "../../../components/Presence.js";
28
- import { Reactions as De } from "../../../components/Reactions.js";
29
- import { TimeInStatus as Oe } from "../../../components/Reports.js";
30
- import { SubscribeButton as ke } from "../../../components/SubscribeButton.js";
31
- import { Widgets as Ae } from "../../../components/Widgets.js";
32
- import { assigneeKey as je, parseAssigneeKey as Me, useAssigneeOptions as Ne } from "../../../lib/assignees.js";
33
- import { actorAvatar as Pe } from "../../../lib/avatar.js";
34
- import { branchName as Fe } from "../../../lib/branch.js";
35
- import { caretColor as Ie, useCollabSession as Le } from "../../../lib/collab.js";
36
- import { useConfirm as Re } from "../../../lib/confirm.js";
37
- import { customFieldsQuery as ze, hasValue as Be } from "../../../lib/customFields.js";
38
- import { docRef as Ve, useDocMenu as He } from "../../../lib/docs.js";
39
- import { issueURL as Ue, useIssueMenu as We } from "../../../lib/issueMenu.js";
40
- import { issueTypesQuery as Ge, typeShows as Ke, typesFor as qe } from "../../../lib/issueTypes.js";
41
- import { useLinkedIssues as Je } from "../../../lib/linkedIssues.js";
42
- import { useOthersOn as Ye, useReportLocation as Xe } from "../../../lib/live.js";
43
- import { copyItem as Ze } from "../../../lib/menus.js";
44
- import { useReadIssueNotifications as Qe } from "../../../lib/notifications.js";
45
- import { usePageTitle as $e } from "../../../lib/pageTitle.js";
46
- import { connectorActor as et, usePeople as tt } from "../../../lib/people.js";
47
- import { PickManyBox as nt, usePickMany as rt } from "../../../lib/pickMany.js";
48
- import { rememberPage as it } from "../../../lib/recent.js";
49
- import { issueScope as at, useCan as ot, useCanTriage as st } from "../../../lib/roles.js";
50
- import { Link as R, useNavigate as ct } from "../../../lib/router.js";
51
- import { useShortcuts as lt } from "../../../lib/shortcuts.js";
52
- import { useTime as ut } from "../../../lib/time.js";
53
- import { Route as dt } from "./_identifier.js";
54
- import { Avatar as ft, Button as z, Callout as pt, Card as mt, Combobox as B, CopyButton as ht, DatePicker as gt, ErrorText as _t, IconButton as vt, Kbd as yt, RelativeTime as bt, Select as V, TitleInput as xt, Tooltip as St, buttonClasses as Ct, menuDivider as wt, toast as Tt, useOpenMenu as H } from "@parallelworks/ui";
55
- import { createContext as Et, useCallback as Dt, useContext as Ot, useEffect as kt, useMemo as At, useRef as U, useState as W } from "react";
56
- import { useErrorMessage as jt } from "@parallelworks/problem/react";
57
- import { useFormatter as Mt, useTranslations as G } from "use-intl";
58
- import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
59
- import { useMutation as Y, useQuery as X, useQueryClient as Z, useSuspenseQuery as Q } from "@tanstack/react-query";
60
- import { MoreButton as Nt } from "@parallelworks/ui/list";
61
- import { ArchiveIcon as Pt } from "@parallelworks/ui/icons";
1
+ import { issueQuery as e } from "../../../api/queries.js";
2
+ import { IssueView as t } from "../../../components/IssueView.js";
3
+ import { usePageTitle as n } from "../../../lib/pageTitle.js";
4
+ import { Route as r } from "./_identifier.js";
5
+ import { jsx as i } from "react/jsx-runtime";
6
+ import { useSuspenseQuery as a } from "@tanstack/react-query";
62
7
  // src/routes/$workspace/issues/$identifier.tsx?tsr-split=component
63
- function Ft() {
64
- let i = G("issue"), a = ut(), o = jt(), s = G("common"), { workspace: c, identifier: l } = dt.useParams(), { data: f } = Q(d(c, l)), { data: m } = Q(_(c)), { data: h } = Q(p), { data: g = [] } = X(u(c, l)), [v, y] = W();
65
- Xe({
66
- identifier: f.identifier,
67
- ...v && { field: v }
68
- }), $e(`${f.identifier} ${f.title}`), Qe(c, f.identifier);
69
- let b = ct(), S = Fe(f.identifier, f.title);
70
- kt(() => {
71
- window.location.pathname.endsWith(`/issues/${S}`) || b({
72
- to: "/$workspace/issues/$identifier",
73
- params: {
74
- workspace: c,
75
- identifier: f.identifier
76
- },
77
- search: !0,
78
- hash: !0,
79
- replace: !0
80
- });
81
- }, [
82
- S,
83
- b,
84
- c,
85
- f.identifier
86
- ]);
87
- let C = ot(c, "delete_issues", at(f)), T = Z(), { confirm: E, dialog: D } = Re(), k = Y({
88
- mutationFn: async () => t(await e.POST("/api/v1/workspaces/{workspace}/issues/{identifier}/restore", { params: { path: {
89
- workspace: c,
90
- identifier: f.identifier
91
- } } })),
92
- onSuccess: (e) => {
93
- T.setQueryData(d(c, f.identifier).queryKey, e), n(T, c, f.identifier);
94
- }
95
- }), A = Y({
96
- mutationFn: async () => t(await e.DELETE("/api/v1/workspaces/{workspace}/issues/{identifier}", { params: { path: {
97
- workspace: c,
98
- identifier: f.identifier
99
- } } })),
100
- onSuccess: () => {
101
- Tt.success(i("deleted", { identifier: f.identifier })), n(T, c);
102
- let e = m.find((e) => e.id === f.teamId)?.key;
103
- b(e ? {
104
- to: "/$workspace/teams/$key/issues",
105
- params: {
106
- workspace: c,
107
- key: e
108
- }
109
- } : {
110
- to: "/$workspace/issues",
111
- params: { workspace: c }
112
- });
113
- }
114
- }), te = Dt((e) => b({
115
- to: "/$workspace/issues/$identifier",
116
- params: {
117
- workspace: c,
118
- identifier: e
119
- }
120
- }), [b, c]);
121
- Je(c, f.body, te), kt(() => {
122
- it(c, {
123
- kind: "issue",
124
- href: `/${c}/issues/${f.identifier}`,
125
- label: `${f.identifier} ${f.title}`
126
- });
127
- }, [
128
- c,
129
- f.identifier,
130
- f.title
131
- ]);
132
- let N = Ye({ issue: f.identifier }, h?.user.username), P = m.find((e) => e.id === f.teamId), F = r(c, l), [I, L] = W(null), ce = H(), le = We(c);
133
- return lt({
134
- s: () => L("status"),
135
- p: () => L("priority"),
136
- a: () => L("assignees"),
137
- l: () => L("labels"),
138
- Escape: () => b({
139
- to: "/$workspace/issues",
140
- params: { workspace: c }
141
- })
142
- }, I === null), /* @__PURE__ */ J("div", {
143
- className: "flex h-full flex-col",
144
- children: [
145
- /* @__PURE__ */ J("header", {
146
- className: "flex h-12 shrink-0 items-center gap-2 border-b border-border px-4 text-sm md:px-5",
147
- onContextMenu: (e) => ce(e, le([f])),
148
- children: [
149
- /* @__PURE__ */ q(R, {
150
- to: P ? "/$workspace/teams/$key/issues" : "/$workspace/issues",
151
- params: {
152
- workspace: c,
153
- key: P?.key ?? ""
154
- },
155
- className: "text-muted-foreground hover:text-foreground",
156
- children: P?.name ?? i("issues")
157
- }),
158
- /* @__PURE__ */ q("span", {
159
- className: "text-muted-foreground",
160
- "aria-hidden": "true",
161
- children: "/"
162
- }),
163
- /* @__PURE__ */ q("span", {
164
- className: "shrink-0 font-medium whitespace-nowrap",
165
- children: f.identifier
166
- }),
167
- /* @__PURE__ */ q(j, {
168
- workspace: c,
169
- kind: "issue",
170
- target: f.id
171
- }),
172
- /* @__PURE__ */ q(ke, {
173
- workspace: c,
174
- identifier: f.identifier
175
- }),
176
- /* @__PURE__ */ q(ht, {
177
- text: Fe(f.identifier, f.title),
178
- label: i("branchName"),
179
- icon: /* @__PURE__ */ q(se, {}),
180
- size: "sm",
181
- variant: "ghost",
182
- success: i("copiedBranchName", { name: Fe(f.identifier, f.title) }),
183
- failure: i("copyFailed"),
184
- className: "max-sm:hidden"
185
- }),
186
- /* @__PURE__ */ q(M, { links: g }),
187
- /* @__PURE__ */ J("span", {
188
- className: "ml-auto flex items-center gap-3",
189
- children: [
190
- F.isPending && /* @__PURE__ */ q("span", {
191
- className: "text-xs text-muted-foreground",
192
- children: s("saving")
193
- }),
194
- /* @__PURE__ */ q(Ee, {
195
- workspace: c,
196
- others: N
197
- }),
198
- /* @__PURE__ */ q(Nt, {
199
- items: () => [...le([f]), ...C ? [{
200
- label: i("deleteIssue"),
201
- destructive: !0,
202
- onClick: () => E({
203
- title: i("deleteTitle", { identifier: f.identifier }),
204
- description: i("deleteDescription"),
205
- confirmLabel: i("deleteIssue"),
206
- onConfirm: () => A.mutateAsync()
207
- })
208
- }] : []],
209
- label: s("moreActionsFor", { name: f.identifier }),
210
- visible: !0
211
- })
212
- ]
213
- }),
214
- F.isError && /* @__PURE__ */ q(_t, {
215
- inline: !0,
216
- className: "ml-auto text-xs",
217
- children: o(F.error)
218
- })
219
- ]
220
- }),
221
- D,
222
- /* @__PURE__ */ J("div", {
223
- className: "flex min-h-0 flex-1 flex-col overflow-y-auto md:flex-row md:overflow-hidden",
224
- children: [/* @__PURE__ */ q("div", {
225
- className: "min-w-0 px-4 md:flex-1 md:overflow-y-auto md:px-8",
226
- children: /* @__PURE__ */ J("article", {
227
- className: "mx-auto w-full max-w-reading pt-6 pb-24 md:pt-8",
228
- children: [
229
- /* @__PURE__ */ J(Qt.Provider, {
230
- value: y,
231
- children: [
232
- f.triage && /* @__PURE__ */ q(It, {
233
- workspace: c,
234
- issue: f
235
- }),
236
- f.archivedAt && /* @__PURE__ */ q(pt, {
237
- tone: "muted",
238
- icon: /* @__PURE__ */ q(Pt, {}),
239
- className: "mb-5",
240
- children: /* @__PURE__ */ J("span", {
241
- className: "flex flex-wrap items-center gap-x-3 gap-y-1",
242
- children: [i("archivedNote", { when: a.day(f.archivedAt.slice(0, 10)) }), /* @__PURE__ */ q(z, {
243
- type: "button",
244
- size: "sm",
245
- onClick: () => k.mutate(),
246
- loading: k.isPending,
247
- children: i("restore")
248
- })]
249
- })
250
- }),
251
- /* @__PURE__ */ q(Lt, {
252
- issue: f,
253
- onSave: (e) => F.mutate({ title: e })
254
- }),
255
- /* @__PURE__ */ q(Te, {
256
- workspace: c,
257
- others: N,
258
- field: "title"
259
- }),
260
- /* @__PURE__ */ q(Rt, {
261
- workspace: c,
262
- issue: f
263
- }),
264
- /* @__PURE__ */ q(Te, {
265
- workspace: c,
266
- others: N,
267
- field: "body"
268
- }),
269
- /* @__PURE__ */ q(ie, {
270
- workspace: c,
271
- issue: f
272
- }),
273
- /* @__PURE__ */ q(O, {
274
- workspace: c,
275
- identifier: f.identifier,
276
- enabled: !!P?.customerRequestsEnabled
277
- }),
278
- /* @__PURE__ */ q(zt, {
279
- workspace: c,
280
- identifier: l
281
- }),
282
- /* @__PURE__ */ q(ee, {
283
- workspace: c,
284
- identifier: l
285
- }),
286
- /* @__PURE__ */ q(ne, {
287
- workspace: c,
288
- identifier: l,
289
- title: f.title
290
- }),
291
- /* @__PURE__ */ q(oe, {
292
- workspace: c,
293
- identifier: l
294
- }),
295
- /* @__PURE__ */ q(ae, {
296
- workspace: c,
297
- identifier: l
298
- }),
299
- /* @__PURE__ */ q(re, {
300
- workspace: c,
301
- identifier: l
302
- }),
303
- /* @__PURE__ */ q(x, {
304
- workspace: c,
305
- identifier: l
306
- }),
307
- /* @__PURE__ */ q(Kt, {
308
- workspace: c,
309
- identifier: l,
310
- others: N
311
- })
312
- ]
313
- }),
314
- /* @__PURE__ */ q(Gt, {
315
- workspace: c,
316
- identifier: l
317
- }),
318
- /* @__PURE__ */ q(w, {
319
- workspace: c,
320
- identifier: l
321
- })
322
- ]
323
- })
324
- }), /* @__PURE__ */ q(Bt, {
325
- workspace: c,
326
- issue: f,
327
- team: P,
328
- open: I,
329
- setOpen: L,
330
- update: (e) => F.mutate(e)
331
- })]
332
- })
333
- ]
8
+ function o() {
9
+ let { workspace: o, identifier: s } = r.useParams(), { data: c } = a(e(o, s));
10
+ return n(`${c.identifier} ${c.title}`), /* @__PURE__ */ i(t, {
11
+ workspace: o,
12
+ identifier: s
334
13
  });
335
14
  }
336
- function It({ workspace: n, issue: r }) {
337
- let i = G("triage"), a = jt(), o = Z(), s = st(n, r.teamId), c = Y({
338
- mutationFn: async (i) => t(await e.POST("/api/v1/workspaces/{workspace}/issues/{identifier}/triage", {
339
- params: { path: {
340
- workspace: n,
341
- identifier: r.identifier
342
- } },
343
- body: { decision: i }
344
- })),
345
- onSuccess: () => o.invalidateQueries({ queryKey: [
346
- "workspace",
347
- n,
348
- "issues"
349
- ] })
350
- });
351
- return /* @__PURE__ */ J("div", {
352
- className: "mb-5 flex flex-wrap items-center gap-3 rounded-xl border border-border bg-muted/40 px-4 py-3",
353
- children: [
354
- /* @__PURE__ */ q(_e, { className: "size-4 shrink-0 text-muted-foreground" }),
355
- /* @__PURE__ */ q("p", {
356
- className: "min-w-0 flex-1 text-sm",
357
- children: i("waiting")
358
- }),
359
- c.error && /* @__PURE__ */ q("span", {
360
- className: "text-xs text-danger",
361
- children: a(c.error)
362
- }),
363
- s && /* @__PURE__ */ J("span", {
364
- className: "flex gap-2",
365
- children: [/* @__PURE__ */ q(z, {
366
- variant: "outline",
367
- size: "sm",
368
- disabled: c.isPending,
369
- onClick: () => c.mutate("decline"),
370
- children: i("decline")
371
- }), /* @__PURE__ */ q(z, {
372
- variant: "primary",
373
- size: "sm",
374
- loading: c.isPending && c.variables === "accept",
375
- onClick: () => c.mutate("accept"),
376
- children: i("accept")
377
- })]
378
- })
379
- ]
380
- });
381
- }
382
- function Lt({ issue: e, onSave: t }) {
383
- let n = G("issue"), r = Ot(Qt);
384
- return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("h1", {
385
- className: "sr-only",
386
- children: e.title
387
- }), /* @__PURE__ */ q(xt, {
388
- value: e.title,
389
- onCommit: t,
390
- onFocus: () => r("title"),
391
- onBlur: () => r(void 0),
392
- "aria-label": n("title")
393
- })] });
394
- }
395
- function Rt({ workspace: e, issue: t }) {
396
- let n = G("issue"), r = G("common"), i = Ot(Qt), { data: a } = Q(p), o = U(null), s = At(() => ({
397
- name: a?.user.name ?? n("someone"),
398
- color: Ie(a?.user.username ?? "")
399
- }), [
400
- a?.user.name,
401
- a?.user.username,
402
- n
403
- ]), { session: c, error: l } = Le({
404
- workspace: e,
405
- target: { issue: t.identifier },
406
- user: s,
407
- getMarkdown: o
408
- }), u = U(null), d = E(e, t.identifier), { data: f = [] } = X(h(e, t.identifier)), m = ot(e, "comment", at(t));
409
- return /* @__PURE__ */ J("div", {
410
- className: "group mt-4 min-h-32",
411
- children: [
412
- c ? /* @__PURE__ */ q(D, {
413
- session: c,
414
- user: s,
415
- getMarkdown: o,
416
- onFocus: () => i("body"),
417
- onBlur: () => i(void 0),
418
- onEditor: (e) => {
419
- u.current = e;
420
- },
421
- onFiles: (e, t) => d.upload(u.current, e, t),
422
- placeholder: n("addDescription"),
423
- label: r("description"),
424
- className: "min-h-32"
425
- }, `${c.generation}:${c.doc.guid}`) : /* @__PURE__ */ q(A, {
426
- value: t.body,
427
- editable: !1,
428
- className: "min-h-32"
429
- }),
430
- /* @__PURE__ */ q(_t, {
431
- className: "mt-1",
432
- children: l
433
- }),
434
- c && /* @__PURE__ */ J("div", {
435
- className: "mt-1 flex items-center justify-end gap-2",
436
- children: [/* @__PURE__ */ q(T, {
437
- pending: d.pending,
438
- error: d.error
439
- }), /* @__PURE__ */ q(C, { onFiles: (e) => d.upload(u.current, e) })]
440
- }),
441
- /* @__PURE__ */ q(De, {
442
- workspace: e,
443
- identifier: t.identifier,
444
- reactions: f,
445
- me: a?.user.username,
446
- disabled: !m
447
- })
448
- ]
449
- });
450
- }
451
- function zt({ workspace: e, identifier: t }) {
452
- let n = G("issue"), { data: r } = Q(l(e, t)), i = H(), a = He(e);
453
- return r.length === 0 ? null : /* @__PURE__ */ J("section", {
454
- className: "mt-6",
455
- "aria-label": n("docs"),
456
- children: [/* @__PURE__ */ q("h2", {
457
- className: "text-xs font-medium text-muted-foreground",
458
- children: n("docs")
459
- }), /* @__PURE__ */ q("ul", {
460
- className: "mt-1 flex flex-wrap gap-1.5",
461
- children: r.map((t) => /* @__PURE__ */ q("li", { children: /* @__PURE__ */ J(R, {
462
- to: "/$workspace/docs/$doc",
463
- params: {
464
- workspace: e,
465
- doc: Ve(t)
466
- },
467
- onContextMenu: (e) => i(e, a(t)),
468
- className: `${Ct({ size: "sm" })} max-w-72`,
469
- children: [/* @__PURE__ */ q(fe, { className: "size-3.5 text-muted-foreground" }), /* @__PURE__ */ q("span", {
470
- className: "truncate",
471
- children: t.title
472
- })]
473
- }) }, t.id))
474
- })]
475
- });
476
- }
477
- function Bt({ workspace: n, issue: r, team: i, open: a, setOpen: o, update: s }) {
478
- let c = G("relations"), l = i?.key, d = G("issue.properties"), p = G("common"), m = ve(), { data: h = [] } = X({
479
- ...g(n, l ?? ""),
480
- enabled: !!l
481
- }), { data: _ = [] } = X(f(n)), { data: v = [] } = X(u(n, r.identifier)), { nameOf: y, actorName: b, avatarOf: x } = tt(n), S = Z(), C = Y({
482
- mutationFn: async (r) => t(await e.POST("/api/v1/workspaces/{workspace}/labels", {
483
- params: { path: { workspace: n } },
484
- body: {
485
- name: r,
486
- color: Vt[_.length % Vt.length] ?? "#d73a4a"
487
- }
488
- })),
489
- onSuccess: (e) => {
490
- S.invalidateQueries({ queryKey: f(n).queryKey }), s({ addLabels: [e.id] });
491
- }
492
- }), w = r.assignees.map(je), T = Ne(n, !0), E = (e) => (t) => o(t ? e : null), D = rt(a === "assignees", () => o(null)), O = rt(a === "labels", () => o(null)), A = "flex h-8 w-full items-center gap-2 rounded-md px-2 text-sm hover:bg-muted", j = H(), ee = We(n), M = ct(), N = (e, t) => {
493
- e.stopPropagation(), j(e, t);
494
- };
495
- return /* @__PURE__ */ J("aside", {
496
- className: "order-first grid shrink-0 grid-cols-2 gap-4 border-b border-border px-4 py-4 md:order-none md:block md:w-72 md:space-y-5 md:overflow-y-auto md:border-b-0 md:border-l md:py-6",
497
- "aria-label": d("title"),
498
- onContextMenu: (e) => j(e, ee([r])),
499
- children: [
500
- /* @__PURE__ */ q($, {
501
- label: p("status"),
502
- shortcut: "S",
503
- children: /* @__PURE__ */ q(B, {
504
- "aria-label": p("status"),
505
- open: a === "status",
506
- onOpenChange: E("status"),
507
- items: h.map((e) => ({
508
- value: e.id,
509
- label: e.name,
510
- icon: /* @__PURE__ */ q(ge, {
511
- category: e.category,
512
- review: e.review,
513
- step: e.step
514
- })
515
- })),
516
- value: r.status.id,
517
- onValueChange: (e) => e !== null && e !== r.status.id && s({ statusId: e }),
518
- placeholder: d("changeStatus"),
519
- trigger: /* @__PURE__ */ J("button", {
520
- type: "button",
521
- className: A,
522
- children: [/* @__PURE__ */ q(ge, {
523
- category: r.status.category,
524
- review: r.status.review,
525
- step: r.status.step
526
- }), r.status.name]
527
- })
528
- })
529
- }),
530
- /* @__PURE__ */ q(Wt, {
531
- workspace: n,
532
- issue: r,
533
- update: s,
534
- row: A
535
- }),
536
- /* @__PURE__ */ q($, {
537
- label: p("priority"),
538
- shortcut: "P",
539
- children: /* @__PURE__ */ q(B, {
540
- "aria-label": p("priority"),
541
- open: a === "priority",
542
- onOpenChange: E("priority"),
543
- items: [
544
- 1,
545
- 2,
546
- 3,
547
- 4,
548
- 0
549
- ].map((e) => ({
550
- value: String(e),
551
- label: m[e] ?? "",
552
- icon: /* @__PURE__ */ q(me, { priority: e })
553
- })),
554
- value: String(r.priority),
555
- onValueChange: (e) => e !== null && s({ priority: Number(e) }),
556
- placeholder: d("setPriority"),
557
- trigger: /* @__PURE__ */ J("button", {
558
- type: "button",
559
- className: A,
560
- children: [/* @__PURE__ */ q(me, { priority: r.priority }), m[r.priority]]
561
- })
562
- })
563
- }),
564
- /* @__PURE__ */ q($, {
565
- label: d("assignees"),
566
- shortcut: "A",
567
- children: /* @__PURE__ */ q(B, {
568
- "aria-label": d("assignees"),
569
- multiple: !0,
570
- open: a === "assignees",
571
- onOpenChange: E("assignees"),
572
- items: T,
573
- value: w,
574
- onValueChange: (e) => {
575
- let t = e.filter((e) => !w.includes(e)), n = w.filter((t) => !e.includes(t));
576
- s({
577
- ...t.length > 0 && { addAssignees: t.map(Me) },
578
- ...n.length > 0 && { removeAssignees: n.map(Me) }
579
- }), D();
580
- },
581
- placeholder: d("assignTo"),
582
- trigger: /* @__PURE__ */ J("button", {
583
- type: "button",
584
- className: `${A} h-auto min-h-8 flex-wrap py-1`,
585
- children: [r.assignees.length === 0 && /* @__PURE__ */ q("span", {
586
- className: "text-muted-foreground",
587
- children: d("unassigned")
588
- }), r.assignees.map((e) => {
589
- let t = y(e.kind, e.handle);
590
- return /* @__PURE__ */ q("span", {
591
- onContextMenu: (r) => N(r, [{
592
- label: d("unassign", { name: t }),
593
- onClick: () => s({ removeAssignees: [{
594
- kind: e.kind,
595
- handle: e.handle
596
- }] })
597
- }, {
598
- label: d("viewTheirIssues"),
599
- onClick: () => M({
600
- to: "/$workspace/issues",
601
- params: { workspace: n },
602
- search: {
603
- assignee: e.handle,
604
- ...e.kind === "agent" && { assigneeKind: "agent" }
605
- }
606
- })
607
- }]),
608
- className: "flex items-center gap-1.5",
609
- children: /* @__PURE__ */ J(ye, {
610
- workspace: n,
611
- kind: e.kind,
612
- handle: e.handle,
613
- className: "flex items-center gap-1.5",
614
- children: [/* @__PURE__ */ q(ft, {
615
- ...Pe(e.kind),
616
- name: t,
617
- src: x(e.kind, e.handle),
618
- size: "xs",
619
- decorative: !0
620
- }), t]
621
- })
622
- }, `${e.kind}:${e.handle}`);
623
- })]
624
- })
625
- })
626
- }),
627
- /* @__PURE__ */ q($, {
628
- label: p("labels"),
629
- shortcut: "L",
630
- children: /* @__PURE__ */ q(B, {
631
- "aria-label": p("labels"),
632
- multiple: !0,
633
- open: a === "labels",
634
- onOpenChange: E("labels"),
635
- items: _.map((e) => ({
636
- value: e.id,
637
- label: e.name,
638
- icon: /* @__PURE__ */ J("span", {
639
- className: "flex items-center gap-2",
640
- children: [/* @__PURE__ */ q(nt, {}), /* @__PURE__ */ q("span", {
641
- className: "size-2.5 rounded-full",
642
- style: { background: e.color }
643
- })]
644
- })
645
- })),
646
- value: r.labels.map((e) => e.id),
647
- onValueChange: (e) => {
648
- O();
649
- let t = r.labels.map((e) => e.id), n = e.filter((e) => !t.includes(e)), i = t.filter((t) => !e.includes(t));
650
- s({
651
- ...n.length > 0 && { addLabels: n },
652
- ...i.length > 0 && { removeLabels: i }
653
- });
654
- },
655
- onCreate: (e) => C.mutate(e),
656
- placeholder: d("addLabels"),
657
- trigger: /* @__PURE__ */ J("button", {
658
- type: "button",
659
- className: `${A} h-auto min-h-8 flex-wrap py-1`,
660
- children: [r.labels.length === 0 && /* @__PURE__ */ q("span", {
661
- className: "text-muted-foreground",
662
- children: d("noLabels")
663
- }), r.labels.map((e) => /* @__PURE__ */ J("span", {
664
- onContextMenu: (t) => N(t, [{
665
- label: d("removeLabel", { name: e.name }),
666
- onClick: () => s({ removeLabels: [e.id] })
667
- }, {
668
- label: d("viewLabelIssues"),
669
- onClick: () => M({
670
- to: "/$workspace/issues",
671
- params: { workspace: n },
672
- search: { label: e.name }
673
- })
674
- }]),
675
- title: e.name,
676
- className: "inline-flex max-w-full min-w-0 items-center gap-1 rounded-full border border-border px-2 py-0.5 text-xs",
677
- children: [/* @__PURE__ */ q("span", {
678
- className: "size-2 shrink-0 rounded-full",
679
- style: { background: e.color }
680
- }), /* @__PURE__ */ q("span", {
681
- className: "truncate",
682
- children: e.name
683
- })]
684
- }, e.id))]
685
- })
686
- })
687
- }),
688
- /* @__PURE__ */ q($, {
689
- label: c("parent"),
690
- children: /* @__PURE__ */ q(F, {
691
- workspace: n,
692
- issue: r,
693
- row: A
694
- })
695
- }),
696
- /* @__PURE__ */ q(Ut, {
697
- workspace: n,
698
- issue: r,
699
- team: i,
700
- update: s,
701
- row: A
702
- }),
703
- /* @__PURE__ */ q($, {
704
- label: d("created"),
705
- children: /* @__PURE__ */ J("p", {
706
- className: "flex items-center gap-2 px-2 text-sm",
707
- children: [/* @__PURE__ */ q(ye, {
708
- workspace: n,
709
- kind: r.creator.kind,
710
- handle: r.creator.handle,
711
- children: /* @__PURE__ */ q(ft, {
712
- ...Pe(r.creator.kind),
713
- name: b(r.creator),
714
- src: x(r.creator.kind, r.creator.handle),
715
- size: "xs",
716
- tooltip: r.creator.kind !== "user"
717
- })
718
- }), /* @__PURE__ */ q(bt, {
719
- value: r.createdAt,
720
- exact: "medium"
721
- })]
722
- })
723
- }),
724
- /* @__PURE__ */ q($, {
725
- label: d("timeInStatus"),
726
- children: /* @__PURE__ */ q(Oe, {
727
- workspace: n,
728
- identifier: r.identifier
729
- })
730
- }),
731
- /* @__PURE__ */ q(k, {
732
- workspace: n,
733
- issue: r,
734
- label: (e, t, n) => /* @__PURE__ */ q($, {
735
- label: e,
736
- children: t
737
- }, n)
738
- }),
739
- v.length > 0 && /* @__PURE__ */ q($, {
740
- label: d("syncedWith"),
741
- children: /* @__PURE__ */ q(te, { links: v })
742
- })
743
- ]
744
- });
745
- }
746
- var Vt = [
747
- "#d73a4a",
748
- "#2f8a57",
749
- "#8250df",
750
- "#0a7ea4",
751
- "#c2185b",
752
- "#57606a",
753
- "#1a7f37"
754
- ];
755
- function Ht({ workspace: e, origin: t, className: n }) {
756
- let r = "size-3.5 shrink-0 text-muted-foreground", i = t.title.replace(/[*_`#>[\]]/g, "").replace(/\s+/g, " ").trim();
757
- switch (t.kind) {
758
- case "decision": return /* @__PURE__ */ J(R, {
759
- to: "/$workspace/issues/$identifier",
760
- params: {
761
- workspace: e,
762
- identifier: t.key
763
- },
764
- className: n,
765
- children: [/* @__PURE__ */ q(pe, { className: r }), /* @__PURE__ */ q(St, {
766
- content: i,
767
- overflowOnly: !0,
768
- children: /* @__PURE__ */ q("span", {
769
- className: "truncate",
770
- children: i
771
- })
772
- })]
773
- });
774
- case "area": return /* @__PURE__ */ J(S, {
775
- workspace: e,
776
- area: { key: t.key },
777
- className: n,
778
- children: [/* @__PURE__ */ q(L, { className: r }), /* @__PURE__ */ q("span", {
779
- className: "truncate",
780
- children: i
781
- })]
782
- });
783
- default: return /* @__PURE__ */ J(R, {
784
- to: "/$workspace/docs/$doc",
785
- params: {
786
- workspace: e,
787
- doc: t.key
788
- },
789
- className: n,
790
- children: [/* @__PURE__ */ q(fe, { className: r }), /* @__PURE__ */ q("span", {
791
- className: "truncate",
792
- children: i
793
- })]
794
- });
795
- }
796
- }
797
- function Ut({ workspace: e, issue: t, team: n, update: r, row: a }) {
798
- let o = G("planning"), c = G("flow"), l = ut(), u = we(), { data: d = [] } = X(m(e)), f = d.find((e) => e.id === t.project?.id), { data: p = [] } = X({
799
- ...s(e, n?.key ?? ""),
800
- enabled: !!n?.cyclesEnabled
801
- }), h = n?.estimateScale ?? "none", g = t.status.category === "completed" || t.status.category === "canceled", _ = (e) => e.name ? o("cycleNamed", {
802
- number: e.number,
803
- name: e.name
804
- }) : o("cycle", { number: e.number }), v = p.filter((e) => e.state !== "past" || e.id === t.cycle?.id), { data: y = [] } = X(i(e)), b = y.filter((e) => !e.teamId || e.teamId === t.teamId);
805
- return /* @__PURE__ */ J(K, { children: [
806
- n && n.flow.length > 0 && /* @__PURE__ */ q($, {
807
- label: c("stage"),
808
- children: /* @__PURE__ */ q(V, {
809
- "aria-label": c("stage"),
810
- value: t.stage ?? "",
811
- onValueChange: (e) => r({ stage: e ?? "" }),
812
- items: [{
813
- value: "",
814
- label: c("notInFlow")
815
- }, ...n.flow.map((e) => ({
816
- value: e.stage,
817
- label: c(`stages.${e.stage}`)
818
- }))],
819
- trigger: /* @__PURE__ */ J("button", {
820
- type: "button",
821
- className: a,
822
- children: [/* @__PURE__ */ q(ue, { className: "size-3.5 shrink-0 text-muted-foreground" }), t.stage ? /* @__PURE__ */ q("span", {
823
- className: "truncate",
824
- children: c(`stages.${t.stage}`)
825
- }) : /* @__PURE__ */ q("span", {
826
- className: "text-muted-foreground",
827
- children: c("notInFlow")
828
- })]
829
- })
830
- })
831
- }),
832
- /* @__PURE__ */ q($, {
833
- label: o("area"),
834
- children: /* @__PURE__ */ q(V, {
835
- "aria-label": o("area"),
836
- value: t.area?.key ?? "",
837
- onValueChange: (e) => r({ area: e ?? "" }),
838
- items: [{
839
- value: "",
840
- label: o("noArea")
841
- }, ...b.map((e) => ({
842
- value: e.key,
843
- label: e.title,
844
- ...e.status === "proposed" && { description: o("proposedArea") }
845
- }))],
846
- trigger: /* @__PURE__ */ J("button", {
847
- type: "button",
848
- className: a,
849
- children: [/* @__PURE__ */ q(L, { className: "size-3.5 shrink-0 text-muted-foreground" }), t.area ? /* @__PURE__ */ q("span", {
850
- className: "truncate",
851
- children: t.area.title
852
- }) : /* @__PURE__ */ q("span", {
853
- className: "text-muted-foreground",
854
- children: o("noArea")
855
- })]
856
- })
857
- })
858
- }),
859
- t.origin && /* @__PURE__ */ q($, {
860
- label: o("startedFrom"),
861
- children: /* @__PURE__ */ q(Ht, {
862
- workspace: e,
863
- origin: t.origin,
864
- className: a
865
- })
866
- }),
867
- /* @__PURE__ */ q($, {
868
- label: o("project"),
869
- children: /* @__PURE__ */ q(V, {
870
- "aria-label": o("project"),
871
- value: t.project?.id ?? "",
872
- onValueChange: (e) => r({ projectId: e ?? "" }),
873
- items: [{
874
- value: "",
875
- label: o("noProject")
876
- }, ...d.map((e) => ({
877
- value: e.id,
878
- label: e.name,
879
- icon: /* @__PURE__ */ q(xe, { status: e.status })
880
- }))],
881
- trigger: /* @__PURE__ */ J("button", {
882
- type: "button",
883
- className: a,
884
- children: [/* @__PURE__ */ q(he, { className: "size-3.5 shrink-0 text-muted-foreground" }), t.project ? /* @__PURE__ */ q("span", {
885
- className: "truncate",
886
- children: t.project.name
887
- }) : /* @__PURE__ */ q("span", {
888
- className: "text-muted-foreground",
889
- children: o("noProject")
890
- })]
891
- })
892
- })
893
- }),
894
- t.project && /* @__PURE__ */ q($, {
895
- label: o("milestone"),
896
- children: /* @__PURE__ */ q(V, {
897
- "aria-label": o("milestone"),
898
- value: t.milestone?.id ?? "",
899
- onValueChange: (e) => r({ milestoneId: e ?? "" }),
900
- items: [{
901
- value: "",
902
- label: o("noMilestone")
903
- }, ...(f?.milestones ?? []).map((e) => ({
904
- value: e.id,
905
- label: e.name,
906
- ...e.targetDate && { description: l.day(e.targetDate) }
907
- }))],
908
- trigger: /* @__PURE__ */ q("button", {
909
- type: "button",
910
- className: a,
911
- children: t.milestone ? /* @__PURE__ */ q("span", {
912
- className: "truncate",
913
- children: t.milestone.name
914
- }) : /* @__PURE__ */ q("span", {
915
- className: "text-muted-foreground",
916
- children: o("noMilestone")
917
- })
918
- })
919
- })
920
- }),
921
- n?.cyclesEnabled && /* @__PURE__ */ q($, {
922
- label: o("cycleLabel"),
923
- children: /* @__PURE__ */ q(V, {
924
- "aria-label": o("cycleLabel"),
925
- value: t.cycle?.id ?? "",
926
- onValueChange: (e) => r({ cycleId: e ?? "" }),
927
- items: [{
928
- value: "",
929
- label: o("noCycle")
930
- }, ...v.map((e) => ({
931
- value: e.id,
932
- label: _(e),
933
- description: o("stateAndDates", {
934
- state: o(`states.${e.state}`),
935
- dates: l.dayRange(e.startsOn, e.endsOn)
936
- })
937
- }))],
938
- trigger: /* @__PURE__ */ J("button", {
939
- type: "button",
940
- className: a,
941
- children: [/* @__PURE__ */ q(ue, { className: "size-3.5 shrink-0 text-muted-foreground" }), t.cycle ? /* @__PURE__ */ q("span", {
942
- className: "truncate",
943
- children: _(t.cycle)
944
- }) : /* @__PURE__ */ q("span", {
945
- className: "text-muted-foreground",
946
- children: o("noCycle")
947
- })]
948
- })
949
- })
950
- }),
951
- (h !== "none" || !!t.estimate) && /* @__PURE__ */ q($, {
952
- label: o("estimate"),
953
- children: /* @__PURE__ */ q(V, {
954
- "aria-label": o("estimate"),
955
- value: t.estimate ?? 0,
956
- onValueChange: (e) => r({ estimate: e ?? 0 }),
957
- items: [{
958
- value: 0,
959
- label: o("noEstimate")
960
- }, ...Ce(h).map((e) => ({
961
- value: e,
962
- label: u(e, h)
963
- }))],
964
- trigger: /* @__PURE__ */ J("button", {
965
- type: "button",
966
- className: a,
967
- children: [/* @__PURE__ */ q(de, { className: "size-3.5 shrink-0 text-muted-foreground" }), t.estimate ? u(t.estimate, h) : /* @__PURE__ */ q("span", {
968
- className: "text-muted-foreground",
969
- children: o("noEstimate")
970
- })]
971
- })
972
- })
973
- }),
974
- /* @__PURE__ */ q($, {
975
- label: o("dueDate"),
976
- children: /* @__PURE__ */ J("div", {
977
- className: "flex items-center",
978
- children: [/* @__PURE__ */ q(gt, {
979
- value: t.dueDate ?? "",
980
- onValueChange: (e) => r({ dueDate: e }),
981
- "aria-label": o("dueDate"),
982
- required: !0,
983
- trigger: /* @__PURE__ */ q("button", {
984
- type: "button",
985
- className: a,
986
- children: t.dueDate ? /* @__PURE__ */ q(be, {
987
- date: t.dueDate,
988
- closed: g
989
- }) : /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(ce, { className: "size-3.5 shrink-0 text-muted-foreground" }), /* @__PURE__ */ q("span", {
990
- className: "text-muted-foreground",
991
- children: o("noDueDate")
992
- })] })
993
- })
994
- }), t.dueDate && /* @__PURE__ */ q(vt, {
995
- variant: "ghost",
996
- icon: /* @__PURE__ */ q(le, { className: "size-3.5" }),
997
- label: o("clearDueDate"),
998
- onClick: () => r({ dueDate: "" })
999
- })]
1000
- })
1001
- }),
1002
- t.slaDueAt && !g && /* @__PURE__ */ q($, {
1003
- label: o("sla.label"),
1004
- children: /* @__PURE__ */ q("span", {
1005
- className: "flex h-7 items-center px-2",
1006
- children: /* @__PURE__ */ q(Se, {
1007
- issue: t,
1008
- team: n
1009
- })
1010
- })
1011
- })
1012
- ] });
1013
- }
1014
- function Wt({ workspace: e, issue: t, update: n, row: r }) {
1015
- let i = G("issueTypes"), a = Mt(), { data: o } = X(Ge(e)), { data: s } = X(ze(e)), { confirm: c, dialog: l } = Re(), [u, d] = W(!1), f = qe(o, t.teamId);
1016
- if (f.length === 0 && !t.type) return null;
1017
- let p = (e) => {
1018
- let r = f.find((t) => t.id === e), o = (s ?? []).filter((e) => Be(t.fields[e.id]) && !Ke(r, e.id));
1019
- if (!r || o.length === 0) return n({ typeId: e });
1020
- c({
1021
- title: i("hiddenTitle"),
1022
- description: i("hidden", {
1023
- type: r.name,
1024
- fields: a.list(o.map((e) => e.name))
1025
- }),
1026
- confirmLabel: i("change"),
1027
- destructive: !1,
1028
- onConfirm: async () => n({ typeId: e })
1029
- });
1030
- };
1031
- return /* @__PURE__ */ J($, {
1032
- label: i("type"),
1033
- children: [/* @__PURE__ */ q(B, {
1034
- "aria-label": i("type"),
1035
- open: u,
1036
- onOpenChange: d,
1037
- items: [{
1038
- value: "",
1039
- label: i("noType")
1040
- }, ...f.map((e) => ({
1041
- value: e.id,
1042
- label: e.name,
1043
- icon: /* @__PURE__ */ q(I, { type: e })
1044
- }))],
1045
- value: t.type?.id ?? "",
1046
- onValueChange: (e) => e !== null && e !== (t.type?.id ?? "") && p(e),
1047
- placeholder: i("type"),
1048
- trigger: /* @__PURE__ */ q("button", {
1049
- type: "button",
1050
- className: r,
1051
- children: t.type ? /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(I, { type: t.type }), t.type.name] }) : /* @__PURE__ */ q("span", {
1052
- className: "text-muted-foreground",
1053
- children: i("noType")
1054
- })
1055
- })
1056
- }), l]
1057
- });
1058
- }
1059
- function $({ label: e, shortcut: t, children: n }) {
1060
- return /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ J("p", {
1061
- className: "mb-1 flex items-center justify-between px-2 text-xs text-muted-foreground",
1062
- children: [e, t && /* @__PURE__ */ q(yt, {
1063
- keys: t,
1064
- size: "xs",
1065
- className: "hidden md:inline-flex"
1066
- })]
1067
- }), n] });
1068
- }
1069
- function Gt({ workspace: e, identifier: t }) {
1070
- let n = G("issue.activity"), { data: r } = Q(c(e, t)), [i, a] = W(!1), o = At(() => {
1071
- let e = [];
1072
- for (let t of r) {
1073
- if (t.type.startsWith("comment.") || t.type.startsWith("issue.reaction_") || t.type === "issue.triage_accepted" && t.data.pullRequest) continue;
1074
- let n = e.at(-1);
1075
- t.type === "issue.body_changed" && n?.type === "issue.body_changed" && n.actor.handle === t.actor.handle ? e[e.length - 1] = t : e.push(t);
1076
- }
1077
- return e;
1078
- }, [r]), s = i ? 0 : Math.max(0, o.length - 5);
1079
- return /* @__PURE__ */ J("section", {
1080
- className: "mt-10",
1081
- "aria-label": n("title"),
1082
- children: [
1083
- /* @__PURE__ */ q("h2", {
1084
- className: "text-base font-semibold",
1085
- children: n("title")
1086
- }),
1087
- s > 0 && /* @__PURE__ */ q("button", {
1088
- type: "button",
1089
- onClick: () => a(!0),
1090
- className: "mt-3 text-xs text-muted-foreground hover:text-foreground",
1091
- children: n("showEarlier", { count: s })
1092
- }),
1093
- /* @__PURE__ */ q(v, {
1094
- className: "mt-3",
1095
- children: o.slice(s).map((t) => /* @__PURE__ */ q(P, {
1096
- workspace: e,
1097
- event: t
1098
- }, t.id))
1099
- })
1100
- ]
1101
- });
1102
- }
1103
- function Kt({ workspace: e, identifier: t, others: n }) {
1104
- let r = G("issue.comments"), { data: i } = Q(o(e, t)), { data: a = [] } = X(u(e, t)), s = At(() => {
1105
- let e = i.filter((e) => !e.parentId);
1106
- return e.sort((e, t) => Number(qt(t)) - Number(qt(e))), e.map((e) => ({
1107
- root: e,
1108
- replies: i.filter((t) => t.parentId === e.id)
1109
- }));
1110
- }, [i]), [c, l] = W(null), d = i.filter((e) => !e.deletedAt && !qt(e)).length;
1111
- return /* @__PURE__ */ J("section", {
1112
- className: "mt-12 border-t border-border pt-6",
1113
- "aria-label": r("title"),
1114
- children: [
1115
- /* @__PURE__ */ J("h2", {
1116
- className: "text-base font-semibold",
1117
- children: [
1118
- r("title"),
1119
- " ",
1120
- d > 0 && /* @__PURE__ */ q("span", {
1121
- className: "font-normal text-muted-foreground",
1122
- children: d
1123
- })
1124
- ]
1125
- }),
1126
- /* @__PURE__ */ q("div", {
1127
- className: "mt-4 space-y-3",
1128
- children: s.map(({ root: n, replies: i }) => {
1129
- let o = qt(n) ? n.sharedWith : void 0, s = o ? et(o).source : void 0;
1130
- return /* @__PURE__ */ J(mt, {
1131
- size: "fill",
1132
- padding: "none",
1133
- highlight: !!o,
1134
- render: /* @__PURE__ */ q("article", {
1135
- id: `comment-${n.id}`,
1136
- "aria-label": s && r("sharedThreadLabel", { source: s })
1137
- }),
1138
- children: [
1139
- o && s ? /* @__PURE__ */ q(N, {
1140
- source: s,
1141
- link: a.find((e) => e.connector === o)
1142
- }) : /* @__PURE__ */ q(Yt, {
1143
- workspace: e,
1144
- identifier: t,
1145
- comment: n,
1146
- onReply: () => l(n.id)
1147
- }),
1148
- i.length > 0 && /* @__PURE__ */ q("ol", {
1149
- className: o ? "" : "border-t border-border/70",
1150
- children: i.map((r) => /* @__PURE__ */ q("li", {
1151
- id: `comment-${r.id}`,
1152
- className: "border-b border-border/50 last:border-b-0",
1153
- children: /* @__PURE__ */ q(Yt, {
1154
- workspace: e,
1155
- identifier: t,
1156
- comment: r,
1157
- onReply: () => l(n.id)
1158
- })
1159
- }, r.id))
1160
- }),
1161
- /* @__PURE__ */ q("div", {
1162
- className: "border-t border-border/70 px-3 py-2",
1163
- children: c === n.id ? /* @__PURE__ */ q(Zt, {
1164
- workspace: e,
1165
- identifier: t,
1166
- parentId: n.id,
1167
- publicOn: s,
1168
- autofocus: !0,
1169
- onDone: () => l(null)
1170
- }) : /* @__PURE__ */ q("button", {
1171
- type: "button",
1172
- onClick: () => l(n.id),
1173
- className: "w-full text-left text-xs text-muted-foreground hover:text-foreground",
1174
- children: s ? r("replyPublic", { source: s }) : r("replyPlaceholder")
1175
- })
1176
- })
1177
- ]
1178
- }, n.id);
1179
- })
1180
- }),
1181
- /* @__PURE__ */ q(mt, {
1182
- size: "fill",
1183
- padding: "sm",
1184
- focusWithin: !0,
1185
- className: "mt-4",
1186
- children: /* @__PURE__ */ q(Zt, {
1187
- workspace: e,
1188
- identifier: t
1189
- })
1190
- }),
1191
- /* @__PURE__ */ q("div", {
1192
- className: "mt-2",
1193
- children: /* @__PURE__ */ q(Te, {
1194
- workspace: e,
1195
- others: n,
1196
- field: "comment"
1197
- })
1198
- })
1199
- ]
1200
- });
1201
- }
1202
- var qt = (e) => !!e.sharedWith && !e.parentId;
1203
- function Jt({ comment: e }) {
1204
- let t = G("issue.comments");
1205
- return e.author.kind === "connector" ? /* @__PURE__ */ q("span", {
1206
- className: "rounded border border-border px-1.5 py-px text-[10px] text-muted-foreground",
1207
- children: t("via", { source: et(e.author.handle).source })
1208
- }) : null;
1209
- }
1210
- function Yt({ workspace: r, identifier: i, comment: a, onReply: o }) {
1211
- let s = G("issue.comments"), c = G("common"), { actorName: l, avatarOf: u } = tt(r), { data: d } = Q(p), { data: f = [] } = X(h(r, i)), m = ot(r, "comment", { team: i.slice(0, i.lastIndexOf("-")) }), g = Z(), _ = H(), [v, b] = W(!1), [x, S] = W(a.body), [C, w] = W(!1), D = U(null), O = E(r, i), k = a.author.kind === "user" && a.author.handle === d?.user.username, j = { path: {
1212
- workspace: r,
1213
- identifier: i,
1214
- commentId: a.id
1215
- } }, ee = () => n(g, r, i), M = Y({
1216
- mutationFn: async () => t(await e.PATCH("/api/v1/workspaces/{workspace}/issues/{identifier}/comments/{commentId}", {
1217
- params: j,
1218
- body: { body: x }
1219
- })),
1220
- onSuccess: () => {
1221
- b(!1), ee();
1222
- }
1223
- }), te = Y({
1224
- mutationFn: async () => t(await e.DELETE("/api/v1/workspaces/{workspace}/issues/{identifier}/comments/{commentId}", { params: j })),
1225
- onSuccess: ee
1226
- });
1227
- if (a.deletedAt) return /* @__PURE__ */ q("p", {
1228
- className: "px-3 py-2.5 text-xs text-muted-foreground italic",
1229
- children: s("deleted")
1230
- });
1231
- let N = `${Ue(r, i)}#comment-${a.id}`, ne = [
1232
- {
1233
- label: s("reply"),
1234
- onClick: o
1235
- },
1236
- Ze(c("copyLink"), N),
1237
- Ze(s("copyText"), a.body),
1238
- ...k ? [
1239
- wt,
1240
- {
1241
- label: s("edit"),
1242
- onClick: () => {
1243
- S(a.body), b(!0);
1244
- }
1245
- },
1246
- {
1247
- label: c("delete"),
1248
- destructive: !0,
1249
- onClick: () => w(!0)
1250
- }
1251
- ] : []
1252
- ];
1253
- return /* @__PURE__ */ J("div", {
1254
- className: "group px-3 py-2.5",
1255
- onContextMenu: (e) => !v && _(e, ne),
1256
- children: [/* @__PURE__ */ J("div", {
1257
- className: "flex items-center gap-2 text-xs",
1258
- children: [
1259
- /* @__PURE__ */ J(y, {
1260
- workspace: r,
1261
- actor: a.author,
1262
- className: "flex items-center gap-2 font-medium hover:underline",
1263
- children: [/* @__PURE__ */ q(ft, {
1264
- ...Pe(a.author.kind),
1265
- name: l(a.author),
1266
- src: u(a.author.kind, a.author.handle),
1267
- size: "xs",
1268
- decorative: !0
1269
- }), l(a.author)]
1270
- }),
1271
- /* @__PURE__ */ q(Jt, { comment: a }),
1272
- /* @__PURE__ */ J("span", {
1273
- className: "text-muted-foreground",
1274
- children: [/* @__PURE__ */ q(bt, {
1275
- value: a.createdAt,
1276
- exact: "medium"
1277
- }), a.updatedAt !== a.createdAt && /* @__PURE__ */ J(K, { children: [" ", s("edited")] })]
1278
- }),
1279
- !C && !v && /* @__PURE__ */ q(Nt, {
1280
- items: ne,
1281
- className: "ml-auto"
1282
- }),
1283
- C && /* @__PURE__ */ J("span", {
1284
- className: "ml-auto flex gap-2 text-muted-foreground",
1285
- children: [
1286
- /* @__PURE__ */ q("span", { children: s("confirmDelete") }),
1287
- /* @__PURE__ */ q("button", {
1288
- type: "button",
1289
- className: "text-danger hover:underline",
1290
- onClick: () => te.mutate(),
1291
- children: c("delete")
1292
- }),
1293
- /* @__PURE__ */ q("button", {
1294
- type: "button",
1295
- className: "hover:underline",
1296
- onClick: () => w(!1),
1297
- children: s("keep")
1298
- })
1299
- ]
1300
- })
1301
- ]
1302
- }), /* @__PURE__ */ q("div", {
1303
- className: "mt-1",
1304
- children: v ? /* @__PURE__ */ J(K, { children: [
1305
- /* @__PURE__ */ q(A, {
1306
- value: x,
1307
- onChange: S,
1308
- onSubmit: () => M.mutate(),
1309
- autofocus: !0,
1310
- label: s("editLabel"),
1311
- onEditor: (e) => {
1312
- D.current = e;
1313
- },
1314
- onFiles: (e, t) => O.upload(D.current, e, t)
1315
- }),
1316
- /* @__PURE__ */ q(T, {
1317
- pending: O.pending,
1318
- error: O.error
1319
- }),
1320
- /* @__PURE__ */ J("div", {
1321
- className: "mt-2 flex justify-end gap-2",
1322
- children: [/* @__PURE__ */ q(z, {
1323
- type: "button",
1324
- variant: "ghost",
1325
- size: "sm",
1326
- onClick: () => b(!1),
1327
- children: c("cancel")
1328
- }), /* @__PURE__ */ q(z, {
1329
- type: "button",
1330
- variant: "primary",
1331
- size: "sm",
1332
- onClick: () => M.mutate(),
1333
- disabled: !x.trim() || O.pending > 0,
1334
- children: c("save")
1335
- })]
1336
- })
1337
- ] }) : /* @__PURE__ */ J(K, { children: [
1338
- /* @__PURE__ */ q(A, {
1339
- value: a.body,
1340
- editable: !1
1341
- }),
1342
- /* @__PURE__ */ q(Ae, {
1343
- workspace: r,
1344
- widgets: a.widgets
1345
- }),
1346
- /* @__PURE__ */ q(Xt, {
1347
- workspace: r,
1348
- identifier: i,
1349
- comment: a
1350
- }),
1351
- /* @__PURE__ */ q(De, {
1352
- workspace: r,
1353
- identifier: i,
1354
- commentId: a.id,
1355
- reactions: f,
1356
- me: d?.user.username,
1357
- disabled: !m
1358
- })
1359
- ] })
1360
- })]
1361
- });
1362
- }
1363
- function Xt({ workspace: e, identifier: t, comment: n }) {
1364
- let { data: r = [] } = X(a(e, t)), { actorName: i } = tt(e), o = r.filter((e) => e.page && e.commentId === n.id);
1365
- return o.length === 0 ? null : /* @__PURE__ */ q("div", {
1366
- className: "mt-2 space-y-2",
1367
- children: o.map((e) => /* @__PURE__ */ q(b, {
1368
- attachmentId: e.id,
1369
- name: e.name,
1370
- agent: i(n.author)
1371
- }, e.id))
1372
- });
1373
- }
1374
- function Zt({ workspace: r, identifier: i, parentId: a, publicOn: o, autofocus: s = !1, onDone: c }) {
1375
- let l = G("issue.comments"), u = jt(), d = G("common"), f = Ot(Qt), p = Z(), [m, h] = W(""), [g, _] = W(0), v = U(null), y = E(r, i), b = Y({
1376
- mutationFn: async () => t(await e.POST("/api/v1/workspaces/{workspace}/issues/{identifier}/comments", {
1377
- params: { path: {
1378
- workspace: r,
1379
- identifier: i
1380
- } },
1381
- body: {
1382
- body: m,
1383
- ...a && { parentId: a }
1384
- }
1385
- })),
1386
- onSuccess: () => {
1387
- h(""), _((e) => e + 1), n(p, r, i), c?.();
1388
- }
1389
- }), x = () => m.trim() && !b.isPending && y.pending === 0 && b.mutate();
1390
- return /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q(A, {
1391
- value: "",
1392
- onChange: h,
1393
- onSubmit: x,
1394
- onFocus: () => f("comment"),
1395
- onBlur: () => f(void 0),
1396
- autofocus: s,
1397
- onEditor: (e) => {
1398
- v.current = e;
1399
- },
1400
- onFiles: (e, t) => y.upload(v.current, e, t),
1401
- placeholder: o ? l("replyPublic", { source: o }) : l(a ? "replyPlaceholder" : "placeholder"),
1402
- label: o ? l("replyPublicButton", { source: o }) : l(a ? "reply" : "newComment"),
1403
- className: a ? "min-h-8" : "min-h-12"
1404
- }, g), /* @__PURE__ */ J("div", {
1405
- className: "mt-1 flex items-center justify-end gap-3",
1406
- children: [
1407
- /* @__PURE__ */ J("span", {
1408
- className: "mr-auto flex min-w-0 items-center gap-2",
1409
- children: [/* @__PURE__ */ q(C, { onFiles: (e) => y.upload(v.current, e) }), /* @__PURE__ */ q(T, {
1410
- pending: y.pending,
1411
- error: y.error
1412
- })]
1413
- }),
1414
- b.isError && /* @__PURE__ */ q(_t, {
1415
- inline: !0,
1416
- className: "text-xs",
1417
- children: u(b.error)
1418
- }),
1419
- c && /* @__PURE__ */ q(z, {
1420
- type: "button",
1421
- variant: "ghost",
1422
- size: "sm",
1423
- onClick: c,
1424
- children: d("cancel")
1425
- }),
1426
- /* @__PURE__ */ q(z, {
1427
- type: "button",
1428
- variant: "primary",
1429
- size: "sm",
1430
- onClick: x,
1431
- disabled: !m.trim() || y.pending > 0,
1432
- loading: b.isPending,
1433
- children: o ? l("replyPublicButton", { source: o }) : l(a ? "reply" : "submit")
1434
- })
1435
- ]
1436
- })] });
1437
- }
1438
- var Qt = Et(() => {});
1439
- export { Ft as component };
15
+ export { o as component };