@parallelworks/tandem-web 0.183.0 → 0.185.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 +18 -0
- package/_virtual/_virtual_i18n/es/common.js +18 -0
- package/_virtual/_virtual_i18n/ja/common.js +18 -0
- package/_virtual/_virtual_i18n/ko/common.js +18 -0
- package/_virtual/_virtual_i18n/zh/common.js +18 -0
- package/components/DocProperties.js +137 -114
- package/components/DocStart.js +116 -92
- package/components/DocTable.js +102 -100
- package/components/FavoritesNav.js +125 -106
- package/components/NewProjectDialog.js +170 -163
- package/components/ParentProjectSelect.js +35 -0
- package/components/ProjectAccess.js +23 -20
- package/components/SubpageViews.js +477 -161
- package/components/icons.js +8 -8
- package/lib/cancelledLoads.js +7 -0
- package/lib/docProperties.js +6 -6
- package/lib/projects.js +9 -1
- package/lib/queryClient.js +7 -6
- package/lib/subpageViews.js +1 -0
- package/package.json +1 -1
- package/pages/projects.js +62 -57
- package/routes/_workspace/docs/space2._space.js +128 -128
- package/routes/_workspace/knowledge/_term2.js +83 -77
- package/routes/_workspace/projects/_projectId3.js +286 -287
- package/styles.css +1 -0
package/components/DocTable.js
CHANGED
|
@@ -1,139 +1,141 @@
|
|
|
1
1
|
import { docsQuery as e } from "../api/queries.js";
|
|
2
|
-
import { docPropertiesQuery as t, spaceScope as n, useDocPropertyActions as r } from "../lib/docProperties.js";
|
|
3
|
-
import { docRef as
|
|
4
|
-
import { usePeople as
|
|
5
|
-
import { useCan as
|
|
6
|
-
import { DocIcon as
|
|
7
|
-
import { usePropertyText as
|
|
8
|
-
import { cx as
|
|
9
|
-
import { Link as
|
|
10
|
-
import { useState as
|
|
11
|
-
import { useFormatter as
|
|
12
|
-
import { jsx as
|
|
13
|
-
import { keepPreviousData as
|
|
14
|
-
import { MoreButton as
|
|
2
|
+
import { docPropertiesQuery as t, spaceScope as n, useDocPropertyActions as r, usedProperties as i } from "../lib/docProperties.js";
|
|
3
|
+
import { docRef as a, useDocMenu as o } from "../lib/docs.js";
|
|
4
|
+
import { usePeople as s } from "../lib/people.js";
|
|
5
|
+
import { useCan as c } from "../lib/roles.js";
|
|
6
|
+
import { DocIcon as l } from "./DocIcon.js";
|
|
7
|
+
import { usePropertyText as u } from "./DocProperties.js";
|
|
8
|
+
import { cx as d, useOpenMenu as f } from "@parallelworks/ui";
|
|
9
|
+
import { Link as p } from "@tanstack/react-router";
|
|
10
|
+
import { useState as m } from "react";
|
|
11
|
+
import { useFormatter as h, useTranslations as g } from "use-intl";
|
|
12
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
13
|
+
import { keepPreviousData as y, useQuery as b } from "@tanstack/react-query";
|
|
14
|
+
import { MoreButton as x, rowContextMenuProps as S } from "@parallelworks/ui/list";
|
|
15
15
|
// src/components/DocTable.tsx
|
|
16
|
-
var
|
|
17
|
-
function
|
|
18
|
-
let
|
|
16
|
+
var C = (e) => e.kind === "select" || e.kind === "person";
|
|
17
|
+
function w(n, r, a, o = !1) {
|
|
18
|
+
let s = Object.entries(a.filters ?? {}).map(([e, t]) => `${e}=${t}`), { data: c = [], isPending: l } = b({
|
|
19
19
|
...e(n, {
|
|
20
20
|
...r === "workspace" ? { workspace: !0 } : { team: r },
|
|
21
|
-
...
|
|
22
|
-
...
|
|
21
|
+
...s.length > 0 && { property: s },
|
|
22
|
+
...o && { top: !0 }
|
|
23
23
|
}),
|
|
24
|
-
placeholderData:
|
|
25
|
-
}), { data:
|
|
26
|
-
if (
|
|
27
|
-
if (!
|
|
28
|
-
let t = e.properties?.[
|
|
29
|
-
return
|
|
30
|
-
}
|
|
24
|
+
placeholderData: y
|
|
25
|
+
}), { data: d = [] } = b(t(n, r)), f = u(n), p = a.sort ?? "title", m = d.find((e) => e.id === p), h = (e) => {
|
|
26
|
+
if (p === "updated") return e.updatedAt;
|
|
27
|
+
if (!m) return e.title.toLowerCase();
|
|
28
|
+
let t = e.properties?.[m.id];
|
|
29
|
+
return m.kind === "number" ? typeof t == "number" ? t : -Infinity : f(m, t).toLowerCase();
|
|
30
|
+
}, g = c.filter((e) => !e.template).sort((e, t) => {
|
|
31
|
+
let n = h(e), r = h(t), i = n < r ? -1 : +(n > r);
|
|
32
|
+
return a.desc ? -i : i;
|
|
33
|
+
});
|
|
31
34
|
return {
|
|
32
|
-
docs:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
props: u,
|
|
37
|
-
isPending: c
|
|
35
|
+
docs: g,
|
|
36
|
+
props: d,
|
|
37
|
+
used: i(d, g),
|
|
38
|
+
isPending: l
|
|
38
39
|
};
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
var T = (e, t, n) => e === "table" && !t.trim() && Object.keys(n.filters ?? {}).length === 0;
|
|
42
|
+
function E({ workspace: e, space: t, layout: n, config: r, query: i = "" }) {
|
|
43
|
+
let c = g("docViews"), d = g("common"), m = g("docs"), y = h(), { actorName: b } = s(e), E = f(), O = o(e), k = i.trim().toLowerCase(), A = T(n, i, r), { docs: j, props: M, used: N, isPending: P } = w(e, t, r, A), F = k ? j.filter((e) => e.title.toLowerCase().includes(k)) : j, I = new Map(j.map((e) => [e.id, e])), L = (e) => {
|
|
42
44
|
let t = [];
|
|
43
|
-
for (let n =
|
|
45
|
+
for (let n = I.get(e.parentId ?? ""); n && !(t.length > 20); n = I.get(n.parentId ?? "")) t.unshift(n.title);
|
|
44
46
|
return t.join(" / ");
|
|
45
|
-
},
|
|
46
|
-
if (
|
|
47
|
+
}, R = u(e), z = (e, t) => e.properties?.[t.id];
|
|
48
|
+
if (P) return /* @__PURE__ */ _("p", {
|
|
47
49
|
className: "p-4 text-sm text-muted-foreground",
|
|
48
|
-
children:
|
|
50
|
+
children: c("loading")
|
|
49
51
|
});
|
|
50
52
|
if (n === "board") {
|
|
51
|
-
let n =
|
|
52
|
-
return n ? /* @__PURE__ */
|
|
53
|
+
let n = M.find((e) => e.id === r.groupBy && C(e));
|
|
54
|
+
return n ? /* @__PURE__ */ _(D, {
|
|
53
55
|
workspace: e,
|
|
54
56
|
space: t,
|
|
55
|
-
docs:
|
|
56
|
-
props:
|
|
57
|
+
docs: F,
|
|
58
|
+
props: M,
|
|
57
59
|
by: n
|
|
58
|
-
}) : /* @__PURE__ */
|
|
60
|
+
}) : /* @__PURE__ */ _("p", {
|
|
59
61
|
className: "p-4 text-sm text-muted-foreground",
|
|
60
|
-
children:
|
|
62
|
+
children: c("pickGroup")
|
|
61
63
|
});
|
|
62
64
|
}
|
|
63
|
-
let
|
|
64
|
-
return
|
|
65
|
+
let B = r.columns ? r.columns.flatMap((e) => M.filter((t) => t.id === e)) : N;
|
|
66
|
+
return F.length === 0 ? /* @__PURE__ */ _("p", {
|
|
65
67
|
className: "p-4 text-sm text-muted-foreground",
|
|
66
|
-
children:
|
|
67
|
-
}) : /* @__PURE__ */
|
|
68
|
+
children: c("none")
|
|
69
|
+
}) : /* @__PURE__ */ _("div", {
|
|
68
70
|
className: "overflow-x-auto",
|
|
69
|
-
children: /* @__PURE__ */
|
|
71
|
+
children: /* @__PURE__ */ v("table", {
|
|
70
72
|
className: "doc-table w-full min-w-max text-sm",
|
|
71
|
-
children: [/* @__PURE__ */
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
+
children: [/* @__PURE__ */ _("thead", { children: /* @__PURE__ */ v("tr", { children: [
|
|
74
|
+
/* @__PURE__ */ _("th", {
|
|
73
75
|
scope: "col",
|
|
74
|
-
children:
|
|
76
|
+
children: c("docTitle")
|
|
75
77
|
}),
|
|
76
|
-
|
|
78
|
+
B.map((e) => /* @__PURE__ */ _("th", {
|
|
77
79
|
scope: "col",
|
|
78
80
|
children: e.name
|
|
79
81
|
}, e.id)),
|
|
80
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ _("th", {
|
|
81
83
|
scope: "col",
|
|
82
|
-
children:
|
|
84
|
+
children: c("author")
|
|
83
85
|
}),
|
|
84
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ _("th", {
|
|
85
87
|
scope: "col",
|
|
86
|
-
children:
|
|
88
|
+
children: c("updated")
|
|
87
89
|
}),
|
|
88
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ _("th", {
|
|
89
91
|
scope: "col",
|
|
90
92
|
className: "max-md:sticky max-md:right-0 max-md:bg-card",
|
|
91
|
-
children: /* @__PURE__ */
|
|
93
|
+
children: /* @__PURE__ */ _("span", {
|
|
92
94
|
className: "sr-only",
|
|
93
|
-
children:
|
|
95
|
+
children: d("moreActions")
|
|
94
96
|
})
|
|
95
97
|
})
|
|
96
|
-
] }) }), /* @__PURE__ */
|
|
97
|
-
let n =
|
|
98
|
-
return /* @__PURE__ */
|
|
98
|
+
] }) }), /* @__PURE__ */ _("tbody", { children: F.map((t) => {
|
|
99
|
+
let n = A ? "" : L(t);
|
|
100
|
+
return /* @__PURE__ */ v("tr", {
|
|
99
101
|
className: "group",
|
|
100
|
-
...
|
|
102
|
+
...S(E, () => O(t)),
|
|
101
103
|
children: [
|
|
102
|
-
/* @__PURE__ */
|
|
104
|
+
/* @__PURE__ */ v("td", { children: [/* @__PURE__ */ v("div", {
|
|
103
105
|
className: "flex items-center gap-2",
|
|
104
|
-
children: [/* @__PURE__ */
|
|
106
|
+
children: [/* @__PURE__ */ v(p, {
|
|
105
107
|
to: "/$workspace/docs/$doc",
|
|
106
108
|
params: {
|
|
107
109
|
workspace: e,
|
|
108
|
-
doc:
|
|
110
|
+
doc: a(t)
|
|
109
111
|
},
|
|
110
112
|
className: "flex min-w-0 items-center gap-2 font-medium hover:underline",
|
|
111
|
-
children: [/* @__PURE__ */
|
|
113
|
+
children: [/* @__PURE__ */ _(l, { icon: t.icon }), /* @__PURE__ */ _("span", {
|
|
112
114
|
className: "truncate",
|
|
113
115
|
children: t.title
|
|
114
116
|
})]
|
|
115
|
-
}),
|
|
117
|
+
}), A && (t.children ?? 0) > 0 && /* @__PURE__ */ _("span", {
|
|
116
118
|
className: "shrink-0 text-xs tabular-nums text-muted-foreground",
|
|
117
|
-
children:
|
|
119
|
+
children: c("childCount", { count: t.children ?? 0 })
|
|
118
120
|
})]
|
|
119
|
-
}), n && /* @__PURE__ */
|
|
121
|
+
}), n && /* @__PURE__ */ _("span", {
|
|
120
122
|
className: "ml-6 block truncate text-xs text-muted-foreground",
|
|
121
|
-
children:
|
|
123
|
+
children: c("inParent", { parent: n })
|
|
122
124
|
})] }),
|
|
123
|
-
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
+
B.map((e) => /* @__PURE__ */ _("td", { children: R(e, z(t, e)) }, e.id)),
|
|
126
|
+
/* @__PURE__ */ _("td", {
|
|
125
127
|
className: "text-muted-foreground",
|
|
126
|
-
children:
|
|
128
|
+
children: b(t.creator)
|
|
127
129
|
}),
|
|
128
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ _("td", {
|
|
129
131
|
className: "text-muted-foreground",
|
|
130
132
|
children: y.dateTime(new Date(t.updatedAt), { dateStyle: "medium" })
|
|
131
133
|
}),
|
|
132
|
-
/* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ _("td", {
|
|
133
135
|
className: "w-0 max-md:sticky max-md:right-0 max-md:bg-card",
|
|
134
|
-
children: /* @__PURE__ */
|
|
135
|
-
items: () =>
|
|
136
|
-
label:
|
|
136
|
+
children: /* @__PURE__ */ _(x, {
|
|
137
|
+
items: () => O(t),
|
|
138
|
+
label: d("moreActionsFor", { name: t.title || m("untitled") })
|
|
137
139
|
})
|
|
138
140
|
})
|
|
139
141
|
]
|
|
@@ -142,8 +144,8 @@ function w({ workspace: e, space: t, layout: n, config: r, query: s = "" }) {
|
|
|
142
144
|
})
|
|
143
145
|
});
|
|
144
146
|
}
|
|
145
|
-
function
|
|
146
|
-
let
|
|
147
|
+
function D({ workspace: e, space: t, docs: i, props: o, by: f }) {
|
|
148
|
+
let h = g("docViews"), { members: y } = s(e), b = u(e), x = c(e, "edit_docs", n(t)), S = r(e), [C, w] = m(null), [T, E] = m(null), D = [...f.kind === "select" ? f.options.map((e) => ({
|
|
147
149
|
key: e.id ?? "",
|
|
148
150
|
label: e.name
|
|
149
151
|
})) : y.map((e) => ({
|
|
@@ -151,17 +153,17 @@ function T({ workspace: e, space: t, docs: a, props: d, by: m }) {
|
|
|
151
153
|
label: e.user.name
|
|
152
154
|
})), {
|
|
153
155
|
key: "",
|
|
154
|
-
label:
|
|
156
|
+
label: h("noValue", { property: f.name })
|
|
155
157
|
}], O = (e) => {
|
|
156
|
-
let t = e.properties?.[
|
|
158
|
+
let t = e.properties?.[f.id];
|
|
157
159
|
return typeof t == "string" ? t : "";
|
|
158
|
-
}, k = D.filter((e) =>
|
|
159
|
-
return /* @__PURE__ */
|
|
160
|
+
}, k = D.filter((e) => f.kind === "select" || e.key === "" || i.some((t) => O(t) === e.key)), A = o.filter((e) => e.id !== f.id).slice(0, 2);
|
|
161
|
+
return /* @__PURE__ */ _("ul", {
|
|
160
162
|
className: "flex gap-3 overflow-x-auto p-3",
|
|
161
|
-
"aria-label":
|
|
163
|
+
"aria-label": h("board"),
|
|
162
164
|
children: k.map((t) => {
|
|
163
|
-
let n =
|
|
164
|
-
return /* @__PURE__ */
|
|
165
|
+
let n = i.filter((e) => O(e) === t.key);
|
|
166
|
+
return /* @__PURE__ */ v("li", {
|
|
165
167
|
"aria-label": t.label,
|
|
166
168
|
onDragOver: (e) => {
|
|
167
169
|
C && (e.preventDefault(), E(t.key));
|
|
@@ -170,40 +172,40 @@ function T({ workspace: e, space: t, docs: a, props: d, by: m }) {
|
|
|
170
172
|
onDrop: (e) => {
|
|
171
173
|
e.preventDefault(), C && S.setValues.mutate({
|
|
172
174
|
doc: C,
|
|
173
|
-
values: { [
|
|
175
|
+
values: { [f.id]: t.key || null }
|
|
174
176
|
}), w(null), E(null);
|
|
175
177
|
},
|
|
176
|
-
className:
|
|
177
|
-
children: [/* @__PURE__ */
|
|
178
|
+
className: d("flex w-64 shrink-0 flex-col rounded-lg border bg-muted/30", T === t.key ? "border-primary" : "border-border"),
|
|
179
|
+
children: [/* @__PURE__ */ v("p", {
|
|
178
180
|
className: "flex items-center gap-2 px-3 py-2 text-xs font-medium",
|
|
179
|
-
children: [/* @__PURE__ */
|
|
181
|
+
children: [/* @__PURE__ */ _("span", {
|
|
180
182
|
className: "truncate",
|
|
181
183
|
children: t.label
|
|
182
|
-
}), /* @__PURE__ */
|
|
184
|
+
}), /* @__PURE__ */ _("span", {
|
|
183
185
|
className: "text-muted-foreground tabular-nums",
|
|
184
186
|
children: n.length
|
|
185
187
|
})]
|
|
186
|
-
}), /* @__PURE__ */
|
|
188
|
+
}), /* @__PURE__ */ _("ul", {
|
|
187
189
|
className: "flex flex-col gap-2 px-2 pb-2",
|
|
188
|
-
children: n.map((t) => /* @__PURE__ */
|
|
190
|
+
children: n.map((t) => /* @__PURE__ */ v("li", {
|
|
189
191
|
draggable: x,
|
|
190
192
|
onDragStart: () => w(t.key),
|
|
191
193
|
onDragEnd: () => w(null),
|
|
192
194
|
className: "rounded-md border border-border bg-card p-2.5 text-sm shadow-xs",
|
|
193
|
-
children: [/* @__PURE__ */
|
|
195
|
+
children: [/* @__PURE__ */ v(p, {
|
|
194
196
|
to: "/$workspace/docs/$doc",
|
|
195
197
|
params: {
|
|
196
198
|
workspace: e,
|
|
197
|
-
doc:
|
|
199
|
+
doc: a(t)
|
|
198
200
|
},
|
|
199
201
|
className: "flex items-center gap-2 font-medium hover:underline",
|
|
200
|
-
children: [/* @__PURE__ */
|
|
202
|
+
children: [/* @__PURE__ */ _(l, { icon: t.icon }), /* @__PURE__ */ _("span", {
|
|
201
203
|
className: "truncate",
|
|
202
204
|
children: t.title
|
|
203
205
|
})]
|
|
204
206
|
}), A.map((e) => {
|
|
205
207
|
let n = b(e, t.properties?.[e.id]);
|
|
206
|
-
return n ? /* @__PURE__ */
|
|
208
|
+
return n ? /* @__PURE__ */ v("p", {
|
|
207
209
|
className: "mt-1 truncate text-xs text-muted-foreground",
|
|
208
210
|
children: [
|
|
209
211
|
e.name,
|
|
@@ -218,4 +220,4 @@ function T({ workspace: e, space: t, docs: a, props: d, by: m }) {
|
|
|
218
220
|
})
|
|
219
221
|
});
|
|
220
222
|
}
|
|
221
|
-
export {
|
|
223
|
+
export { D as Board, E as DocTable, C as groupable, T as listsTop, w as useSpaceDocs };
|
|
@@ -1,158 +1,177 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
1
|
+
import { projectsQuery as e } from "../api/queries.js";
|
|
2
|
+
import { docRef as t } from "../lib/docs.js";
|
|
3
|
+
import { useFavorites as n } from "../lib/favorites.js";
|
|
4
|
+
import { projectLevel as r } from "../lib/projects.js";
|
|
5
|
+
import { useCan as i } from "../lib/roles.js";
|
|
6
|
+
import { useNavigate as a } from "../lib/router.js";
|
|
7
|
+
import { teamPath as o } from "../lib/teamPaths.js";
|
|
8
|
+
import { DocIcon as s } from "./DocIcon.js";
|
|
9
|
+
import { EntityIcon as c } from "./EntityIcon.js";
|
|
10
|
+
import { CycleIcon as l, FileTextIcon as u, InboxIcon as d, LibraryIcon as f, ListViewIcon as p, ProjectIcon as m, StatusIcon as h, UserIcon as g } from "./icons.js";
|
|
11
|
+
import { NewProjectDialog as _ } from "./NewProjectDialog.js";
|
|
12
|
+
import { menuDivider as v, useOpenMenu as y } from "@parallelworks/ui";
|
|
13
|
+
import { useState as b } from "react";
|
|
14
|
+
import { useTranslations as x } from "use-intl";
|
|
15
|
+
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
16
|
+
import { useQuery as w } from "@tanstack/react-query";
|
|
17
|
+
import { MoreButton as T } from "@parallelworks/ui/list";
|
|
18
|
+
import { AppFrameNavGroup as E, AppFrameNavItem as D } from "@parallelworks/ui/app-frame";
|
|
14
19
|
// src/components/FavoritesNav.tsx
|
|
15
|
-
var
|
|
16
|
-
function
|
|
17
|
-
switch (
|
|
20
|
+
var O = (...e) => e.filter(Boolean).join(" ");
|
|
21
|
+
function k(e, n, r, i) {
|
|
22
|
+
switch (e.kind) {
|
|
18
23
|
case "issue": return {
|
|
19
|
-
href: `/${n}/issues/${
|
|
20
|
-
label:
|
|
21
|
-
icon:
|
|
22
|
-
category:
|
|
23
|
-
review:
|
|
24
|
-
step:
|
|
24
|
+
href: `/${n}/issues/${e.issue?.identifier ?? ""}`,
|
|
25
|
+
label: e.issue ? `${e.issue.identifier} ${e.issue.title}` : i("issue"),
|
|
26
|
+
icon: e.issue ? /* @__PURE__ */ S(h, {
|
|
27
|
+
category: e.issue.status.category,
|
|
28
|
+
review: e.issue.status.review,
|
|
29
|
+
step: e.issue.status.step
|
|
25
30
|
}) : null
|
|
26
31
|
};
|
|
27
32
|
case "team": return {
|
|
28
|
-
href:
|
|
29
|
-
label:
|
|
30
|
-
icon:
|
|
31
|
-
icon:
|
|
32
|
-
color:
|
|
33
|
-
name:
|
|
33
|
+
href: o(n, e.team?.key ?? "", "issues"),
|
|
34
|
+
label: e.team?.name ?? i("team"),
|
|
35
|
+
icon: e.team ? /* @__PURE__ */ S(c, {
|
|
36
|
+
icon: e.team.icon,
|
|
37
|
+
color: e.team.color,
|
|
38
|
+
name: e.team.name
|
|
34
39
|
}) : null
|
|
35
40
|
};
|
|
36
41
|
case "doc": return {
|
|
37
|
-
href: `/${n}/docs/${
|
|
38
|
-
label:
|
|
39
|
-
icon: /* @__PURE__ */
|
|
40
|
-
icon:
|
|
42
|
+
href: `/${n}/docs/${e.doc ? t(e.doc) : ""}`,
|
|
43
|
+
label: e.doc?.title ?? i("doc"),
|
|
44
|
+
icon: /* @__PURE__ */ S(s, {
|
|
45
|
+
icon: e.doc?.icon,
|
|
41
46
|
className: "size-4"
|
|
42
47
|
})
|
|
43
48
|
};
|
|
44
49
|
case "project": return {
|
|
45
|
-
href: `/${n}/projects/${
|
|
46
|
-
label:
|
|
47
|
-
icon:
|
|
48
|
-
icon:
|
|
49
|
-
color:
|
|
50
|
-
name:
|
|
51
|
-
}) : /* @__PURE__ */
|
|
50
|
+
href: `/${n}/projects/${e.plan?.ref ?? e.target}`,
|
|
51
|
+
label: e.plan?.name ?? i("project"),
|
|
52
|
+
icon: e.plan?.icon || e.plan?.color ? /* @__PURE__ */ S(c, {
|
|
53
|
+
icon: e.plan.icon ?? "",
|
|
54
|
+
color: e.plan.color ?? "",
|
|
55
|
+
name: e.plan.name
|
|
56
|
+
}) : /* @__PURE__ */ S(m, { className: "size-4" })
|
|
52
57
|
};
|
|
53
58
|
case "cycle": return {
|
|
54
|
-
href: `${
|
|
55
|
-
label:
|
|
56
|
-
team:
|
|
57
|
-
number:
|
|
58
|
-
}) :
|
|
59
|
-
icon: /* @__PURE__ */
|
|
59
|
+
href: `${o(n, e.team?.key ?? "", "cycles")}/${e.plan?.ref ?? ""}`,
|
|
60
|
+
label: e.plan ? e.plan.name || i("cycleOf", {
|
|
61
|
+
team: e.team?.key ?? "",
|
|
62
|
+
number: e.plan.ref
|
|
63
|
+
}) : i("cycle"),
|
|
64
|
+
icon: /* @__PURE__ */ S(l, { className: "size-4" })
|
|
60
65
|
};
|
|
61
66
|
case "view": return {
|
|
62
|
-
href:
|
|
63
|
-
label:
|
|
64
|
-
icon: /* @__PURE__ */
|
|
67
|
+
href: e.target,
|
|
68
|
+
label: e.label || i("view"),
|
|
69
|
+
icon: /* @__PURE__ */ S(p, { className: "size-4" })
|
|
65
70
|
};
|
|
66
|
-
case "page": return
|
|
71
|
+
case "page": return e.target === "decisions" ? {
|
|
67
72
|
href: `/${n}/decisions`,
|
|
68
|
-
label:
|
|
69
|
-
icon: /* @__PURE__ */
|
|
70
|
-
} :
|
|
73
|
+
label: i("decisions"),
|
|
74
|
+
icon: /* @__PURE__ */ S(d, { className: "size-4" })
|
|
75
|
+
} : e.target === "agents" ? {
|
|
71
76
|
href: `/${n}/agents`,
|
|
72
|
-
label:
|
|
73
|
-
icon: /* @__PURE__ */
|
|
74
|
-
} :
|
|
77
|
+
label: i("agents"),
|
|
78
|
+
icon: /* @__PURE__ */ S(g, { className: "size-4" })
|
|
79
|
+
} : e.target === "projects" ? {
|
|
75
80
|
href: `/${n}/projects`,
|
|
76
|
-
label:
|
|
77
|
-
icon: /* @__PURE__ */
|
|
78
|
-
} :
|
|
81
|
+
label: i("projects"),
|
|
82
|
+
icon: /* @__PURE__ */ S(m, { className: "size-4" })
|
|
83
|
+
} : e.target === "knowledge" ? {
|
|
79
84
|
href: `/${n}/knowledge`,
|
|
80
|
-
label:
|
|
81
|
-
icon: /* @__PURE__ */
|
|
82
|
-
} :
|
|
85
|
+
label: i("knowledge"),
|
|
86
|
+
icon: /* @__PURE__ */ S(f, { className: "size-4" })
|
|
87
|
+
} : e.target === "docs" ? {
|
|
83
88
|
href: `/${n}/docs`,
|
|
84
|
-
label:
|
|
85
|
-
icon: /* @__PURE__ */
|
|
86
|
-
} :
|
|
87
|
-
href: `/${n}/issues?assignee=${
|
|
88
|
-
label:
|
|
89
|
-
icon: /* @__PURE__ */
|
|
89
|
+
label: i("docs"),
|
|
90
|
+
icon: /* @__PURE__ */ S(u, { className: "size-4" })
|
|
91
|
+
} : e.target === "my-issues" ? {
|
|
92
|
+
href: `/${n}/issues?assignee=${r}`,
|
|
93
|
+
label: i("myIssues"),
|
|
94
|
+
icon: /* @__PURE__ */ S(g, { className: "size-4" })
|
|
90
95
|
} : {
|
|
91
96
|
href: `/${n}/issues`,
|
|
92
|
-
label:
|
|
93
|
-
icon: /* @__PURE__ */
|
|
97
|
+
label: i("issues"),
|
|
98
|
+
icon: /* @__PURE__ */ S(p, { className: "size-4" })
|
|
94
99
|
};
|
|
95
100
|
}
|
|
96
101
|
}
|
|
97
|
-
function
|
|
98
|
-
let { favorites:
|
|
99
|
-
|
|
100
|
-
|
|
102
|
+
function A({ workspace: t, myUsername: o, currentHref: s }) {
|
|
103
|
+
let { favorites: c, remove: l, move: u } = n(t), d = y(), f = x("favorites"), p = x("common"), m = x("planning"), h = a(), [g, A] = b(null), [j, M] = b(null), [N, P] = b(null), F = i(t, "manage_projects"), { data: I = [] } = w({
|
|
104
|
+
...e(t),
|
|
105
|
+
enabled: F && c.some((e) => e.kind === "project")
|
|
106
|
+
});
|
|
107
|
+
if (c.length === 0) return null;
|
|
108
|
+
let L = (e) => e.kind === "project" ? I.find((t) => t.id === e.target) : void 0, R = (e) => {
|
|
109
|
+
let t = L(e);
|
|
110
|
+
return F && !!t && !t.template && r(I, t.id) < 5;
|
|
111
|
+
}, z = (e, t) => [
|
|
101
112
|
{
|
|
102
|
-
label:
|
|
103
|
-
onClick: () =>
|
|
113
|
+
label: p("open"),
|
|
114
|
+
onClick: () => h({ href: t })
|
|
104
115
|
},
|
|
116
|
+
...R(e) ? [{
|
|
117
|
+
label: m("newSubProject"),
|
|
118
|
+
onClick: () => P(e.target)
|
|
119
|
+
}] : [],
|
|
105
120
|
{
|
|
106
|
-
label:
|
|
121
|
+
label: p("openInNewTab"),
|
|
107
122
|
href: t,
|
|
108
123
|
target: "_blank"
|
|
109
124
|
},
|
|
110
|
-
|
|
125
|
+
v,
|
|
111
126
|
{
|
|
112
|
-
label:
|
|
113
|
-
onClick: () =>
|
|
127
|
+
label: f("remove"),
|
|
128
|
+
onClick: () => l(e.id)
|
|
114
129
|
}
|
|
115
|
-
],
|
|
116
|
-
if (!
|
|
117
|
-
let t =
|
|
118
|
-
|
|
119
|
-
id:
|
|
130
|
+
], B = (e) => {
|
|
131
|
+
if (!g || g === e) return;
|
|
132
|
+
let t = c.filter((e) => e.id !== g), n = t.findIndex((t) => t.id === e), [r, i] = c.findIndex((e) => e.id === g) < c.findIndex((t) => t.id === e) ? [t[n], t[n + 1]] : [t[n - 1], t[n]];
|
|
133
|
+
u({
|
|
134
|
+
id: g,
|
|
120
135
|
...r && { after: r.id },
|
|
121
136
|
...i && { before: i.id }
|
|
122
137
|
});
|
|
123
138
|
};
|
|
124
|
-
return /* @__PURE__ */
|
|
125
|
-
label:
|
|
139
|
+
return /* @__PURE__ */ C(E, {
|
|
140
|
+
label: f("title"),
|
|
126
141
|
collapsible: !1,
|
|
127
|
-
children:
|
|
128
|
-
let n =
|
|
129
|
-
return /* @__PURE__ */
|
|
142
|
+
children: [c.map((e) => {
|
|
143
|
+
let n = k(e, t, o, f);
|
|
144
|
+
return /* @__PURE__ */ S(D, {
|
|
130
145
|
label: n.label,
|
|
131
146
|
icon: n.icon,
|
|
132
147
|
href: n.href,
|
|
133
|
-
selected: n.href ===
|
|
148
|
+
selected: n.href === s,
|
|
134
149
|
draggable: !0,
|
|
135
|
-
onDragStart: (
|
|
136
|
-
|
|
150
|
+
onDragStart: (t) => {
|
|
151
|
+
A(e.id), t.dataTransfer.effectAllowed = "move";
|
|
137
152
|
},
|
|
138
|
-
onDragOver: (
|
|
139
|
-
|
|
153
|
+
onDragOver: (t) => {
|
|
154
|
+
t.preventDefault(), M(e.id);
|
|
140
155
|
},
|
|
141
|
-
onDragLeave: () =>
|
|
142
|
-
onDrop: (
|
|
143
|
-
|
|
156
|
+
onDragLeave: () => M((t) => t === e.id ? null : t),
|
|
157
|
+
onDrop: (t) => {
|
|
158
|
+
t.preventDefault(), B(e.id), A(null), M(null);
|
|
144
159
|
},
|
|
145
160
|
onDragEnd: () => {
|
|
146
|
-
|
|
161
|
+
A(null), M(null);
|
|
147
162
|
},
|
|
148
|
-
onContextMenu: (
|
|
149
|
-
className:
|
|
150
|
-
action: /* @__PURE__ */
|
|
151
|
-
items: () =>
|
|
152
|
-
label:
|
|
163
|
+
onContextMenu: (t) => d(t, z(e, n.href)),
|
|
164
|
+
className: O(g === e.id && "opacity-40", j === e.id && g !== e.id && "ring-1 ring-primary/60"),
|
|
165
|
+
action: /* @__PURE__ */ S(T, {
|
|
166
|
+
items: () => z(e, n.href),
|
|
167
|
+
label: p("moreActionsFor", { name: n.label })
|
|
153
168
|
})
|
|
154
|
-
},
|
|
155
|
-
})
|
|
169
|
+
}, e.id);
|
|
170
|
+
}), N && /* @__PURE__ */ S(_, {
|
|
171
|
+
workspace: t,
|
|
172
|
+
parentId: N,
|
|
173
|
+
onClose: () => P(null)
|
|
174
|
+
})]
|
|
156
175
|
});
|
|
157
176
|
}
|
|
158
|
-
export {
|
|
177
|
+
export { A as FavoritesNav };
|