@parallelworks/tandem-web 0.153.1 → 0.155.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -92,7 +92,10 @@ function k({ workspace: n, isAdmin: i, result: c }) {
92
92
  children: m(`result.${c}`)
93
93
  }),
94
94
  /* @__PURE__ */ C(u, {
95
- icon: /* @__PURE__ */ C(o, { className: "size-7" }),
95
+ icon: /* @__PURE__ */ C(o, {
96
+ provider: h.provider,
97
+ className: "size-7"
98
+ }),
96
99
  name: m("provider"),
97
100
  status: h.connections.length > 0 ? m("linkedCount", { count: h.connections.length }) : m("description"),
98
101
  error: _.error,
@@ -9,13 +9,13 @@ function i({ icon: i, name: a, status: o, action: s, error: c, children: l }) {
9
9
  children: [
10
10
  /* @__PURE__ */ r("div", {
11
11
  className: "flex items-center gap-3 px-5 py-4",
12
- children: [
13
- /* @__PURE__ */ n("span", {
14
- className: "flex size-9 shrink-0 items-center justify-center text-foreground",
15
- children: i
16
- }),
17
- /* @__PURE__ */ r("div", {
18
- className: "min-w-0 flex-1",
12
+ children: [/* @__PURE__ */ n("span", {
13
+ className: "flex size-9 shrink-0 items-center justify-center text-foreground",
14
+ children: i
15
+ }), /* @__PURE__ */ r("div", {
16
+ className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-2",
17
+ children: [/* @__PURE__ */ r("div", {
18
+ className: "min-w-48 flex-1 [overflow-wrap:anywhere]",
19
19
  children: [/* @__PURE__ */ n("h2", {
20
20
  className: "text-sm font-medium",
21
21
  children: a
@@ -23,12 +23,11 @@ function i({ icon: i, name: a, status: o, action: s, error: c, children: l }) {
23
23
  className: "text-sm text-muted-foreground",
24
24
  children: o
25
25
  })]
26
- }),
27
- s && /* @__PURE__ */ n("div", {
26
+ }), s && /* @__PURE__ */ n("div", {
28
27
  className: "flex shrink-0 items-center gap-3",
29
28
  children: s
30
- })
31
- ]
29
+ })]
30
+ })]
32
31
  }),
33
32
  c && /* @__PURE__ */ n(t, {
34
33
  size: "md",
@@ -375,7 +375,7 @@ function G({ source: e, link: t }) {
375
375
  className: "font-medium",
376
376
  children: t ? n.rich("sharedThread", {
377
377
  source: e,
378
- name: J(t.url),
378
+ name: Y(t.url),
379
379
  link: (e) => /* @__PURE__ */ D("a", {
380
380
  href: t.url,
381
381
  target: "_blank",
@@ -393,37 +393,49 @@ function G({ source: e, link: t }) {
393
393
  function K({ links: e }) {
394
394
  return /* @__PURE__ */ D("ul", {
395
395
  className: "space-y-1 px-2 text-sm",
396
- children: e.map((e) => /* @__PURE__ */ D("li", { children: /* @__PURE__ */ D("a", {
396
+ children: e.map((e) => /* @__PURE__ */ D("li", { children: /* @__PURE__ */ O("a", {
397
397
  href: e.url,
398
398
  target: "_blank",
399
399
  rel: "noreferrer",
400
- className: "block truncate text-muted-foreground hover:text-foreground hover:underline",
401
- children: J(e.url)
400
+ className: "flex min-w-0 items-center gap-1.5 text-muted-foreground hover:text-foreground hover:underline",
401
+ children: [q.has(e.connector) && /* @__PURE__ */ D(s, {
402
+ provider: e.connector,
403
+ className: "size-3.5"
404
+ }), /* @__PURE__ */ D("span", {
405
+ className: "truncate",
406
+ children: Y(e.url)
407
+ })]
402
408
  }) }, `${e.connector}:${e.externalId}`))
403
409
  });
404
410
  }
405
- function q({ links: e }) {
411
+ var q = /* @__PURE__ */ new Set(["github", "gitlab"]);
412
+ function J({ links: e }) {
406
413
  let t = T("code");
407
- return e.filter((e) => e.connector === "github").map((e) => /* @__PURE__ */ D(y, {
414
+ return e.filter((e) => q.has(e.connector)).map((e) => /* @__PURE__ */ D(y, {
408
415
  content: t("openOnHost"),
409
416
  children: /* @__PURE__ */ O("a", {
410
417
  href: e.url,
411
418
  target: "_blank",
412
419
  rel: "noreferrer",
413
420
  className: "inline-flex h-6 min-w-0 items-center gap-1.5 rounded-md border border-border px-1.5 text-xs text-muted-foreground hover:bg-muted hover:text-foreground",
414
- children: [/* @__PURE__ */ D(s, { className: "size-3.5" }), /* @__PURE__ */ D("span", {
421
+ children: [/* @__PURE__ */ D(s, {
422
+ provider: e.connector,
423
+ className: "size-3.5"
424
+ }), /* @__PURE__ */ D("span", {
415
425
  className: "truncate",
416
- children: J(e.url)
426
+ children: Y(e.url)
417
427
  })]
418
428
  })
419
429
  }, e.externalId));
420
430
  }
421
- function J(e) {
431
+ function Y(e) {
422
432
  try {
423
- let t = new URL(e), n = t.pathname.match(/^\/([^/]+\/[^/]+)\/issues\/(\d+)/);
424
- return n ? `${n[1]}#${n[2]}` : `${t.host}${t.pathname}`;
433
+ let t = new URL(e), n = t.pathname.match(/^\/(.+?)\/-\/(issues|merge_requests)\/(\d+)/);
434
+ if (n) return `${n[1]}${n[2] === "issues" ? "#" : "!"}${n[3]}`;
435
+ let r = t.pathname.match(/^\/([^/]+\/[^/]+)\/issues\/(\d+)/);
436
+ return r ? `${r[1]}#${r[2]}` : `${t.host}${t.pathname}`;
425
437
  } catch {
426
438
  return e;
427
439
  }
428
440
  }
429
- export { R as GitHubAccount, B as GitHubSettings, q as IssueLinkChips, K as IssueLinks, U as RepositoryIssueSync, G as SharedThreadHeader, J as linkName };
441
+ export { R as GitHubAccount, B as GitHubSettings, J as IssueLinkChips, K as IssueLinks, U as RepositoryIssueSync, G as SharedThreadHeader, Y as linkName };
@@ -3,60 +3,63 @@ import { branchName as n } from "../lib/branch.js";
3
3
  import { branchesQuery as r, pullRequestsQuery as i, repositoriesQuery as a } from "../api/queries.js";
4
4
  import { copyItem as o } from "../lib/menus.js";
5
5
  import { externalUrl as s } from "../lib/externalUrl.js";
6
- import { BranchIcon as c, CloseIcon as l, PullRequestIcon as u } from "./icons.js";
7
- import { useCan as d } from "../lib/roles.js";
8
- import { Card as f, CopyButton as p, IconButton as m, useOpenMenu as h } from "@parallelworks/ui";
9
- import { useTranslations as g } from "use-intl";
10
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
11
- import { useMutation as y, useQuery as b, useQueryClient as x, useSuspenseQuery as S } from "@tanstack/react-query";
6
+ import { BranchIcon as c, CloseIcon as l, CodeHostIcon as u, PullRequestIcon as d } from "./icons.js";
7
+ import { useCan as f } from "../lib/roles.js";
8
+ import { Card as p, CopyButton as m, IconButton as h, useOpenMenu as g } from "@parallelworks/ui";
9
+ import { useTranslations as _ } from "use-intl";
10
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
11
+ import { useMutation as b, useQuery as x, useQueryClient as S, useSuspenseQuery as C } from "@tanstack/react-query";
12
12
  // src/components/IssueCode.tsx
13
- var C = {
13
+ var w = {
14
14
  open: "text-success",
15
15
  draft: "text-muted-foreground",
16
16
  merged: "text-primary",
17
17
  closed: "text-danger"
18
- }, w = {
18
+ }, T = {
19
19
  pending: "text-warning",
20
20
  passing: "text-success",
21
21
  failing: "text-danger"
22
- }, T = (e) => e.state === "open" && e.draft ? "draft" : e.state;
23
- function E({ workspace: E, identifier: D, title: O }) {
24
- let k = g("code"), A = g("common"), { data: j } = S(i(E, D)), { data: M } = S(r(E, D)), N = h(), P = new Set(j.map((e) => `${e.repository} ${e.headRef}`)), F = M.filter((e) => !P.has(`${e.repository} ${e.name}`)), I = D.slice(0, D.lastIndexOf("-")), { data: L = [] } = b(a(E, I)), R = d(E, "edit_issues"), z = x(), B = y({
22
+ }, E = (e) => e.state === "open" && e.draft ? "draft" : e.state;
23
+ function D(e) {
24
+ return `${e.provider === "gitlab" ? "!" : "#"}${e.number}`;
25
+ }
26
+ function O({ workspace: O, identifier: k, title: A }) {
27
+ let j = _("code"), M = _("common"), { data: N } = C(i(O, k)), { data: P } = C(r(O, k)), F = g(), I = new Set(N.map((e) => `${e.repository} ${e.headRef}`)), L = P.filter((e) => !I.has(`${e.repository} ${e.name}`)), R = k.slice(0, k.lastIndexOf("-")), { data: z = [] } = x(a(O, R)), B = f(O, "edit_issues"), V = S(), H = b({
25
28
  mutationFn: async (n) => t(await e.DELETE("/api/v1/workspaces/{workspace}/issues/{identifier}/pull-requests/{pullRequestId}", { params: { path: {
26
- workspace: E,
27
- identifier: D,
29
+ workspace: O,
30
+ identifier: k,
28
31
  pullRequestId: n
29
32
  } } })),
30
33
  onSettled: () => {
31
- z.invalidateQueries({ queryKey: i(E, D).queryKey }), z.invalidateQueries({ queryKey: r(E, D).queryKey });
34
+ V.invalidateQueries({ queryKey: i(O, k).queryKey }), V.invalidateQueries({ queryKey: r(O, k).queryKey });
32
35
  }
33
36
  });
34
- if (j.length === 0 && F.length === 0) {
35
- if (L.length === 0) return null;
36
- let e = n(D, O);
37
- return /* @__PURE__ */ v("section", {
37
+ if (N.length === 0 && L.length === 0) {
38
+ if (z.length === 0) return null;
39
+ let e = n(k, A);
40
+ return /* @__PURE__ */ y("section", {
38
41
  className: "mt-6",
39
- "aria-label": k("pullRequests"),
40
- children: [/* @__PURE__ */ _("h2", {
42
+ "aria-label": j("pullRequests"),
43
+ children: [/* @__PURE__ */ v("h2", {
41
44
  className: "text-xs font-medium text-muted-foreground",
42
- children: k("pullRequests")
43
- }), /* @__PURE__ */ v("div", {
45
+ children: j("pullRequests")
46
+ }), /* @__PURE__ */ y("div", {
44
47
  className: "mt-1 flex items-start gap-3 rounded-xl border border-dashed border-border px-3 py-2",
45
48
  children: [
46
- /* @__PURE__ */ _(c, { className: "mt-0.5 size-4 shrink-0 text-muted-foreground" }),
47
- /* @__PURE__ */ v("div", {
49
+ /* @__PURE__ */ v(c, { className: "mt-0.5 size-4 shrink-0 text-muted-foreground" }),
50
+ /* @__PURE__ */ y("div", {
48
51
  className: "min-w-0 flex-1",
49
- children: [/* @__PURE__ */ _("p", {
52
+ children: [/* @__PURE__ */ v("p", {
50
53
  className: "text-sm text-muted-foreground",
51
- children: k("linkByBranch")
52
- }), /* @__PURE__ */ _("code", {
54
+ children: j("linkByBranch")
55
+ }), /* @__PURE__ */ v("code", {
53
56
  className: "mt-1 block truncate font-mono text-xs",
54
57
  children: e
55
58
  })]
56
59
  }),
57
- /* @__PURE__ */ _(p, {
60
+ /* @__PURE__ */ v(m, {
58
61
  text: e,
59
- label: k("branchName"),
62
+ label: j("branchName"),
60
63
  size: "sm",
61
64
  variant: "ghost"
62
65
  })
@@ -64,105 +67,109 @@ function E({ workspace: E, identifier: D, title: O }) {
64
67
  })]
65
68
  });
66
69
  }
67
- let V = (e) => e ? {
68
- label: k("openOnHost"),
70
+ let U = (e) => e ? {
71
+ label: j("openOnHost"),
69
72
  href: e,
70
73
  target: "_blank"
71
74
  } : {
72
- label: k("openOnHost"),
75
+ label: j("openOnHost"),
73
76
  disabled: !0,
74
77
  onClick: () => {}
75
78
  };
76
- return /* @__PURE__ */ v("section", {
79
+ return /* @__PURE__ */ y("section", {
77
80
  className: "mt-6",
78
- "aria-label": k("pullRequests"),
79
- children: [/* @__PURE__ */ _("h2", {
81
+ "aria-label": j("pullRequests"),
82
+ children: [/* @__PURE__ */ v("h2", {
80
83
  className: "text-xs font-medium text-muted-foreground",
81
- children: k("pullRequests")
82
- }), /* @__PURE__ */ v(f, {
84
+ children: j("pullRequests")
85
+ }), /* @__PURE__ */ y(p, {
83
86
  size: "fill",
84
87
  padding: "none",
85
88
  divided: !0,
86
89
  interactive: !1,
87
- render: /* @__PURE__ */ _("ul", {}),
90
+ render: /* @__PURE__ */ v("ul", {}),
88
91
  className: "mt-1",
89
- children: [j.map((e) => {
90
- let t = T(e), n = s(e.url);
91
- return /* @__PURE__ */ v("li", {
92
+ children: [N.map((e) => {
93
+ let t = E(e), n = s(e.url);
94
+ return /* @__PURE__ */ y("li", {
92
95
  className: "group flex items-center hover:bg-muted",
93
- children: [/* @__PURE__ */ v("a", {
96
+ children: [/* @__PURE__ */ y("a", {
94
97
  href: n,
95
98
  target: "_blank",
96
99
  rel: "noopener noreferrer",
97
- onContextMenu: (t) => N(t, [
98
- V(n),
99
- o(A("copyLink"), e.url),
100
- o(k("copyBranch"), e.headRef),
101
- ...R ? [{
102
- label: k("unlinkPullRequest"),
103
- onClick: () => B.mutate(e.id)
100
+ onContextMenu: (t) => F(t, [
101
+ U(n),
102
+ o(M("copyLink"), e.url),
103
+ o(j("copyBranch"), e.headRef),
104
+ ...B ? [{
105
+ label: j("unlinkPullRequest"),
106
+ onClick: () => H.mutate(e.id)
104
107
  }] : []
105
108
  ]),
106
109
  className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2 text-sm",
107
110
  children: [
108
- /* @__PURE__ */ _(u, { className: `size-4 ${C[t]}` }),
109
- /* @__PURE__ */ v("span", {
111
+ /* @__PURE__ */ v(d, { className: `size-4 ${w[t]}` }),
112
+ /* @__PURE__ */ v(u, {
113
+ provider: e.provider,
114
+ className: "size-3.5 text-muted-foreground"
115
+ }),
116
+ /* @__PURE__ */ y("span", {
110
117
  className: "min-w-0 flex-1 truncate",
111
118
  children: [
112
119
  e.title,
113
120
  " ",
114
- /* @__PURE__ */ _("span", {
121
+ /* @__PURE__ */ v("span", {
115
122
  className: "text-muted-foreground",
116
- children: k("pullRequestRef", {
123
+ children: j("pullRequestRef", {
117
124
  repository: e.repository,
118
- number: e.number
125
+ number: D(e)
119
126
  })
120
127
  })
121
128
  ]
122
129
  }),
123
- /* @__PURE__ */ v("span", {
130
+ /* @__PURE__ */ y("span", {
124
131
  className: "flex items-center gap-3 text-xs",
125
132
  children: [
126
- e.state === "open" && e.checks !== "none" && /* @__PURE__ */ _("span", {
127
- className: w[e.checks],
128
- children: k(`checks.${e.checks}`)
133
+ e.state === "open" && e.checks !== "none" && /* @__PURE__ */ v("span", {
134
+ className: T[e.checks],
135
+ children: j(`checks.${e.checks}`)
129
136
  }),
130
- e.state === "open" && e.review !== "none" && /* @__PURE__ */ _("span", {
137
+ e.state === "open" && e.review !== "none" && /* @__PURE__ */ v("span", {
131
138
  className: e.review === "approved" ? "text-success" : "text-danger",
132
- children: k(`review.${e.review}`)
139
+ children: j(`review.${e.review}`)
133
140
  }),
134
- /* @__PURE__ */ _("span", {
135
- className: C[t],
136
- children: k(`state.${t}`)
141
+ /* @__PURE__ */ v("span", {
142
+ className: w[t],
143
+ children: j(`state.${t}`)
137
144
  })
138
145
  ]
139
146
  })
140
147
  ]
141
- }), R && /* @__PURE__ */ _(m, {
142
- icon: /* @__PURE__ */ _(l, {}),
143
- label: k("unlinkPullRequest"),
148
+ }), B && /* @__PURE__ */ v(h, {
149
+ icon: /* @__PURE__ */ v(l, {}),
150
+ label: j("unlinkPullRequest"),
144
151
  variant: "ghost",
145
152
  size: "sm",
146
153
  className: "mr-1.5 shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100",
147
- disabled: B.isPending,
148
- onClick: () => B.mutate(e.id)
154
+ disabled: H.isPending,
155
+ onClick: () => H.mutate(e.id)
149
156
  })]
150
157
  }, `${e.repository}#${e.number}`);
151
- }), F.map((e) => {
158
+ }), L.map((e) => {
152
159
  let t = s(e.url);
153
- return /* @__PURE__ */ _("li", { children: /* @__PURE__ */ v("a", {
160
+ return /* @__PURE__ */ v("li", { children: /* @__PURE__ */ y("a", {
154
161
  href: t,
155
162
  target: "_blank",
156
163
  rel: "noopener noreferrer",
157
- onContextMenu: (n) => N(n, [V(t), o(k("copyBranch"), e.name)]),
164
+ onContextMenu: (n) => F(n, [U(t), o(j("copyBranch"), e.name)]),
158
165
  className: "flex items-center gap-3 px-3 py-2 text-sm hover:bg-muted",
159
166
  children: [
160
- /* @__PURE__ */ _(c, { className: "size-4 text-muted-foreground" }),
161
- /* @__PURE__ */ _("span", {
167
+ /* @__PURE__ */ v(c, { className: "size-4 text-muted-foreground" }),
168
+ /* @__PURE__ */ v("span", {
162
169
  className: "min-w-0 flex-1 truncate font-mono text-xs",
163
170
  children: e.name
164
171
  }),
165
- /* @__PURE__ */ _("span", {
172
+ /* @__PURE__ */ v("span", {
166
173
  className: "text-xs text-muted-foreground",
167
174
  children: e.repository
168
175
  })
@@ -172,4 +179,4 @@ function E({ workspace: E, identifier: D, title: O }) {
172
179
  })]
173
180
  });
174
181
  }
175
- export { E as IssueCode };
182
+ export { O as IssueCode, D as pullRequestNumber };
@@ -0,0 +1,68 @@
1
+ import { issueZendeskQuery as e } from "../api/queries.js";
2
+ import { externalUrl as t } from "../lib/externalUrl.js";
3
+ import { InboxIcon as n } from "./icons.js";
4
+ import { Card as r } from "@parallelworks/ui";
5
+ import { useTranslations as i } from "use-intl";
6
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
+ import { useQuery as s } from "@tanstack/react-query";
8
+ // src/components/IssueZendesk.tsx
9
+ var c = [
10
+ "new",
11
+ "open",
12
+ "pending",
13
+ "hold",
14
+ "solved",
15
+ "closed"
16
+ ], l = (e) => c.includes(e);
17
+ function u({ workspace: c, identifier: u }) {
18
+ let d = i("zendesk"), { data: f } = s(e(c, u));
19
+ return !f?.enabled || f.links.length === 0 ? null : /* @__PURE__ */ o("section", {
20
+ className: "mt-6",
21
+ "aria-label": d("issueSection"),
22
+ children: [/* @__PURE__ */ o("h2", {
23
+ className: "text-xs font-medium text-muted-foreground",
24
+ children: [d("issueSection"), /* @__PURE__ */ a("span", {
25
+ className: "ml-1.5",
26
+ children: f.links.length
27
+ })]
28
+ }), /* @__PURE__ */ a(r, {
29
+ size: "fill",
30
+ padding: "none",
31
+ divided: !0,
32
+ interactive: !1,
33
+ render: /* @__PURE__ */ a("ul", {}),
34
+ className: "mt-1",
35
+ children: f.links.map((e) => /* @__PURE__ */ a("li", {
36
+ className: "hover:bg-muted",
37
+ children: /* @__PURE__ */ o("a", {
38
+ href: t(e.url),
39
+ target: "_blank",
40
+ rel: "noopener noreferrer",
41
+ className: "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2 text-sm",
42
+ children: [
43
+ /* @__PURE__ */ a(n, { className: "size-4 shrink-0 text-muted-foreground" }),
44
+ /* @__PURE__ */ o("span", {
45
+ className: "shrink-0 text-muted-foreground",
46
+ children: ["#", e.id]
47
+ }),
48
+ /* @__PURE__ */ a("span", {
49
+ className: "min-w-0 flex-1 truncate",
50
+ children: e.subject
51
+ }),
52
+ /* @__PURE__ */ o("span", {
53
+ className: "flex w-full flex-wrap items-center gap-x-3 pl-7 text-xs text-muted-foreground sm:w-auto sm:pl-0",
54
+ children: [(e.organization || e.requester) && /* @__PURE__ */ a("span", { children: e.organization && e.requester ? d("requesterAt", {
55
+ requester: e.requester,
56
+ organization: e.organization
57
+ }) : e.organization || e.requester }), /* @__PURE__ */ a("span", {
58
+ className: e.status === "solved" || e.status === "closed" ? "text-success" : "",
59
+ children: d(`status.${l(e.status) ? e.status : "open"}`)
60
+ })]
61
+ })
62
+ ]
63
+ })
64
+ }, e.id))
65
+ })]
66
+ });
67
+ }
68
+ export { u as IssueZendesk };