@parallelworks/tandem-web 0.179.1 → 0.180.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 +49 -23
- package/_virtual/_virtual_i18n/es/common.js +49 -23
- package/_virtual/_virtual_i18n/ja/common.js +49 -23
- package/_virtual/_virtual_i18n/ko/common.js +49 -23
- package/_virtual/_virtual_i18n/zh/common.js +49 -23
- package/components/AgentWork.js +419 -382
- package/components/DocOutline.js +38 -35
- package/components/DocSeries.js +92 -88
- package/components/DocTable.js +100 -93
- package/components/HoverCards.js +139 -124
- package/components/SharedViewer.js +1 -0
- package/components/SubPages.js +101 -44
- package/components/SubpageViews.js +475 -0
- package/lib/docs.js +76 -65
- package/lib/glossary.js +11 -7
- package/lib/subpageViews.js +85 -0
- package/package.json +1 -1
- package/pages/decisions.js +90 -168
- package/routes/_workspace/docs/_doc2.js +279 -235
- package/routes/_workspace/docs/space2._space.js +113 -172
- package/routes/_workspace/issues/_identifier2.js +1 -1
- package/routes/_workspace/teams/_key/settings2.js +96 -24
- package/routes/_workspace2.js +9 -9
- package/styles.css +12 -0
- package/components/DocCalendar.js +0 -245
|
@@ -91,13 +91,18 @@ function re() {
|
|
|
91
91
|
})
|
|
92
92
|
]
|
|
93
93
|
}),
|
|
94
|
-
/* @__PURE__ */ q(
|
|
94
|
+
/* @__PURE__ */ q(oe, {
|
|
95
95
|
workspace: n,
|
|
96
96
|
team: g,
|
|
97
97
|
teams: i,
|
|
98
98
|
isAdmin: o
|
|
99
99
|
}),
|
|
100
|
-
/* @__PURE__ */ q(
|
|
100
|
+
/* @__PURE__ */ q(ae, {
|
|
101
|
+
workspace: n,
|
|
102
|
+
team: g,
|
|
103
|
+
isAdmin: o
|
|
104
|
+
}),
|
|
105
|
+
/* @__PURE__ */ q(pe, {
|
|
101
106
|
workspace: n,
|
|
102
107
|
teamKey: r,
|
|
103
108
|
isAdmin: a.has("manage_members")
|
|
@@ -120,17 +125,17 @@ function re() {
|
|
|
120
125
|
team: g,
|
|
121
126
|
isAdmin: o
|
|
122
127
|
}),
|
|
123
|
-
/* @__PURE__ */ q(
|
|
128
|
+
/* @__PURE__ */ q(se, {
|
|
124
129
|
workspace: n,
|
|
125
130
|
team: g,
|
|
126
131
|
isAdmin: o
|
|
127
132
|
}),
|
|
128
|
-
/* @__PURE__ */ q(
|
|
133
|
+
/* @__PURE__ */ q(le, {
|
|
129
134
|
workspace: n,
|
|
130
135
|
team: g,
|
|
131
136
|
isAdmin: o
|
|
132
137
|
}),
|
|
133
|
-
/* @__PURE__ */ q(
|
|
138
|
+
/* @__PURE__ */ q(ce, {
|
|
134
139
|
workspace: n,
|
|
135
140
|
team: g,
|
|
136
141
|
isAdmin: o
|
|
@@ -145,12 +150,12 @@ function re() {
|
|
|
145
150
|
teamKey: r,
|
|
146
151
|
isAdmin: a.has("manage_templates")
|
|
147
152
|
}),
|
|
148
|
-
/* @__PURE__ */ q(
|
|
153
|
+
/* @__PURE__ */ q(ue, {
|
|
149
154
|
workspace: n,
|
|
150
155
|
team: g,
|
|
151
156
|
isAdmin: o
|
|
152
157
|
}),
|
|
153
|
-
/* @__PURE__ */ q(
|
|
158
|
+
/* @__PURE__ */ q(fe, {
|
|
154
159
|
workspace: n,
|
|
155
160
|
team: g,
|
|
156
161
|
isAdmin: o
|
|
@@ -160,11 +165,11 @@ function re() {
|
|
|
160
165
|
team: g,
|
|
161
166
|
isAdmin: o
|
|
162
167
|
}),
|
|
163
|
-
/* @__PURE__ */ q(
|
|
168
|
+
/* @__PURE__ */ q(me, {
|
|
164
169
|
workspace: n,
|
|
165
170
|
teamKey: r
|
|
166
171
|
}),
|
|
167
|
-
o && /* @__PURE__ */ q(
|
|
172
|
+
o && /* @__PURE__ */ q(he, {
|
|
168
173
|
workspace: n,
|
|
169
174
|
team: g
|
|
170
175
|
})
|
|
@@ -173,7 +178,74 @@ function re() {
|
|
|
173
178
|
})]
|
|
174
179
|
}) : null;
|
|
175
180
|
}
|
|
176
|
-
|
|
181
|
+
var ie = [
|
|
182
|
+
"issues",
|
|
183
|
+
"projects",
|
|
184
|
+
"areas",
|
|
185
|
+
"decisions",
|
|
186
|
+
"docs"
|
|
187
|
+
];
|
|
188
|
+
function ae({ workspace: n, team: r, isAdmin: i }) {
|
|
189
|
+
let a = G("teamSidebar"), o = G("workspace"), c = W(), l = Z(), u = Y({
|
|
190
|
+
mutationFn: async (i) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
|
|
191
|
+
params: { path: {
|
|
192
|
+
workspace: n,
|
|
193
|
+
key: r.key
|
|
194
|
+
} },
|
|
195
|
+
body: { sidebarHidden: i }
|
|
196
|
+
})),
|
|
197
|
+
onSettled: () => l.invalidateQueries({ queryKey: s(n).queryKey })
|
|
198
|
+
}), d = u.isPending && u.variables ? u.variables : r.sidebarHidden, f = ie.filter((e) => !d.includes(e)), p = [
|
|
199
|
+
{
|
|
200
|
+
page: "triage",
|
|
201
|
+
help: a("triageHelp"),
|
|
202
|
+
available: r.triageEnabled
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
page: "issues",
|
|
206
|
+
available: !0
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
page: "projects",
|
|
210
|
+
available: !0
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
page: "areas",
|
|
214
|
+
available: !0
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
page: "decisions",
|
|
218
|
+
help: a("decisionsHelp"),
|
|
219
|
+
available: !0
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
page: "docs",
|
|
223
|
+
available: !0
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
page: "cycles",
|
|
227
|
+
available: r.cyclesEnabled
|
|
228
|
+
}
|
|
229
|
+
];
|
|
230
|
+
return /* @__PURE__ */ J(z, {
|
|
231
|
+
title: a("title"),
|
|
232
|
+
description: a("description"),
|
|
233
|
+
children: [p.filter((e) => e.available).map(({ page: e, help: t }) => {
|
|
234
|
+
let n = !d.includes(e), r = n && f.length === 1 && f[0] === e;
|
|
235
|
+
return /* @__PURE__ */ q(R, {
|
|
236
|
+
label: o(e),
|
|
237
|
+
helpText: r ? a("keepOne") : t,
|
|
238
|
+
children: /* @__PURE__ */ q(B, {
|
|
239
|
+
"aria-label": o(e),
|
|
240
|
+
checked: n,
|
|
241
|
+
disabled: !i || r || u.isPending,
|
|
242
|
+
onCheckedChange: (t) => u.mutate(t ? d.filter((t) => t !== e) : [...d, e])
|
|
243
|
+
})
|
|
244
|
+
}, e);
|
|
245
|
+
}), u.isError && /* @__PURE__ */ q(P, { children: c(u.error) })]
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
function oe({ workspace: n, team: r, teams: i, isAdmin: a }) {
|
|
177
249
|
let o = G("teamParent"), c = W(), l = Z(), u = Y({
|
|
178
250
|
mutationFn: async (i) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
|
|
179
251
|
params: { path: {
|
|
@@ -219,7 +291,7 @@ function ie({ workspace: n, team: r, teams: i, isAdmin: a }) {
|
|
|
219
291
|
]
|
|
220
292
|
});
|
|
221
293
|
}
|
|
222
|
-
function
|
|
294
|
+
function se({ workspace: n, team: r, isAdmin: a }) {
|
|
223
295
|
let o = G("teamIntake"), c = W(), l = Z(), { data: u } = X(i), d = () => l.invalidateQueries({ queryKey: s(n).queryKey }), f = { params: { path: {
|
|
224
296
|
workspace: n,
|
|
225
297
|
key: r.key
|
|
@@ -259,7 +331,7 @@ function ae({ workspace: n, team: r, isAdmin: a }) {
|
|
|
259
331
|
children: v
|
|
260
332
|
}), /* @__PURE__ */ q(N, {
|
|
261
333
|
text: v,
|
|
262
|
-
label: o("
|
|
334
|
+
label: o("formLink"),
|
|
263
335
|
size: "sm",
|
|
264
336
|
variant: "ghost"
|
|
265
337
|
})]
|
|
@@ -287,7 +359,7 @@ function ae({ workspace: n, team: r, isAdmin: a }) {
|
|
|
287
359
|
children: y
|
|
288
360
|
}), /* @__PURE__ */ q(N, {
|
|
289
361
|
text: y,
|
|
290
|
-
label: o("
|
|
362
|
+
label: o("emailAddress"),
|
|
291
363
|
size: "sm",
|
|
292
364
|
variant: "ghost"
|
|
293
365
|
})]
|
|
@@ -307,7 +379,7 @@ function ae({ workspace: n, team: r, isAdmin: a }) {
|
|
|
307
379
|
]
|
|
308
380
|
});
|
|
309
381
|
}
|
|
310
|
-
function
|
|
382
|
+
function ce({ workspace: n, team: r, isAdmin: i }) {
|
|
311
383
|
let a = G("planning.sla"), o = G("priority"), c = W(), l = Z(), u = Y({
|
|
312
384
|
mutationFn: async (i) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
|
|
313
385
|
params: { path: {
|
|
@@ -357,7 +429,7 @@ function oe({ workspace: n, team: r, isAdmin: i }) {
|
|
|
357
429
|
}, e)), u.isError && /* @__PURE__ */ q(P, { children: c(u.error) })]
|
|
358
430
|
});
|
|
359
431
|
}
|
|
360
|
-
function
|
|
432
|
+
function le({ workspace: n, team: r, isAdmin: i }) {
|
|
361
433
|
let a = G("planning.settings"), o = W(), c = Z(), l = Y({
|
|
362
434
|
mutationFn: async (i) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
|
|
363
435
|
params: { path: {
|
|
@@ -562,7 +634,7 @@ var $ = [
|
|
|
562
634
|
"merge",
|
|
563
635
|
"release"
|
|
564
636
|
];
|
|
565
|
-
function
|
|
637
|
+
function ue({ workspace: n, team: i, isAdmin: a }) {
|
|
566
638
|
let o = G("flow"), c = W(), l = Z(), { data: u = [] } = X(r(n)), d = Y({
|
|
567
639
|
mutationFn: async (r) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
|
|
568
640
|
params: { path: {
|
|
@@ -651,7 +723,7 @@ function ce({ workspace: n, team: i, isAdmin: a }) {
|
|
|
651
723
|
h("release") && /* @__PURE__ */ q(R, {
|
|
652
724
|
label: o("releaseTargets"),
|
|
653
725
|
helpText: o("releaseTargetsHelp"),
|
|
654
|
-
children: /* @__PURE__ */ q(
|
|
726
|
+
children: /* @__PURE__ */ q(de, {
|
|
655
727
|
workspace: n,
|
|
656
728
|
team: i,
|
|
657
729
|
disabled: !a
|
|
@@ -693,7 +765,7 @@ function ce({ workspace: n, team: i, isAdmin: a }) {
|
|
|
693
765
|
]
|
|
694
766
|
});
|
|
695
767
|
}
|
|
696
|
-
function
|
|
768
|
+
function de({ workspace: n, team: r, disabled: i }) {
|
|
697
769
|
let a = G("flow"), o = W(), c = Z(), [l, u] = U(r.releaseTargets.join(", ")), d = Y({
|
|
698
770
|
mutationFn: async (i) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
|
|
699
771
|
params: { path: {
|
|
@@ -721,7 +793,7 @@ function le({ workspace: n, team: r, disabled: i }) {
|
|
|
721
793
|
})
|
|
722
794
|
});
|
|
723
795
|
}
|
|
724
|
-
function
|
|
796
|
+
function fe({ workspace: n, team: r, isAdmin: i }) {
|
|
725
797
|
let a = G("team"), o = W(), c = Z(), l = Y({
|
|
726
798
|
mutationFn: async (i) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
|
|
727
799
|
params: { path: {
|
|
@@ -748,7 +820,7 @@ function ue({ workspace: n, team: r, isAdmin: i }) {
|
|
|
748
820
|
})
|
|
749
821
|
});
|
|
750
822
|
}
|
|
751
|
-
function
|
|
823
|
+
function pe({ workspace: n, teamKey: r, isAdmin: a }) {
|
|
752
824
|
let { data: s } = Q(o(n, r)), { data: c } = Q(i), { members: l, person: u } = ee(n), d = Z(), f = H(), p = E(), [h, g] = U(null), v = G("team"), y = W(), b = G("common"), x = Y({
|
|
753
825
|
mutationFn: async (i) => {
|
|
754
826
|
for (let { username: a, add: o } of i) {
|
|
@@ -882,7 +954,7 @@ function de({ workspace: n, teamKey: r, isAdmin: a }) {
|
|
|
882
954
|
})]
|
|
883
955
|
});
|
|
884
956
|
}
|
|
885
|
-
function
|
|
957
|
+
function me({ workspace: r, teamKey: i }) {
|
|
886
958
|
let { data: o } = Q(a(r, i)), { data: l } = Q(s(r)), u = Z(), d = G("team"), f = Y({
|
|
887
959
|
mutationFn: async (n) => t(await e.PUT("/api/v1/workspaces/{workspace}/teams/{key}/access", {
|
|
888
960
|
params: { path: {
|
|
@@ -932,7 +1004,7 @@ function fe({ workspace: r, teamKey: i }) {
|
|
|
932
1004
|
})
|
|
933
1005
|
});
|
|
934
1006
|
}
|
|
935
|
-
function
|
|
1007
|
+
function he({ workspace: n, team: r }) {
|
|
936
1008
|
let i = G("team"), a = Z(), o = W(), { confirm: c, dialog: l } = S(), u = !!r.archivedAt, d = Y({
|
|
937
1009
|
mutationFn: async (i) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
|
|
938
1010
|
params: { path: {
|
|
@@ -972,14 +1044,14 @@ function pe({ workspace: n, team: r }) {
|
|
|
972
1044
|
children: o(d.error)
|
|
973
1045
|
}),
|
|
974
1046
|
l,
|
|
975
|
-
/* @__PURE__ */ q(
|
|
1047
|
+
/* @__PURE__ */ q(ge, {
|
|
976
1048
|
workspace: n,
|
|
977
1049
|
team: r
|
|
978
1050
|
})
|
|
979
1051
|
]
|
|
980
1052
|
});
|
|
981
1053
|
}
|
|
982
|
-
function
|
|
1054
|
+
function ge({ workspace: n, team: r }) {
|
|
983
1055
|
let i = G("team"), a = Z(), o = E(), c = W(), [l, u] = U(!1), [d, f] = U(""), [p, m] = U(null), h = Y({
|
|
984
1056
|
mutationFn: async () => t(await e.DELETE("/api/v1/workspaces/{workspace}/teams/{key}", { params: { path: {
|
|
985
1057
|
workspace: n,
|
package/routes/_workspace2.js
CHANGED
|
@@ -277,14 +277,14 @@ function at() {
|
|
|
277
277
|
className: "relative flex",
|
|
278
278
|
children: [e, n && t && /* @__PURE__ */ A("span", { className: it })]
|
|
279
279
|
}), s = v.filter((e) => !e.archivedAt), c = new Set(s.map((e) => e.id)), u = (e) => s.filter((t) => (t.parentId && c.has(t.parentId) ? t.parentId : "") === e), f = (e) => {
|
|
280
|
-
let t = (t) => Ie(d, e.key, t), n = kt.filter((t) => t.identifier.startsWith(`${e.key}-`)).length;
|
|
280
|
+
let t = (t) => Ie(d, e.key, t), n = kt.filter((t) => t.identifier.startsWith(`${e.key}-`)).length, i = (t) => !e.sidebarHidden.includes(t);
|
|
281
281
|
return /* @__PURE__ */ j(P, {
|
|
282
282
|
label: e.name,
|
|
283
283
|
icon: o(/* @__PURE__ */ A(l, {
|
|
284
284
|
icon: e.icon,
|
|
285
285
|
color: e.color,
|
|
286
286
|
name: e.name
|
|
287
|
-
}), Mt(e.id) > 0),
|
|
287
|
+
}), i("triage") && Mt(e.id) > 0),
|
|
288
288
|
selected: x(J.pathname, d)?.team === e.key,
|
|
289
289
|
open: !Et.has(e.key),
|
|
290
290
|
onOpenChange: (t) => Ot(e.key, t),
|
|
@@ -294,7 +294,7 @@ function at() {
|
|
|
294
294
|
label: W("moreActionsFor", { name: e.name })
|
|
295
295
|
}),
|
|
296
296
|
children: [
|
|
297
|
-
e.triageEnabled && /* @__PURE__ */ A(F, {
|
|
297
|
+
e.triageEnabled && i("triage") && /* @__PURE__ */ A(F, {
|
|
298
298
|
label: U("triage"),
|
|
299
299
|
icon: /* @__PURE__ */ A(de, { className: "size-4" }),
|
|
300
300
|
href: t("triage"),
|
|
@@ -306,28 +306,28 @@ function at() {
|
|
|
306
306
|
label: U("triageCount")
|
|
307
307
|
})
|
|
308
308
|
}),
|
|
309
|
-
/* @__PURE__ */ A(F, {
|
|
309
|
+
i("issues") && /* @__PURE__ */ A(F, {
|
|
310
310
|
label: U("issues"),
|
|
311
311
|
icon: /* @__PURE__ */ A(ce, { className: "size-4" }),
|
|
312
312
|
href: t("issues"),
|
|
313
313
|
selected: Tt.team === e.key,
|
|
314
314
|
onContextMenu: a(t("issues"))
|
|
315
315
|
}),
|
|
316
|
-
/* @__PURE__ */ A(F, {
|
|
316
|
+
i("projects") && /* @__PURE__ */ A(F, {
|
|
317
317
|
label: U("projects"),
|
|
318
318
|
icon: /* @__PURE__ */ A(ue, { className: "size-4" }),
|
|
319
319
|
href: t("projects"),
|
|
320
320
|
selected: Y("projects", e.key),
|
|
321
321
|
onContextMenu: a(t("projects"))
|
|
322
322
|
}),
|
|
323
|
-
/* @__PURE__ */ A(F, {
|
|
323
|
+
i("areas") && /* @__PURE__ */ A(F, {
|
|
324
324
|
label: U("areas"),
|
|
325
325
|
icon: /* @__PURE__ */ A(ne, { className: "size-4" }),
|
|
326
326
|
href: t("areas"),
|
|
327
327
|
selected: Y("areas", e.key),
|
|
328
328
|
onContextMenu: a(t("areas"))
|
|
329
329
|
}),
|
|
330
|
-
/* @__PURE__ */ A(F, {
|
|
330
|
+
i("decisions") && /* @__PURE__ */ A(F, {
|
|
331
331
|
label: U("decisions"),
|
|
332
332
|
icon: /* @__PURE__ */ A(oe, { className: "size-4" }),
|
|
333
333
|
href: t("decisions"),
|
|
@@ -340,14 +340,14 @@ function at() {
|
|
|
340
340
|
className: "bg-agent! text-agent-foreground!"
|
|
341
341
|
})
|
|
342
342
|
}),
|
|
343
|
-
/* @__PURE__ */ A(F, {
|
|
343
|
+
i("docs") && /* @__PURE__ */ A(F, {
|
|
344
344
|
label: U("docs"),
|
|
345
345
|
icon: /* @__PURE__ */ A(ae, { className: "size-4" }),
|
|
346
346
|
href: `/${d}/docs/space/${e.key}`,
|
|
347
347
|
selected: r(`/${d}/docs/space/${e.key}`),
|
|
348
348
|
onContextMenu: a(`/${d}/docs/space/${e.key}`)
|
|
349
349
|
}),
|
|
350
|
-
e.cyclesEnabled && /* @__PURE__ */ A(F, {
|
|
350
|
+
e.cyclesEnabled && i("cycles") && /* @__PURE__ */ A(F, {
|
|
351
351
|
label: U("cycles"),
|
|
352
352
|
icon: /* @__PURE__ */ A(ie, { className: "size-4" }),
|
|
353
353
|
href: t("cycles"),
|
package/styles.css
CHANGED
|
@@ -572,6 +572,8 @@ body[data-tandem] > :not(:has(.tandem)) {
|
|
|
572
572
|
}
|
|
573
573
|
.prose-issue .sub-pages a.sub-pages-link {
|
|
574
574
|
display: flex;
|
|
575
|
+
flex: 1;
|
|
576
|
+
min-width: 0;
|
|
575
577
|
align-items: center;
|
|
576
578
|
gap: 0.5rem;
|
|
577
579
|
border: 0;
|
|
@@ -586,6 +588,16 @@ body[data-tandem] > :not(:has(.tandem)) {
|
|
|
586
588
|
.prose-issue .sub-pages a.sub-pages-link:hover {
|
|
587
589
|
background: var(--color-muted);
|
|
588
590
|
}
|
|
591
|
+
/* A sub-page being renamed in its row (SubPages). */
|
|
592
|
+
.prose-issue .sub-pages .sub-pages-rename {
|
|
593
|
+
flex: 1;
|
|
594
|
+
min-width: 0;
|
|
595
|
+
border-radius: 0.375rem;
|
|
596
|
+
border: 1px solid var(--color-border);
|
|
597
|
+
background: var(--color-background);
|
|
598
|
+
padding: 0.25rem 0.5rem;
|
|
599
|
+
font: inherit;
|
|
600
|
+
}
|
|
589
601
|
/* An issue synced with the one a link goes to, after the link (LinkedIssues). */
|
|
590
602
|
.prose-issue .linked-issue {
|
|
591
603
|
display: inline-flex;
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import { api as e, unwrap as t } from "../api/client.js";
|
|
2
|
-
import { docTemplatesQuery as n, teamsQuery as r } from "../api/queries.js";
|
|
3
|
-
import { fromIsoDate as i, isoDate as a } from "../lib/datePhrases.js";
|
|
4
|
-
import { spaceScope as o } from "../lib/docProperties.js";
|
|
5
|
-
import { docSeriesQuery as s, useDocSeriesActions as c } from "../lib/docSeries.js";
|
|
6
|
-
import { docRef as l } from "../lib/docs.js";
|
|
7
|
-
import { useCan as u } from "../lib/roles.js";
|
|
8
|
-
import { DocIcon as d } from "./DocIcon.js";
|
|
9
|
-
import { useSpaceDocs as f } from "./DocTable.js";
|
|
10
|
-
import { AddIcon as p, ChevronRightIcon as m, CycleIcon as h } from "./icons.js";
|
|
11
|
-
import { Button as g, cx as _ } from "@parallelworks/ui";
|
|
12
|
-
import { Link as ee, useNavigate as v } from "@tanstack/react-router";
|
|
13
|
-
import { useMemo as y, useState as te } from "react";
|
|
14
|
-
import { useFormatter as b, useLocale as ne, useTranslations as x } from "use-intl";
|
|
15
|
-
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
16
|
-
import { useMutation as w, useQuery as re, useQueryClient as T } from "@tanstack/react-query";
|
|
17
|
-
// src/components/DocCalendar.tsx
|
|
18
|
-
var E = (e, t) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
|
|
19
|
-
function ie(e) {
|
|
20
|
-
let t = new Intl.Locale(e);
|
|
21
|
-
return (t.getWeekInfo?.().firstDay ?? t.weekInfo?.firstDay ?? 7) % 7;
|
|
22
|
-
}
|
|
23
|
-
var D = (e, t) => E(e, -((e.getDay() - t + 7) % 7));
|
|
24
|
-
function O(i, o, s) {
|
|
25
|
-
let c = x("docViews"), u = b(), d = T(), f = v();
|
|
26
|
-
return w({
|
|
27
|
-
mutationFn: async (l) => {
|
|
28
|
-
let [f, p] = await Promise.all([d.fetchQuery(n(i)), d.fetchQuery(r(i))]), m = o === "workspace" ? "" : p.find((e) => e.key === o)?.id ?? "", h = f.find((e) => e.spaceDefault && (e.teamId ?? "") === m), g = a(l), _ = t(await e.POST("/api/v1/workspaces/{workspace}/docs", {
|
|
29
|
-
params: { path: { workspace: i } },
|
|
30
|
-
body: {
|
|
31
|
-
title: c("meetingTitle", { date: u.dateTime(l, { dateStyle: "medium" }) }),
|
|
32
|
-
template: h?.id ?? "meeting-notes",
|
|
33
|
-
variables: { date: g },
|
|
34
|
-
...o !== "workspace" && { team: o }
|
|
35
|
-
}
|
|
36
|
-
}));
|
|
37
|
-
return s && await e.PATCH("/api/v1/workspaces/{workspace}/docs/{doc}/properties", {
|
|
38
|
-
params: { path: {
|
|
39
|
-
workspace: i,
|
|
40
|
-
doc: _.key
|
|
41
|
-
} },
|
|
42
|
-
body: { values: { [s]: g } }
|
|
43
|
-
}), _;
|
|
44
|
-
},
|
|
45
|
-
onSuccess: (e) => {
|
|
46
|
-
d.invalidateQueries({ queryKey: [
|
|
47
|
-
"workspace",
|
|
48
|
-
i,
|
|
49
|
-
"docs"
|
|
50
|
-
] }), f({
|
|
51
|
-
to: "/$workspace/docs/$doc",
|
|
52
|
-
params: {
|
|
53
|
-
workspace: i,
|
|
54
|
-
doc: l(e)
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
function k({ workspace: e, space: t, config: n, query: r = "" }) {
|
|
61
|
-
let w = x("docViews"), T = b(), k = ie(ne()), A = u(e, "edit_docs", o(t)), { docs: j, props: oe, isPending: se } = f(e, t, n), M = r.trim().toLowerCase(), N = M ? j.filter((e) => e.title.toLowerCase().includes(M)) : j, P = oe.find((e) => e.id === n.dateProperty && e.kind === "date"), F = O(e, t, P?.id), I = y(() => {
|
|
62
|
-
let e = /* @__PURE__ */ new Date();
|
|
63
|
-
return new Date(e.getFullYear(), e.getMonth(), e.getDate());
|
|
64
|
-
}, []), [L, R] = te(I), ce = v(), z = c(e), B = D(new Date(L.getFullYear(), L.getMonth(), 1), k), { data: V = [] } = re(s(e, t, a(B), a(E(B, 41)))), H = y(() => {
|
|
65
|
-
let e = /* @__PURE__ */ new Map();
|
|
66
|
-
for (let t of V) for (let n of t.upcoming ?? []) e.set(n, [...e.get(n) ?? [], t]);
|
|
67
|
-
return e;
|
|
68
|
-
}, [V]), U = y(() => {
|
|
69
|
-
let e = /* @__PURE__ */ new Map();
|
|
70
|
-
if (!P) return e;
|
|
71
|
-
for (let t of N) {
|
|
72
|
-
let n = t.properties?.[P.id];
|
|
73
|
-
typeof n == "string" && i(n) && e.set(n, [...e.get(n) ?? [], t]);
|
|
74
|
-
}
|
|
75
|
-
return e;
|
|
76
|
-
}, [N, P]);
|
|
77
|
-
if (se) return /* @__PURE__ */ S("p", {
|
|
78
|
-
className: "p-4 text-sm text-muted-foreground",
|
|
79
|
-
children: w("loading")
|
|
80
|
-
});
|
|
81
|
-
if (!P) return /* @__PURE__ */ S("p", {
|
|
82
|
-
className: "p-4 text-sm text-muted-foreground",
|
|
83
|
-
children: w("pickDate")
|
|
84
|
-
});
|
|
85
|
-
let W = new Date(L.getFullYear(), L.getMonth(), 1), G = D(W, k), le = Math.ceil(((W.getTime() - G.getTime()) / 864e5 + ae(W)) / 7), K = Array.from({ length: le * 7 }, (e, t) => E(G, t)), q = D(L, k), J = Array.from({ length: 7 }, (e, t) => E(q, t)), Y = (e) => R((t) => new Date(t.getFullYear(), t.getMonth() + e, Math.min(t.getDate(), 28))), X = (e) => R((t) => E(t, 7 * e)), Z = (t) => /* @__PURE__ */ C(ee, {
|
|
86
|
-
to: "/$workspace/docs/$doc",
|
|
87
|
-
params: {
|
|
88
|
-
workspace: e,
|
|
89
|
-
doc: l(t)
|
|
90
|
-
},
|
|
91
|
-
className: "flex min-w-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-xs hover:bg-accent",
|
|
92
|
-
children: [/* @__PURE__ */ S(d, { icon: t.icon }), /* @__PURE__ */ S("span", {
|
|
93
|
-
className: "truncate",
|
|
94
|
-
children: t.title
|
|
95
|
-
})]
|
|
96
|
-
}, t.id), Q = (t, n) => /* @__PURE__ */ C("button", {
|
|
97
|
-
type: "button",
|
|
98
|
-
disabled: !A || z.makeDoc.isPending,
|
|
99
|
-
onClick: () => z.makeDoc.mutate({
|
|
100
|
-
id: t.id,
|
|
101
|
-
day: n
|
|
102
|
-
}, { onSuccess: (t) => ce({
|
|
103
|
-
to: "/$workspace/docs/$doc",
|
|
104
|
-
params: {
|
|
105
|
-
workspace: e,
|
|
106
|
-
doc: l(t)
|
|
107
|
-
}
|
|
108
|
-
}) }),
|
|
109
|
-
"aria-label": w("makeSeriesDoc", { series: t.title }),
|
|
110
|
-
className: "flex min-w-0 items-center gap-1 rounded border border-dashed border-border px-1.5 py-0.5 text-left text-xs text-muted-foreground enabled:hover:border-primary enabled:hover:text-foreground",
|
|
111
|
-
children: [/* @__PURE__ */ S(h, { className: "size-3 shrink-0" }), /* @__PURE__ */ S("span", {
|
|
112
|
-
className: "truncate",
|
|
113
|
-
children: t.title
|
|
114
|
-
})]
|
|
115
|
-
}, `${t.id}-${n}`), $ = (e) => A && /* @__PURE__ */ S("button", {
|
|
116
|
-
type: "button",
|
|
117
|
-
onClick: () => F.mutate(e),
|
|
118
|
-
disabled: F.isPending,
|
|
119
|
-
"aria-label": w("newMeetingOn", { date: T.dateTime(e, { dateStyle: "medium" }) }),
|
|
120
|
-
className: "rounded px-1 text-xs text-muted-foreground opacity-0 group-hover:opacity-100 max-sm:opacity-100 focus-visible:opacity-100 hover:bg-accent hover:text-foreground",
|
|
121
|
-
children: /* @__PURE__ */ S(p, { className: "size-3.5" })
|
|
122
|
-
});
|
|
123
|
-
return /* @__PURE__ */ C("div", {
|
|
124
|
-
className: "flex flex-col",
|
|
125
|
-
children: [
|
|
126
|
-
/* @__PURE__ */ C("div", {
|
|
127
|
-
className: "flex items-center gap-2 px-4 py-2 md:px-5",
|
|
128
|
-
children: [
|
|
129
|
-
/* @__PURE__ */ S("h2", {
|
|
130
|
-
className: "text-sm font-medium max-sm:hidden",
|
|
131
|
-
children: T.dateTime(W, {
|
|
132
|
-
month: "long",
|
|
133
|
-
year: "numeric"
|
|
134
|
-
})
|
|
135
|
-
}),
|
|
136
|
-
/* @__PURE__ */ S("h2", {
|
|
137
|
-
className: "text-sm font-medium sm:hidden",
|
|
138
|
-
children: T.dateTimeRange(J[0], J[6], { dateStyle: "medium" })
|
|
139
|
-
}),
|
|
140
|
-
/* @__PURE__ */ C("span", {
|
|
141
|
-
className: "ml-auto flex items-center gap-1",
|
|
142
|
-
children: [
|
|
143
|
-
/* @__PURE__ */ S(g, {
|
|
144
|
-
size: "xs",
|
|
145
|
-
variant: "ghost",
|
|
146
|
-
onClick: () => R(I),
|
|
147
|
-
children: w("today")
|
|
148
|
-
}),
|
|
149
|
-
/* @__PURE__ */ C("span", {
|
|
150
|
-
className: "flex gap-1 max-sm:hidden",
|
|
151
|
-
children: [/* @__PURE__ */ S(g, {
|
|
152
|
-
size: "xs",
|
|
153
|
-
variant: "ghost",
|
|
154
|
-
onClick: () => Y(-1),
|
|
155
|
-
"aria-label": w("previousMonth"),
|
|
156
|
-
children: /* @__PURE__ */ S(m, { className: "rotate-180" })
|
|
157
|
-
}), /* @__PURE__ */ S(g, {
|
|
158
|
-
size: "xs",
|
|
159
|
-
variant: "ghost",
|
|
160
|
-
onClick: () => Y(1),
|
|
161
|
-
"aria-label": w("nextMonth"),
|
|
162
|
-
children: /* @__PURE__ */ S(m, {})
|
|
163
|
-
})]
|
|
164
|
-
}),
|
|
165
|
-
/* @__PURE__ */ C("span", {
|
|
166
|
-
className: "flex gap-1 sm:hidden",
|
|
167
|
-
children: [/* @__PURE__ */ S(g, {
|
|
168
|
-
size: "xs",
|
|
169
|
-
variant: "ghost",
|
|
170
|
-
onClick: () => X(-1),
|
|
171
|
-
"aria-label": w("previousWeek"),
|
|
172
|
-
children: /* @__PURE__ */ S(m, { className: "rotate-180" })
|
|
173
|
-
}), /* @__PURE__ */ S(g, {
|
|
174
|
-
size: "xs",
|
|
175
|
-
variant: "ghost",
|
|
176
|
-
onClick: () => X(1),
|
|
177
|
-
"aria-label": w("nextWeek"),
|
|
178
|
-
children: /* @__PURE__ */ S(m, {})
|
|
179
|
-
})]
|
|
180
|
-
})
|
|
181
|
-
]
|
|
182
|
-
})
|
|
183
|
-
]
|
|
184
|
-
}),
|
|
185
|
-
/* @__PURE__ */ C("div", {
|
|
186
|
-
className: "max-sm:hidden",
|
|
187
|
-
children: [/* @__PURE__ */ S("div", {
|
|
188
|
-
className: "grid grid-cols-7 border-y border-border text-xs text-muted-foreground",
|
|
189
|
-
children: K.slice(0, 7).map((e) => /* @__PURE__ */ S("span", {
|
|
190
|
-
className: "px-2 py-1",
|
|
191
|
-
children: T.dateTime(e, { weekday: "short" })
|
|
192
|
-
}, e.getDay()))
|
|
193
|
-
}), /* @__PURE__ */ S("ol", {
|
|
194
|
-
className: "grid grid-cols-7",
|
|
195
|
-
"aria-label": w("calendar"),
|
|
196
|
-
children: K.map((e) => {
|
|
197
|
-
let t = a(e), n = U.get(t) ?? [], r = e.getMonth() === W.getMonth();
|
|
198
|
-
return /* @__PURE__ */ C("li", {
|
|
199
|
-
"aria-label": T.dateTime(e, { dateStyle: "full" }),
|
|
200
|
-
className: _("group flex min-h-24 min-w-0 flex-col gap-1 border-r border-b border-border p-1.5", !r && "bg-muted/30"),
|
|
201
|
-
children: [
|
|
202
|
-
/* @__PURE__ */ C("span", {
|
|
203
|
-
className: "flex items-center justify-between",
|
|
204
|
-
children: [/* @__PURE__ */ S("span", {
|
|
205
|
-
className: _("flex size-6 items-center justify-center rounded-full text-xs tabular-nums", t === a(I) ? "bg-primary text-primary-foreground" : r ? "" : "text-muted-foreground"),
|
|
206
|
-
children: e.getDate()
|
|
207
|
-
}), $(e)]
|
|
208
|
-
}),
|
|
209
|
-
n.map(Z),
|
|
210
|
-
(H.get(t) ?? []).map((e) => Q(e, t))
|
|
211
|
-
]
|
|
212
|
-
}, t);
|
|
213
|
-
})
|
|
214
|
-
})]
|
|
215
|
-
}),
|
|
216
|
-
/* @__PURE__ */ S("ol", {
|
|
217
|
-
className: "divide-y divide-border border-y border-border sm:hidden",
|
|
218
|
-
"aria-label": w("calendar"),
|
|
219
|
-
children: J.map((e) => {
|
|
220
|
-
let t = a(e), n = U.get(t) ?? [];
|
|
221
|
-
return /* @__PURE__ */ C("li", {
|
|
222
|
-
className: "group flex flex-col gap-1 px-4 py-2",
|
|
223
|
-
children: [
|
|
224
|
-
/* @__PURE__ */ C("span", {
|
|
225
|
-
className: "flex items-center justify-between text-xs",
|
|
226
|
-
children: [/* @__PURE__ */ S("span", {
|
|
227
|
-
className: _(t === a(I) ? "font-medium text-primary" : "text-muted-foreground"),
|
|
228
|
-
children: T.dateTime(e, {
|
|
229
|
-
weekday: "long",
|
|
230
|
-
month: "short",
|
|
231
|
-
day: "numeric"
|
|
232
|
-
})
|
|
233
|
-
}), $(e)]
|
|
234
|
-
}),
|
|
235
|
-
n.map(Z),
|
|
236
|
-
(H.get(t) ?? []).map((e) => Q(e, t))
|
|
237
|
-
]
|
|
238
|
-
}, t);
|
|
239
|
-
})
|
|
240
|
-
})
|
|
241
|
-
]
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
var ae = (e) => new Date(e.getFullYear(), e.getMonth() + 1, 0).getDate();
|
|
245
|
-
export { k as DocCalendar, O as useNewMeetingNotes };
|