@nivaro/react 0.3.50 → 0.3.52
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/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +13 -3
- package/dist/shared/components/ItemEditForm.js +4801 -4666
- package/dist/shared/components/QueryTable.js +337 -324
- package/dist/shared/components/ReportView.js +105 -99
- package/dist/shared/components/alerts/AlertManagerView.js +327 -301
- package/dist/shared/components/item-edit/CatalogPickerField.js +1149 -1111
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
- package/dist/shared/components/item-edit/FieldRenderer.js +227 -223
- package/dist/shared/components/item-edit/FieldRow.js +287 -265
- package/dist/shared/components/item-edit/FilePickerField.js +315 -307
- package/dist/shared/components/item-edit/InlineTableField.js +491 -466
- package/dist/shared/components/item-edit/RecordHeaderActions.js +76 -75
- package/dist/shared/components/item-edit/RecordLiveSync.js +93 -91
- package/dist/shared/components/item-edit/RelationCombobox.js +62 -60
- package/dist/shared/components/item-edit/SummaryPanel.js +287 -277
- package/dist/shared/components/item-edit/UserChip.js +233 -200
- package/dist/shared/components/item-edit/header-midair.js +51 -0
- package/dist/shared/components/item-edit/line-midair.js +76 -70
- package/dist/shared/components/panels/CommentPanel.js +290 -284
- package/dist/shared/components/panels/ItemLockBanner.js +30 -30
- package/dist/shared/components/panels/PipelinePanel.js +956 -901
- package/dist/shared/components/panels/TaskPanel.js +71 -61
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +569 -439
- package/dist/shared/components/panels/requirement-side-effects.js +40 -0
- package/dist/shared/components/queue/QueueWorklist.js +141 -130
- package/dist/shared/lib/draft-store.js +48 -34
- package/dist/shared/lib/query-stats.js +60 -60
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as n, jsx as t, Fragment as Ae } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient as Fe, useQuery as q, useMutation as K } from "@tanstack/react-query";
|
|
3
3
|
import { ClipboardList as De, ChevronDown as de, X as Z, Plus as Ee, Bot as Ie, Users as Le, History as We, Pencil as Oe, RotateCcw as je, ChevronsUpDown as ge, Check as Ue } from "lucide-react";
|
|
4
|
-
import { useState as
|
|
4
|
+
import { useState as w, useRef as Ke, useEffect as xe, useMemo as Re } from "react";
|
|
5
5
|
import { toast as v } from "sonner";
|
|
6
6
|
import { useNivaroClient as O, useItemEditAuth as Me } from "../../context.js";
|
|
7
7
|
import { get as P, post as Q, patch as He, del as Be } from "../../lib/commands.js";
|
|
@@ -31,9 +31,9 @@ function Se(a) {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
function Xe(a, i) {
|
|
34
|
-
return a.map((
|
|
35
|
-
const c = i.get(
|
|
36
|
-
return
|
|
34
|
+
return a.map((d) => {
|
|
35
|
+
const c = i.get(d.field) ?? d.field.replace(/_/g, " ");
|
|
36
|
+
return d.op === "nnull" ? `${c} is filled in` : d.op === "eq" ? `${c} is ${String(d.value ?? "")}` : d.op === "null" ? `${c} is empty` : `${c} ${d.op} ${String(d.value ?? "")}`.trim();
|
|
37
37
|
}).join(" and ");
|
|
38
38
|
}
|
|
39
39
|
function ue({ priority: a }) {
|
|
@@ -48,11 +48,11 @@ function ue({ priority: a }) {
|
|
|
48
48
|
function Qe({
|
|
49
49
|
collection: a,
|
|
50
50
|
item: i,
|
|
51
|
-
value:
|
|
51
|
+
value: d,
|
|
52
52
|
valueLabel: c,
|
|
53
53
|
onChange: r
|
|
54
54
|
}) {
|
|
55
|
-
const u = O(), [x, m] =
|
|
55
|
+
const u = O(), [x, m] = w(!1), [h, o] = w(""), [f, b] = w("");
|
|
56
56
|
xe(() => {
|
|
57
57
|
const s = setTimeout(() => b(h.trim()), 250);
|
|
58
58
|
return () => clearTimeout(s);
|
|
@@ -74,7 +74,7 @@ function Qe({
|
|
|
74
74
|
).then((s) => s.data).catch(() => []),
|
|
75
75
|
enabled: x,
|
|
76
76
|
staleTime: 6e4
|
|
77
|
-
}),
|
|
77
|
+
}), _ = T.data ?? [], y = new Set(_.map((s) => String(s.id).toUpperCase())), C = f.toLowerCase(), l = _.filter(
|
|
78
78
|
(s) => !C || `${V(s)} ${s.email ?? ""}`.toLowerCase().includes(C)
|
|
79
79
|
), g = (A.data ?? []).filter((s) => !y.has(String(s.id).toUpperCase())), N = [...l, ...g].map((s) => s.id), { data: E } = q({
|
|
80
80
|
queryKey: ["task-open-counts", N.join(",")],
|
|
@@ -90,7 +90,7 @@ function Qe({
|
|
|
90
90
|
{
|
|
91
91
|
value: s.id,
|
|
92
92
|
onSelect: () => {
|
|
93
|
-
r($(s.id,
|
|
93
|
+
r($(s.id, d) ? null : s.id, $(s.id, d) ? null : s), m(!1);
|
|
94
94
|
},
|
|
95
95
|
className: "text-[12px]",
|
|
96
96
|
"data-task-person": s.id,
|
|
@@ -98,7 +98,7 @@ function Qe({
|
|
|
98
98
|
/* @__PURE__ */ t(
|
|
99
99
|
Ue,
|
|
100
100
|
{
|
|
101
|
-
className: R("mr-2 h-3.5 w-3.5", $(
|
|
101
|
+
className: R("mr-2 h-3.5 w-3.5", $(d, s.id) ? "opacity-100" : "opacity-0")
|
|
102
102
|
}
|
|
103
103
|
),
|
|
104
104
|
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate", children: [
|
|
@@ -129,7 +129,7 @@ function Qe({
|
|
|
129
129
|
"data-task-assignee-picker": !0,
|
|
130
130
|
className: "h-8 w-full justify-between px-2.5 text-[12px] font-normal",
|
|
131
131
|
children: [
|
|
132
|
-
/* @__PURE__ */ t("span", { className: R("truncate", !
|
|
132
|
+
/* @__PURE__ */ t("span", { className: R("truncate", !d && "text-muted-foreground"), children: d ? c ?? "Selected" : "Assign to…" }),
|
|
133
133
|
/* @__PURE__ */ t(ge, { className: "ml-1 h-3.5 w-3.5 shrink-0 opacity-50" })
|
|
134
134
|
]
|
|
135
135
|
}
|
|
@@ -141,7 +141,7 @@ function Qe({
|
|
|
141
141
|
placeholder: "Search people…",
|
|
142
142
|
className: "h-8 text-[12px]",
|
|
143
143
|
value: h,
|
|
144
|
-
onValueChange:
|
|
144
|
+
onValueChange: o
|
|
145
145
|
}
|
|
146
146
|
),
|
|
147
147
|
/* @__PURE__ */ n(ye, { children: [
|
|
@@ -156,7 +156,7 @@ function Ye(a) {
|
|
|
156
156
|
const i = O();
|
|
157
157
|
return q({
|
|
158
158
|
queryKey: ["task-agents"],
|
|
159
|
-
queryFn: () => i.request(P("/tasks/agents")).then((
|
|
159
|
+
queryFn: () => i.request(P("/tasks/agents")).then((d) => d.data ?? []).catch(() => []),
|
|
160
160
|
enabled: a,
|
|
161
161
|
staleTime: 5 * 6e4
|
|
162
162
|
});
|
|
@@ -164,13 +164,13 @@ function Ye(a) {
|
|
|
164
164
|
function Ze({
|
|
165
165
|
agents: a,
|
|
166
166
|
value: i,
|
|
167
|
-
onChange:
|
|
167
|
+
onChange: d
|
|
168
168
|
}) {
|
|
169
169
|
return /* @__PURE__ */ t(
|
|
170
170
|
G,
|
|
171
171
|
{
|
|
172
172
|
value: i ?? "",
|
|
173
|
-
onChange: (c) =>
|
|
173
|
+
onChange: (c) => d(a.find((r) => r.conn === c) ?? null),
|
|
174
174
|
ariaLabel: "Agent",
|
|
175
175
|
options: [
|
|
176
176
|
{ value: "", label: a.length ? "Choose an agent…" : "No agents connected" },
|
|
@@ -186,9 +186,9 @@ function et({
|
|
|
186
186
|
value: a,
|
|
187
187
|
onChange: i
|
|
188
188
|
}) {
|
|
189
|
-
const
|
|
189
|
+
const d = O(), { data: c = [] } = q({
|
|
190
190
|
queryKey: ["user-groups", "task-picker"],
|
|
191
|
-
queryFn: () =>
|
|
191
|
+
queryFn: () => d.request(P("/user-groups")).then((r) => r.data).catch(() => []),
|
|
192
192
|
staleTime: 5 * 6e4
|
|
193
193
|
});
|
|
194
194
|
return /* @__PURE__ */ t(
|
|
@@ -211,11 +211,11 @@ function et({
|
|
|
211
211
|
);
|
|
212
212
|
}
|
|
213
213
|
function $e(a) {
|
|
214
|
-
const i = O(), { data:
|
|
214
|
+
const i = O(), { data: d } = q({
|
|
215
215
|
queryKey: ["task-field-labels", a],
|
|
216
216
|
queryFn: () => i.request(P(`/collections/${a}`)).then((u) => u.data.fields ?? []).catch(() => []),
|
|
217
217
|
staleTime: 10 * 6e4
|
|
218
|
-
}), c = (
|
|
218
|
+
}), c = (d ?? []).filter(
|
|
219
219
|
(u) => !u.hidden && u.field !== "id" && u.type !== "alias" && !u.field.startsWith("__")
|
|
220
220
|
), r = Re(
|
|
221
221
|
() => new Map(c.map((u) => [u.field, u.label || u.field.replace(/_/g, " ")])),
|
|
@@ -226,9 +226,9 @@ function $e(a) {
|
|
|
226
226
|
function tt({
|
|
227
227
|
collection: a,
|
|
228
228
|
value: i,
|
|
229
|
-
onChange:
|
|
229
|
+
onChange: d
|
|
230
230
|
}) {
|
|
231
|
-
const { fields: c, labels: r } = $e(a), [u, x] =
|
|
231
|
+
const { fields: c, labels: r } = $e(a), [u, x] = w(!1), m = i[0] ?? null;
|
|
232
232
|
return /* @__PURE__ */ n("div", { className: "space-y-1.5", "data-task-done-when": !0, children: [
|
|
233
233
|
/* @__PURE__ */ t(W, { className: "block text-[11px]", children: "Close automatically when (optional)" }),
|
|
234
234
|
/* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
@@ -253,7 +253,7 @@ function tt({
|
|
|
253
253
|
{
|
|
254
254
|
value: `${r.get(h.field)} ${h.field}`,
|
|
255
255
|
onSelect: () => {
|
|
256
|
-
|
|
256
|
+
d([
|
|
257
257
|
{ field: h.field, op: (m == null ? void 0 : m.op) ?? "nnull", value: (m == null ? void 0 : m.value) ?? null }
|
|
258
258
|
]), x(!1);
|
|
259
259
|
},
|
|
@@ -270,7 +270,7 @@ function tt({
|
|
|
270
270
|
G,
|
|
271
271
|
{
|
|
272
272
|
value: m.op,
|
|
273
|
-
onChange: (h) =>
|
|
273
|
+
onChange: (h) => d([{ ...m, op: h, value: h === "eq" ? m.value ?? "" : null }]),
|
|
274
274
|
options: [
|
|
275
275
|
{ value: "nnull", label: "is filled in" },
|
|
276
276
|
{ value: "eq", label: "equals" }
|
|
@@ -281,7 +281,7 @@ function tt({
|
|
|
281
281
|
te,
|
|
282
282
|
{
|
|
283
283
|
value: String(m.value ?? ""),
|
|
284
|
-
onChange: (h) =>
|
|
284
|
+
onChange: (h) => d([{ ...m, value: h.target.value }]),
|
|
285
285
|
className: "h-8 w-[140px] text-[12px]",
|
|
286
286
|
placeholder: "Value"
|
|
287
287
|
}
|
|
@@ -290,7 +290,7 @@ function tt({
|
|
|
290
290
|
"button",
|
|
291
291
|
{
|
|
292
292
|
type: "button",
|
|
293
|
-
onClick: () =>
|
|
293
|
+
onClick: () => d([]),
|
|
294
294
|
className: "rounded p-1 text-slate-400 hover:text-slate-600",
|
|
295
295
|
"aria-label": "Remove condition",
|
|
296
296
|
children: /* @__PURE__ */ t(Z, { className: "h-3.5 w-3.5" })
|
|
@@ -335,7 +335,7 @@ function nt(a) {
|
|
|
335
335
|
function pe({
|
|
336
336
|
collection: a,
|
|
337
337
|
item: i,
|
|
338
|
-
initial:
|
|
338
|
+
initial: d,
|
|
339
339
|
submitLabel: c,
|
|
340
340
|
busy: r,
|
|
341
341
|
allowTeam: u,
|
|
@@ -344,7 +344,7 @@ function pe({
|
|
|
344
344
|
onCancel: h
|
|
345
345
|
}) {
|
|
346
346
|
var C;
|
|
347
|
-
const [
|
|
347
|
+
const [o, f] = w(d), b = (l, g) => f((N) => ({ ...N, [l]: g })), T = Ye(x).data ?? [], A = x && (T.length > 0 || o.mode === "agent"), _ = o.mode === "team" ? o.teamId != null : o.mode === "agent" ? !!o.agent : !!o.assignee, y = o.mode === "person" && ((C = o.assigneePerson) != null && C.is_out_of_office) ? o.assigneePerson : null;
|
|
348
348
|
return /* @__PURE__ */ n(
|
|
349
349
|
"div",
|
|
350
350
|
{
|
|
@@ -356,7 +356,7 @@ function pe({
|
|
|
356
356
|
/* @__PURE__ */ t(
|
|
357
357
|
te,
|
|
358
358
|
{
|
|
359
|
-
value:
|
|
359
|
+
value: o.title,
|
|
360
360
|
onChange: (l) => b("title", l.target.value),
|
|
361
361
|
className: "h-8 bg-white text-[12px] dark:bg-background",
|
|
362
362
|
placeholder: "What needs to be done?",
|
|
@@ -370,7 +370,7 @@ function pe({
|
|
|
370
370
|
/* @__PURE__ */ t(
|
|
371
371
|
Ge,
|
|
372
372
|
{
|
|
373
|
-
value:
|
|
373
|
+
value: o.description,
|
|
374
374
|
onChange: (l) => b("description", l.target.value),
|
|
375
375
|
className: "min-h-[56px] bg-white text-[12px] dark:bg-background",
|
|
376
376
|
placeholder: "Anything the person needs to know",
|
|
@@ -382,9 +382,12 @@ function pe({
|
|
|
382
382
|
/* @__PURE__ */ n("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
383
383
|
/* @__PURE__ */ n("div", { className: "col-span-2 sm:col-span-1", children: [
|
|
384
384
|
/* @__PURE__ */ n("div", { className: "mb-1 flex items-center justify-between gap-2", children: [
|
|
385
|
-
/* @__PURE__ */
|
|
385
|
+
/* @__PURE__ */ n(W, { className: "text-[11px]", children: [
|
|
386
|
+
o.mode === "team" ? "Team" : o.mode === "agent" ? "Agent" : "Assignee",
|
|
387
|
+
/* @__PURE__ */ t("span", { "aria-hidden": !0, className: "ml-0.5 text-red-500", "data-task-required": !0, children: "*" })
|
|
388
|
+
] }),
|
|
386
389
|
/* @__PURE__ */ t("span", { className: "flex items-center gap-2", children: ["person", "team", "agent"].filter(
|
|
387
|
-
(l) => l !==
|
|
390
|
+
(l) => l !== o.mode && (l !== "team" || u) && (l !== "agent" || A)
|
|
388
391
|
).map((l) => /* @__PURE__ */ t(
|
|
389
392
|
"button",
|
|
390
393
|
{
|
|
@@ -397,17 +400,17 @@ function pe({
|
|
|
397
400
|
l
|
|
398
401
|
)) })
|
|
399
402
|
] }),
|
|
400
|
-
|
|
403
|
+
o.mode === "agent" ? /* @__PURE__ */ t(
|
|
401
404
|
Ze,
|
|
402
405
|
{
|
|
403
406
|
agents: T,
|
|
404
|
-
value:
|
|
407
|
+
value: o.agent,
|
|
405
408
|
onChange: (l) => f((g) => ({ ...g, agent: (l == null ? void 0 : l.conn) ?? null, agentName: (l == null ? void 0 : l.name) ?? null }))
|
|
406
409
|
}
|
|
407
|
-
) :
|
|
410
|
+
) : o.mode === "team" ? /* @__PURE__ */ t(
|
|
408
411
|
et,
|
|
409
412
|
{
|
|
410
|
-
value:
|
|
413
|
+
value: o.teamId,
|
|
411
414
|
onChange: (l, g) => f((N) => ({ ...N, teamId: l, teamName: (g == null ? void 0 : g.name) ?? null }))
|
|
412
415
|
}
|
|
413
416
|
) : /* @__PURE__ */ t(
|
|
@@ -415,8 +418,8 @@ function pe({
|
|
|
415
418
|
{
|
|
416
419
|
collection: a,
|
|
417
420
|
item: i,
|
|
418
|
-
value:
|
|
419
|
-
valueLabel:
|
|
421
|
+
value: o.assignee,
|
|
422
|
+
valueLabel: o.assigneeName,
|
|
420
423
|
onChange: (l, g) => f((N) => ({
|
|
421
424
|
...N,
|
|
422
425
|
assignee: l,
|
|
@@ -431,8 +434,8 @@ function pe({
|
|
|
431
434
|
y.ooo_end ? ` until ${String(y.ooo_end).slice(0, 10)}` : "",
|
|
432
435
|
" — the task goes to their delegate if one is set."
|
|
433
436
|
] }),
|
|
434
|
-
|
|
435
|
-
|
|
437
|
+
o.mode === "team" && /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "Waits with the team until one of them picks it up." }),
|
|
438
|
+
o.mode === "agent" && /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "The assistant picks it up through My Work and acts as the person it is connected for." })
|
|
436
439
|
] }),
|
|
437
440
|
/* @__PURE__ */ n("div", { children: [
|
|
438
441
|
/* @__PURE__ */ t(W, { className: "mb-1 block text-[11px]", children: "Due date" }),
|
|
@@ -440,7 +443,7 @@ function pe({
|
|
|
440
443
|
te,
|
|
441
444
|
{
|
|
442
445
|
type: "date",
|
|
443
|
-
value:
|
|
446
|
+
value: o.due,
|
|
444
447
|
onChange: (l) => b("due", l.target.value),
|
|
445
448
|
className: "h-8 bg-white text-[12px] dark:bg-background",
|
|
446
449
|
"data-task-due": !0
|
|
@@ -452,7 +455,7 @@ function pe({
|
|
|
452
455
|
/* @__PURE__ */ t(
|
|
453
456
|
G,
|
|
454
457
|
{
|
|
455
|
-
value:
|
|
458
|
+
value: o.priority,
|
|
456
459
|
onChange: (l) => b("priority", l),
|
|
457
460
|
options: [
|
|
458
461
|
{ value: "low", label: "Low" },
|
|
@@ -467,7 +470,7 @@ function pe({
|
|
|
467
470
|
tt,
|
|
468
471
|
{
|
|
469
472
|
collection: a,
|
|
470
|
-
value:
|
|
473
|
+
value: o.doneWhen,
|
|
471
474
|
onChange: (l) => b("doneWhen", l)
|
|
472
475
|
}
|
|
473
476
|
),
|
|
@@ -484,15 +487,22 @@ function pe({
|
|
|
484
487
|
}
|
|
485
488
|
),
|
|
486
489
|
/* @__PURE__ */ t(
|
|
487
|
-
|
|
490
|
+
"span",
|
|
488
491
|
{
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
492
|
+
className: "inline-flex",
|
|
493
|
+
"data-tip": r ? void 0 : o.title.trim() ? _ ? void 0 : o.mode === "team" ? "Pick a team first" : o.mode === "agent" ? "Pick an agent first" : "Pick an assignee first" : "Write what needs to be done first",
|
|
494
|
+
children: /* @__PURE__ */ t(
|
|
495
|
+
z,
|
|
496
|
+
{
|
|
497
|
+
type: "button",
|
|
498
|
+
size: "sm",
|
|
499
|
+
className: "h-7 text-[12px]",
|
|
500
|
+
disabled: !o.title.trim() || !_ || r,
|
|
501
|
+
onClick: () => m(o),
|
|
502
|
+
"data-task-submit": !0,
|
|
503
|
+
children: r ? "Saving…" : c
|
|
504
|
+
}
|
|
505
|
+
)
|
|
496
506
|
}
|
|
497
507
|
)
|
|
498
508
|
] })
|
|
@@ -501,17 +511,17 @@ function pe({
|
|
|
501
511
|
);
|
|
502
512
|
}
|
|
503
513
|
function he({ taskId: a }) {
|
|
504
|
-
const i = O(), { data:
|
|
514
|
+
const i = O(), { data: d = [], isLoading: c } = q({
|
|
505
515
|
queryKey: ["task-history", a],
|
|
506
516
|
queryFn: () => i.request(P(`/tasks/${a}/history`)).then((r) => r.data),
|
|
507
517
|
staleTime: 3e4
|
|
508
518
|
});
|
|
509
|
-
return c ? /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "Loading history…" }) :
|
|
519
|
+
return c ? /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "Loading history…" }) : d.length ? /* @__PURE__ */ t(
|
|
510
520
|
"ol",
|
|
511
521
|
{
|
|
512
522
|
className: "mt-1.5 space-y-1 border-l border-slate-200 pl-3 dark:border-border",
|
|
513
523
|
"data-task-history": !0,
|
|
514
|
-
children:
|
|
524
|
+
children: d.map((r) => /* @__PURE__ */ n("li", { className: "text-[11px] text-slate-600 dark:text-slate-400", children: [
|
|
515
525
|
/* @__PURE__ */ t("span", { className: "text-slate-800 dark:text-slate-200", children: r.text }),
|
|
516
526
|
/* @__PURE__ */ n("span", { className: "text-slate-400", children: [
|
|
517
527
|
" ",
|
|
@@ -526,17 +536,17 @@ function he({ taskId: a }) {
|
|
|
526
536
|
function vt({
|
|
527
537
|
collection: a,
|
|
528
538
|
item: i,
|
|
529
|
-
title:
|
|
539
|
+
title: d,
|
|
530
540
|
defaultExpanded: c,
|
|
531
541
|
queuedTasks: r,
|
|
532
542
|
onQueueTask: u,
|
|
533
543
|
onRemoveQueuedTask: x
|
|
534
544
|
}) {
|
|
535
|
-
const m = O(), h = Fe(), { isAdmin:
|
|
545
|
+
const m = O(), h = Fe(), { isAdmin: o, userId: f } = Me(), [b, T] = w(!1), A = Ke(!1);
|
|
536
546
|
xe(() => {
|
|
537
547
|
!A.current && c !== void 0 && (A.current = !0, T(c));
|
|
538
548
|
}, [c]);
|
|
539
|
-
const [
|
|
549
|
+
const [_, y] = w(!1), [C, l] = w(null), [g, N] = w(null), [E, M] = w(!1), s = !i || i === "new", { data: F = [] } = q({
|
|
540
550
|
queryKey: ["tasks", a, i],
|
|
541
551
|
queryFn: () => m.request(P("/tasks", { collection: a, item: i })).then((e) => e.data),
|
|
542
552
|
enabled: !!a && !s
|
|
@@ -591,7 +601,7 @@ function vt({
|
|
|
591
601
|
onError: (e) => v.error(j(e, "Could not delete the task"))
|
|
592
602
|
});
|
|
593
603
|
if (!a) return null;
|
|
594
|
-
const k = F.filter((e) => ce.has(e.status)), J = F.filter((e) => !ce.has(e.status)), qe = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), X = (e) =>
|
|
604
|
+
const k = F.filter((e) => ce.has(e.status)), J = F.filter((e) => !ce.has(e.status)), qe = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), X = (e) => o || $(e.assignee, f) || $(e.created_by, f), Pe = (e) => o || $(e.created_by, f);
|
|
595
605
|
function Te(e) {
|
|
596
606
|
u == null || u({
|
|
597
607
|
title: e.title.trim(),
|
|
@@ -707,7 +717,7 @@ function vt({
|
|
|
707
717
|
children: [
|
|
708
718
|
/* @__PURE__ */ n("span", { className: "flex w-full items-center gap-2.5", children: [
|
|
709
719
|
/* @__PURE__ */ t(De, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
710
|
-
/* @__PURE__ */ t("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children:
|
|
720
|
+
/* @__PURE__ */ t("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: d || "Tasks" }),
|
|
711
721
|
(s ? (r ?? []).length : k.length) > 0 && /* @__PURE__ */ t("span", { className: "rounded-full bg-slate-100 px-1.5 py-px text-[10.5px] font-semibold tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400", children: s ? `${(r ?? []).length} queued` : `${k.length} open` }),
|
|
712
722
|
/* @__PURE__ */ t(
|
|
713
723
|
de,
|
|
@@ -759,8 +769,8 @@ function vt({
|
|
|
759
769
|
)
|
|
760
770
|
] }, p)
|
|
761
771
|
)) }),
|
|
762
|
-
s && (r ?? []).length === 0 && !
|
|
763
|
-
!s && k.length === 0 && !
|
|
772
|
+
s && (r ?? []).length === 0 && !_ && /* @__PURE__ */ t("p", { className: "py-1 text-[12px] text-slate-400", children: "Tasks are created once the record is saved." }),
|
|
773
|
+
!s && k.length === 0 && !_ && /* @__PURE__ */ t("p", { className: "py-1 text-[13px] text-slate-400", children: "No open tasks" }),
|
|
764
774
|
!s && k.length > 0 && /* @__PURE__ */ t("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: k.map((e) => {
|
|
765
775
|
const p = Se(e.done_when), D = !e.assignee && e.team_id != null;
|
|
766
776
|
return /* @__PURE__ */ n("div", { className: "nvr-rise-in py-2", "data-task-row": e.id, children: [
|
|
@@ -823,7 +833,7 @@ function vt({
|
|
|
823
833
|
g === e.id && /* @__PURE__ */ t("div", { className: "pl-6", children: /* @__PURE__ */ t(he, { taskId: e.id }) })
|
|
824
834
|
] }, e.id);
|
|
825
835
|
}) }),
|
|
826
|
-
!
|
|
836
|
+
!_ && /* @__PURE__ */ n(
|
|
827
837
|
"button",
|
|
828
838
|
{
|
|
829
839
|
type: "button",
|
|
@@ -836,7 +846,7 @@ function vt({
|
|
|
836
846
|
]
|
|
837
847
|
}
|
|
838
848
|
),
|
|
839
|
-
|
|
849
|
+
_ && /* @__PURE__ */ t(
|
|
840
850
|
pe,
|
|
841
851
|
{
|
|
842
852
|
collection: a,
|