@parallelworks/tandem-web 0.162.0 → 0.164.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.
- package/_virtual/_virtual_i18n/en/common.js +3 -1
- package/_virtual/_virtual_i18n/es/common.js +3 -1
- package/_virtual/_virtual_i18n/ja/common.js +3 -1
- package/_virtual/_virtual_i18n/ko/common.js +3 -1
- package/_virtual/_virtual_i18n/zh/common.js +3 -1
- package/components/Editor.js +81 -77
- package/components/TeamRepositories.js +134 -115
- package/components/editorPlugins.js +162 -126
- package/components/video.js +51 -0
- package/lib/attachments.js +30 -7
- package/lib/githubLink.js +13 -0
- package/lib/videoMarkdown.js +15 -0
- package/package.json +1 -1
- package/styles.css +12 -0
|
@@ -2,235 +2,254 @@ import { api as e, unwrap as t } from "../api/client.js";
|
|
|
2
2
|
import { Link as n } from "../lib/router.js";
|
|
3
3
|
import { availableRepositoriesQuery as r, codeHostQuery as i, githubSettingsQuery as a, repositoriesQuery as o, teamsQuery as s } from "../api/queries.js";
|
|
4
4
|
import { copyItem as c } from "../lib/menus.js";
|
|
5
|
-
import { externalUrl as
|
|
6
|
-
import { AddIcon as
|
|
7
|
-
import { useConfirm as
|
|
8
|
-
import { useFormError as
|
|
9
|
-
import { RepositoryIssueSync as
|
|
10
|
-
import { Button as
|
|
11
|
-
import { useState as
|
|
12
|
-
import { useTranslations as
|
|
13
|
-
import { jsx as
|
|
14
|
-
import { useMutation as
|
|
5
|
+
import { externalUrl as l } from "../lib/externalUrl.js";
|
|
6
|
+
import { AddIcon as ee, CodeHostIcon as te, RepositoryIcon as u } from "./icons.js";
|
|
7
|
+
import { useConfirm as d } from "../lib/confirm.js";
|
|
8
|
+
import { useFormError as f } from "./settings.js";
|
|
9
|
+
import { RepositoryIssueSync as p } from "./GitHub.js";
|
|
10
|
+
import { Button as m, Card as h, Checkbox as g, Combobox as ne, ErrorText as _, InfoTip as v, Section as y, Tooltip as b, menuDivider as x, useOpenMenu as re } from "@parallelworks/ui";
|
|
11
|
+
import { useState as ie } from "react";
|
|
12
|
+
import { useTranslations as S } from "use-intl";
|
|
13
|
+
import { jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
14
|
+
import { useMutation as T, useQuery as E, useQueryClient as D, useSuspenseQuery as O } from "@tanstack/react-query";
|
|
15
15
|
// src/components/TeamRepositories.tsx
|
|
16
|
-
var
|
|
17
|
-
function
|
|
18
|
-
let
|
|
19
|
-
...a(
|
|
20
|
-
enabled:
|
|
21
|
-
}),
|
|
22
|
-
...r(
|
|
23
|
-
enabled:
|
|
24
|
-
}),
|
|
16
|
+
var k = "cursor-help underline decoration-dotted underline-offset-2";
|
|
17
|
+
function A({ workspace: A, team: j, isAdmin: M }) {
|
|
18
|
+
let N = S("code"), P = S("common"), { data: F } = O(i(A)), { data: I } = O(o(A, j.key)), { data: L } = E({
|
|
19
|
+
...a(A),
|
|
20
|
+
enabled: M
|
|
21
|
+
}), R = S("github"), [z, B] = ie(!1), V = F.connections.some((e) => !e.removed), H = E({
|
|
22
|
+
...r(A, j.key),
|
|
23
|
+
enabled: z && M && V
|
|
24
|
+
}), U = D(), W = re(), G = f(), { confirm: K, dialog: q } = d(), J = () => U.invalidateQueries({ queryKey: o(A, j.key).queryKey }), Y = (e) => {
|
|
25
25
|
let [t = "", n = ""] = e.split("/");
|
|
26
26
|
return { path: {
|
|
27
|
-
workspace:
|
|
28
|
-
key:
|
|
27
|
+
workspace: A,
|
|
28
|
+
key: j.key,
|
|
29
29
|
owner: t,
|
|
30
30
|
name: n
|
|
31
31
|
} };
|
|
32
|
-
},
|
|
32
|
+
}, X = T({
|
|
33
33
|
mutationFn: async (n) => t(await e.PUT("/api/v1/workspaces/{workspace}/teams/{key}/repositories/{owner}/{name}", {
|
|
34
|
-
params:
|
|
34
|
+
params: Y(n.repository),
|
|
35
35
|
body: { default: n.makeDefault }
|
|
36
36
|
})),
|
|
37
|
-
onMutate:
|
|
38
|
-
onError:
|
|
39
|
-
onSettled:
|
|
40
|
-
}),
|
|
41
|
-
mutationFn: async (n) => t(await e.DELETE("/api/v1/workspaces/{workspace}/teams/{key}/repositories/{owner}/{name}", { params:
|
|
42
|
-
onMutate:
|
|
43
|
-
onSettled:
|
|
44
|
-
}),
|
|
37
|
+
onMutate: G.clear,
|
|
38
|
+
onError: G.set,
|
|
39
|
+
onSettled: J
|
|
40
|
+
}), ae = T({
|
|
41
|
+
mutationFn: async (n) => t(await e.DELETE("/api/v1/workspaces/{workspace}/teams/{key}/repositories/{owner}/{name}", { params: Y(n) })),
|
|
42
|
+
onMutate: G.clear,
|
|
43
|
+
onSettled: J
|
|
44
|
+
}), Z = T({
|
|
45
45
|
mutationFn: async (n) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
|
|
46
46
|
params: { path: {
|
|
47
|
-
workspace:
|
|
48
|
-
key:
|
|
47
|
+
workspace: A,
|
|
48
|
+
key: j.key
|
|
49
49
|
} },
|
|
50
50
|
body: { closeIssuesOnMerge: n }
|
|
51
51
|
})),
|
|
52
|
-
onMutate:
|
|
53
|
-
onError:
|
|
54
|
-
onSettled: () =>
|
|
55
|
-
}),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
onMutate: G.clear,
|
|
53
|
+
onError: G.set,
|
|
54
|
+
onSettled: () => U.invalidateQueries({ queryKey: s(A).queryKey })
|
|
55
|
+
}), Q = T({
|
|
56
|
+
mutationFn: async (n) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
|
|
57
|
+
params: { path: {
|
|
58
|
+
workspace: A,
|
|
59
|
+
key: j.key
|
|
60
|
+
} },
|
|
61
|
+
body: { keepIssuesHere: n }
|
|
62
|
+
})),
|
|
63
|
+
onMutate: G.clear,
|
|
64
|
+
onError: G.set,
|
|
65
|
+
onSettled: () => U.invalidateQueries({ queryKey: s(A).queryKey })
|
|
66
|
+
}), $ = (e) => K({
|
|
67
|
+
title: N("unlinkConfirm", { repository: e }),
|
|
68
|
+
description: N("unlinkDetail"),
|
|
69
|
+
confirmLabel: N("unlink"),
|
|
70
|
+
onConfirm: () => ae.mutateAsync(e)
|
|
60
71
|
});
|
|
61
|
-
if (
|
|
72
|
+
if (F.provider === "") return /* @__PURE__ */ C(y, {
|
|
62
73
|
variant: "bare",
|
|
63
74
|
headingLevel: 2,
|
|
64
75
|
collapsible: !1,
|
|
65
|
-
title:
|
|
66
|
-
children: /* @__PURE__ */
|
|
76
|
+
title: N("repositories"),
|
|
77
|
+
children: /* @__PURE__ */ C("p", {
|
|
67
78
|
className: "text-sm text-muted-foreground",
|
|
68
|
-
children:
|
|
79
|
+
children: N("notConfigured")
|
|
69
80
|
})
|
|
70
81
|
});
|
|
71
|
-
let
|
|
72
|
-
return /* @__PURE__ */
|
|
82
|
+
let oe = new Set(I.map((e) => `${e.owner}/${e.name}`.toLowerCase()));
|
|
83
|
+
return /* @__PURE__ */ w(y, {
|
|
73
84
|
variant: "bare",
|
|
74
85
|
headingLevel: 2,
|
|
75
86
|
collapsible: !1,
|
|
76
|
-
title:
|
|
77
|
-
description:
|
|
87
|
+
title: N("repositories"),
|
|
88
|
+
description: N("repositoriesDescription"),
|
|
78
89
|
children: [
|
|
79
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ w(h, {
|
|
80
91
|
size: "fill",
|
|
81
92
|
padding: "none",
|
|
82
93
|
divided: !0,
|
|
83
94
|
interactive: !1,
|
|
84
|
-
render: /* @__PURE__ */
|
|
85
|
-
children: [
|
|
86
|
-
let t = `${e.owner}/${e.name}`, n =
|
|
87
|
-
return /* @__PURE__ */
|
|
88
|
-
onContextMenu: (r) =>
|
|
95
|
+
render: /* @__PURE__ */ C("ul", {}),
|
|
96
|
+
children: [I.map((e) => {
|
|
97
|
+
let t = `${e.owner}/${e.name}`, n = l(e.url), r = L?.enabled && L.repositories.find((e) => e.team === j.key && e.fullName.toLowerCase() === t.toLowerCase());
|
|
98
|
+
return /* @__PURE__ */ w("li", {
|
|
99
|
+
onContextMenu: (r) => W(r, [
|
|
89
100
|
n ? {
|
|
90
|
-
label:
|
|
101
|
+
label: N("openOnHost"),
|
|
91
102
|
href: n,
|
|
92
103
|
target: "_blank"
|
|
93
104
|
} : {
|
|
94
|
-
label:
|
|
105
|
+
label: N("openOnHost"),
|
|
95
106
|
disabled: !0,
|
|
96
107
|
onClick: () => {}
|
|
97
108
|
},
|
|
98
|
-
c(
|
|
99
|
-
...
|
|
109
|
+
c(P("copyName"), t),
|
|
110
|
+
...M ? [
|
|
100
111
|
x,
|
|
101
112
|
{
|
|
102
|
-
label:
|
|
113
|
+
label: N("makeDefault"),
|
|
103
114
|
disabled: e.default,
|
|
104
|
-
onClick: () =>
|
|
115
|
+
onClick: () => X.mutate({
|
|
105
116
|
repository: t,
|
|
106
117
|
makeDefault: !0
|
|
107
118
|
})
|
|
108
119
|
},
|
|
109
120
|
{
|
|
110
|
-
label:
|
|
121
|
+
label: N("unlink"),
|
|
111
122
|
destructive: !0,
|
|
112
123
|
onClick: () => $(t)
|
|
113
124
|
}
|
|
114
125
|
] : []
|
|
115
126
|
]),
|
|
116
127
|
className: "px-3 py-2 text-sm",
|
|
117
|
-
children: [/* @__PURE__ */
|
|
128
|
+
children: [/* @__PURE__ */ w("div", {
|
|
118
129
|
className: "flex items-center gap-3",
|
|
119
130
|
children: [
|
|
120
|
-
/* @__PURE__ */
|
|
131
|
+
/* @__PURE__ */ C(te, {
|
|
121
132
|
provider: e.provider,
|
|
122
133
|
className: "size-4 text-muted-foreground"
|
|
123
134
|
}),
|
|
124
|
-
/* @__PURE__ */
|
|
135
|
+
/* @__PURE__ */ C("a", {
|
|
125
136
|
href: n,
|
|
126
137
|
target: "_blank",
|
|
127
138
|
rel: "noopener noreferrer",
|
|
128
139
|
className: "min-w-0 truncate hover:underline",
|
|
129
140
|
children: t
|
|
130
141
|
}),
|
|
131
|
-
/* @__PURE__ */
|
|
142
|
+
/* @__PURE__ */ C("span", {
|
|
132
143
|
className: "flex-1 text-xs text-muted-foreground",
|
|
133
|
-
children: e.default ? /* @__PURE__ */
|
|
134
|
-
text:
|
|
135
|
-
className:
|
|
136
|
-
children:
|
|
137
|
-
}) : e.private &&
|
|
144
|
+
children: e.default ? /* @__PURE__ */ C(v, {
|
|
145
|
+
text: N("defaultHint"),
|
|
146
|
+
className: k,
|
|
147
|
+
children: N("defaultRepository")
|
|
148
|
+
}) : e.private && N("private")
|
|
138
149
|
}),
|
|
139
|
-
|
|
140
|
-
content:
|
|
150
|
+
M && !e.default && /* @__PURE__ */ C(b, {
|
|
151
|
+
content: N("makeDefaultHint"),
|
|
141
152
|
describesAnchor: !0,
|
|
142
|
-
children: /* @__PURE__ */
|
|
153
|
+
children: /* @__PURE__ */ C("button", {
|
|
143
154
|
type: "button",
|
|
144
|
-
onClick: () =>
|
|
155
|
+
onClick: () => X.mutate({
|
|
145
156
|
repository: t,
|
|
146
157
|
makeDefault: !0
|
|
147
158
|
}),
|
|
148
159
|
className: "text-xs text-muted-foreground hover:text-foreground",
|
|
149
|
-
children:
|
|
160
|
+
children: N("makeDefault")
|
|
150
161
|
})
|
|
151
162
|
}),
|
|
152
|
-
|
|
163
|
+
M && /* @__PURE__ */ C("button", {
|
|
153
164
|
type: "button",
|
|
154
165
|
onClick: () => $(t),
|
|
155
166
|
className: "text-xs text-muted-foreground hover:text-danger",
|
|
156
|
-
children:
|
|
167
|
+
children: N("unlink")
|
|
157
168
|
})
|
|
158
169
|
]
|
|
159
|
-
}), r && /* @__PURE__ */
|
|
170
|
+
}), r && /* @__PURE__ */ C("div", {
|
|
160
171
|
className: "mt-2 pl-7",
|
|
161
|
-
children: /* @__PURE__ */
|
|
162
|
-
workspace:
|
|
172
|
+
children: /* @__PURE__ */ C(p, {
|
|
173
|
+
workspace: A,
|
|
163
174
|
repository: r,
|
|
164
|
-
teamName:
|
|
165
|
-
children: /* @__PURE__ */
|
|
175
|
+
teamName: j.name,
|
|
176
|
+
children: /* @__PURE__ */ C("span", {
|
|
166
177
|
className: "flex-1 text-xs text-muted-foreground",
|
|
167
|
-
children: /* @__PURE__ */
|
|
168
|
-
text:
|
|
169
|
-
className:
|
|
170
|
-
children:
|
|
178
|
+
children: /* @__PURE__ */ C(v, {
|
|
179
|
+
text: R("issueSyncHint"),
|
|
180
|
+
className: k,
|
|
181
|
+
children: R("issueSync")
|
|
171
182
|
})
|
|
172
183
|
})
|
|
173
184
|
})
|
|
174
185
|
})]
|
|
175
186
|
}, t);
|
|
176
|
-
}),
|
|
187
|
+
}), I.length === 0 && /* @__PURE__ */ C("li", {
|
|
177
188
|
className: "px-3 py-2 text-sm text-muted-foreground",
|
|
178
|
-
children:
|
|
189
|
+
children: N("noRepositories")
|
|
179
190
|
})]
|
|
180
191
|
}),
|
|
181
|
-
|
|
192
|
+
M && !V && /* @__PURE__ */ C("p", {
|
|
182
193
|
className: "mt-3 text-sm text-muted-foreground",
|
|
183
|
-
children:
|
|
194
|
+
children: N.rich("connectFirst", { settings: (e) => /* @__PURE__ */ C(n, {
|
|
184
195
|
to: "/$workspace/settings/github",
|
|
185
|
-
params: { workspace:
|
|
196
|
+
params: { workspace: A },
|
|
186
197
|
className: "underline",
|
|
187
198
|
children: e
|
|
188
199
|
}) })
|
|
189
200
|
}),
|
|
190
|
-
|
|
201
|
+
M && V && /* @__PURE__ */ C("div", {
|
|
191
202
|
className: "mt-3",
|
|
192
|
-
children: /* @__PURE__ */
|
|
193
|
-
open:
|
|
194
|
-
onOpenChange:
|
|
195
|
-
items: (
|
|
203
|
+
children: /* @__PURE__ */ C(ne, {
|
|
204
|
+
open: z,
|
|
205
|
+
onOpenChange: B,
|
|
206
|
+
items: (H.data ?? []).filter((e) => !oe.has(`${e.owner}/${e.name}`.toLowerCase())).map((e) => ({
|
|
196
207
|
value: `${e.owner}/${e.name}`,
|
|
197
208
|
label: `${e.owner}/${e.name}`,
|
|
198
|
-
...e.private && { hint:
|
|
199
|
-
icon: /* @__PURE__ */
|
|
209
|
+
...e.private && { hint: N("private") },
|
|
210
|
+
icon: /* @__PURE__ */ C(u, { className: "size-3.5 text-muted-foreground" })
|
|
200
211
|
})),
|
|
201
212
|
value: null,
|
|
202
|
-
onValueChange: (e) => e !== null &&
|
|
213
|
+
onValueChange: (e) => e !== null && X.mutate({
|
|
203
214
|
repository: e,
|
|
204
215
|
makeDefault: !1
|
|
205
216
|
}),
|
|
206
|
-
placeholder:
|
|
207
|
-
"aria-label":
|
|
208
|
-
loading:
|
|
209
|
-
trigger: /* @__PURE__ */
|
|
217
|
+
placeholder: N("linkPlaceholder"),
|
|
218
|
+
"aria-label": N("linkRepository"),
|
|
219
|
+
loading: H.isPending,
|
|
220
|
+
trigger: /* @__PURE__ */ w(m, {
|
|
210
221
|
type: "button",
|
|
211
222
|
children: [
|
|
212
|
-
/* @__PURE__ */
|
|
223
|
+
/* @__PURE__ */ C(ee, { className: "size-3.5" }),
|
|
213
224
|
" ",
|
|
214
|
-
|
|
225
|
+
N("linkRepository")
|
|
215
226
|
]
|
|
216
227
|
})
|
|
217
228
|
})
|
|
218
229
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
230
|
+
/* @__PURE__ */ w("label", {
|
|
220
231
|
className: "mt-4 flex w-fit items-center gap-2 text-sm",
|
|
221
|
-
children: [/* @__PURE__ */
|
|
222
|
-
checked:
|
|
223
|
-
disabled: !
|
|
232
|
+
children: [/* @__PURE__ */ C(g, {
|
|
233
|
+
checked: j.closeIssuesOnMerge,
|
|
234
|
+
disabled: !M || Z.isPending,
|
|
235
|
+
onCheckedChange: (e) => Z.mutate(e)
|
|
236
|
+
}), N("closeOnMerge")]
|
|
237
|
+
}),
|
|
238
|
+
/* @__PURE__ */ w("label", {
|
|
239
|
+
className: "mt-2 flex w-fit items-center gap-2 text-sm",
|
|
240
|
+
children: [/* @__PURE__ */ C(g, {
|
|
241
|
+
checked: j.keepIssuesHere,
|
|
242
|
+
disabled: !M || Q.isPending,
|
|
224
243
|
onCheckedChange: (e) => Q.mutate(e)
|
|
225
|
-
}),
|
|
244
|
+
}), N("keepIssuesHere")]
|
|
226
245
|
}),
|
|
227
|
-
(
|
|
246
|
+
(G.error || H.isError) && /* @__PURE__ */ C(_, {
|
|
228
247
|
size: "md",
|
|
229
248
|
className: "mt-2",
|
|
230
|
-
children:
|
|
249
|
+
children: G.error ?? N("unavailable")
|
|
231
250
|
}),
|
|
232
|
-
|
|
251
|
+
q
|
|
233
252
|
]
|
|
234
253
|
});
|
|
235
254
|
}
|
|
236
|
-
export {
|
|
255
|
+
export { A as TeamRepositories };
|