@nivaro/react 0.3.57 → 0.3.59
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/components/fields/RelationField.js +110 -80
- package/dist/full.css +1 -1
- package/dist/hooks/useRelationOptions.js +1 -0
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +37 -2
- package/dist/index.js +523 -520
- package/dist/shared/components/CollectionBrowserView.js +2693 -2619
- package/dist/shared/components/DataTable.js +538 -495
- package/dist/shared/components/ItemEditForm.js +4559 -4386
- package/dist/shared/components/PageRenderer.js +537 -508
- package/dist/shared/components/ProfileView.js +716 -715
- package/dist/shared/components/QueryTable.js +74 -74
- package/dist/shared/components/RecordReadView.js +367 -364
- package/dist/shared/components/ReportView.js +64 -39
- package/dist/shared/components/WidgetSlot.js +543 -520
- package/dist/shared/components/alerts/AlertManagerView.js +324 -317
- package/dist/shared/components/alerts/types.js +37 -14
- package/dist/shared/components/cbv/row-focus.js +19 -0
- package/dist/shared/components/help-videos/HelpVideoPlayer.js +152 -147
- package/dist/shared/components/integrations/console/SignalCard.js +59 -59
- package/dist/shared/components/integrations/console/tone.js +52 -30
- package/dist/shared/components/item-edit/CatalogPickerField.js +525 -505
- package/dist/shared/components/item-edit/FieldRenderer.js +22 -20
- package/dist/shared/components/item-edit/FieldRow.js +175 -173
- package/dist/shared/components/item-edit/GridBulkEditDialog.js +55 -54
- package/dist/shared/components/item-edit/InlineTableField.js +2487 -2442
- package/dist/shared/components/item-edit/M2MCombobox.js +321 -295
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +1 -1
- package/dist/shared/components/item-edit/PlanGrid.js +973 -894
- package/dist/shared/components/item-edit/QuickCreateButton.js +335 -106
- package/dist/shared/components/item-edit/RecordLiveSync.js +77 -75
- package/dist/shared/components/item-edit/RelationCombobox.js +452 -335
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +262 -141
- package/dist/shared/components/item-edit/SummaryPanel.js +385 -358
- package/dist/shared/components/item-edit/duplicate-rehearsal.js +47 -0
- package/dist/shared/components/item-edit/line-midair.js +82 -75
- package/dist/shared/components/item-edit/option-disambiguate.js +44 -32
- package/dist/shared/components/item-edit/related-missing.js +45 -0
- package/dist/shared/components/item-edit/save-outcome.js +9 -7
- package/dist/shared/components/notifications/NotificationRulesEditor.js +130 -123
- package/dist/shared/components/panels/AccessDeniedPanel.js +52 -48
- package/dist/shared/components/panels/ItemLockBanner.js +213 -211
- package/dist/shared/components/panels/PipelinePanel.js +1140 -1053
- package/dist/shared/components/panels/RecordIntegrityBanner.js +114 -86
- package/dist/shared/components/panels/RevisionsPanel.js +316 -299
- package/dist/shared/components/panels/TaskPanel.js +265 -249
- package/dist/shared/components/panels/landing-state.js +27 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +110 -92
- package/dist/shared/components/profile/AiMemoryCard.js +12 -10
- package/dist/shared/components/queue/OwnerAvatars.js +80 -41
- package/dist/shared/components/queue/QueueQuickFilters.js +52 -52
- package/dist/shared/components/queue/QueueWorklist.js +1050 -1026
- package/dist/shared/components/queue/group-sums.js +27 -0
- package/dist/shared/components/queue/live-state-aspect.js +9 -5
- package/dist/shared/components/widgets/ReviewListWidget.js +175 -154
- package/dist/shared/lib/back-closes.js +25 -0
- package/dist/shared/lib/display-prefs.js +60 -52
- package/dist/shared/lib/draft-store.js +71 -48
- package/dist/shared/lib/expression.js +53 -53
- package/dist/shared/lib/form-usage-beacon.js +7 -7
- package/dist/shared/lib/list-page-memory.js +63 -0
- package/dist/shared/lib/live.js +44 -44
- package/dist/shared/lib/money-input.js +45 -0
- package/dist/shared/lib/own-writes.js +76 -28
- package/dist/shared/lib/request-gate.js +110 -109
- package/dist/shared/lib/sanitize-html.js +10 -6
- package/dist/shared/lib/staged-row-labels.js +18 -0
- package/dist/shared/lib/validation-rules.js +34 -19
- package/package.json +1 -1
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import { jsxs as n, jsx as t, Fragment as Ae } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as Fe, useQuery as
|
|
3
|
-
import { ClipboardList as De, ChevronDown as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { toast as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { get as
|
|
8
|
-
import { OPEN_TASK_STATUSES as
|
|
9
|
-
import { formatDate as
|
|
10
|
-
import { TaskDoButton as
|
|
2
|
+
import { useQueryClient as Fe, useQuery as T, useMutation as K } from "@tanstack/react-query";
|
|
3
|
+
import { ClipboardList as De, ChevronDown as ce, X as ee, Plus as Ee, Bot as Ie, Users as Le, History as We, Pencil as je, RotateCcw as Oe, ChevronsUpDown as xe, Check as Ke } from "lucide-react";
|
|
4
|
+
import { useState as C, useRef as Ue, useEffect as te, useMemo as Re } from "react";
|
|
5
|
+
import { toast as w } from "sonner";
|
|
6
|
+
import { useNivaroClient as j, useItemEditAuth as Me } from "../../context.js";
|
|
7
|
+
import { get as A, post as Y, patch as He, del as Be } from "../../lib/commands.js";
|
|
8
|
+
import { OPEN_TASK_STATUSES as me, invalidateRecordTasks as Ve } from "../../lib/record-tasks.js";
|
|
9
|
+
import { formatDate as Z, cn as U, formatRelative as fe } from "../../lib/utils.js";
|
|
10
|
+
import { TaskDoButton as ze } from "../ai/TaskDo.js";
|
|
11
11
|
import { Button as z } from "../ui/button.js";
|
|
12
|
-
import { Checkbox as
|
|
13
|
-
import { Command as be, CommandInput as ke, CommandList as ye, CommandEmpty as Ne, CommandGroup as
|
|
14
|
-
import { Input as
|
|
12
|
+
import { Checkbox as ue } from "../ui/checkbox.js";
|
|
13
|
+
import { Command as be, CommandInput as ke, CommandList as ye, CommandEmpty as Ne, CommandGroup as ae, CommandItem as ve } from "../ui/command.js";
|
|
14
|
+
import { Input as ne } from "../ui/input.js";
|
|
15
15
|
import { Label as W } from "../ui/label.js";
|
|
16
16
|
import { Popover as _e, PopoverTrigger as we, PopoverContent as Ce } from "../ui/popover.js";
|
|
17
|
-
import { SimpleSelect as
|
|
17
|
+
import { SimpleSelect as J } from "../ui/SimpleSelect.js";
|
|
18
18
|
import { Textarea as Ge } from "../ui/textarea.js";
|
|
19
19
|
const Je = "id,first_name,last_name,email,is_out_of_office,ooo_end,delegate_id";
|
|
20
|
-
function
|
|
20
|
+
function G(a) {
|
|
21
21
|
return a && ([a.first_name, a.last_name].filter(Boolean).join(" ") || a.email) || "Unknown";
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const q = (a, o) => a != null && o != null && String(a).toUpperCase() === String(o).toUpperCase();
|
|
24
24
|
function Se(a) {
|
|
25
25
|
if (!a) return [];
|
|
26
26
|
try {
|
|
27
|
-
const
|
|
28
|
-
return Array.isArray(
|
|
27
|
+
const o = JSON.parse(a);
|
|
28
|
+
return Array.isArray(o) ? o : [];
|
|
29
29
|
} catch {
|
|
30
30
|
return [];
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
function Xe(a,
|
|
33
|
+
function Xe(a, o) {
|
|
34
34
|
return a.map((d) => {
|
|
35
|
-
const c =
|
|
35
|
+
const c = o.get(d.field) ?? d.field.replace(/_/g, " ");
|
|
36
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
|
-
function
|
|
39
|
+
function pe({ priority: a }) {
|
|
40
40
|
return !a || a === "normal" ? null : /* @__PURE__ */ t(
|
|
41
41
|
"span",
|
|
42
42
|
{
|
|
@@ -47,25 +47,25 @@ function ue({ priority: a }) {
|
|
|
47
47
|
}
|
|
48
48
|
function Qe({
|
|
49
49
|
collection: a,
|
|
50
|
-
item:
|
|
50
|
+
item: o,
|
|
51
51
|
value: d,
|
|
52
52
|
valueLabel: c,
|
|
53
|
-
onChange:
|
|
53
|
+
onChange: i
|
|
54
54
|
}) {
|
|
55
|
-
const u =
|
|
56
|
-
|
|
55
|
+
const u = j(), [x, m] = C(!1), [h, r] = C(""), [f, b] = C("");
|
|
56
|
+
te(() => {
|
|
57
57
|
const s = setTimeout(() => b(h.trim()), 250);
|
|
58
58
|
return () => clearTimeout(s);
|
|
59
59
|
}, [h]);
|
|
60
|
-
const
|
|
61
|
-
queryKey: ["task-people", a,
|
|
62
|
-
queryFn: () => u.request(
|
|
63
|
-
enabled: x && !!
|
|
60
|
+
const F = T({
|
|
61
|
+
queryKey: ["task-people", a, o],
|
|
62
|
+
queryFn: () => u.request(A("/tasks/people", { collection: a, item: o })).then((s) => s.data).catch(() => []),
|
|
63
|
+
enabled: x && !!o && o !== "new",
|
|
64
64
|
staleTime: 6e4
|
|
65
|
-
}),
|
|
65
|
+
}), D = T({
|
|
66
66
|
queryKey: ["task-people-search", f],
|
|
67
67
|
queryFn: () => u.request(
|
|
68
|
-
|
|
68
|
+
A("/users", {
|
|
69
69
|
limit: 25,
|
|
70
70
|
people: 1,
|
|
71
71
|
fields: Je,
|
|
@@ -74,44 +74,48 @@ function Qe({
|
|
|
74
74
|
).then((s) => s.data).catch(() => []),
|
|
75
75
|
enabled: x,
|
|
76
76
|
staleTime: 6e4
|
|
77
|
-
}),
|
|
78
|
-
(s) => !
|
|
79
|
-
), g = (
|
|
80
|
-
|
|
77
|
+
}), N = F.data ?? [], _ = new Set(N.map((s) => String(s.id).toUpperCase())), P = f.toLowerCase(), l = N.filter(
|
|
78
|
+
(s) => !P || `${G(s)} ${s.email ?? ""}`.toLowerCase().includes(P)
|
|
79
|
+
), g = (D.data ?? []).filter((s) => !_.has(String(s.id).toUpperCase())), k = [...l, ...g].map((s) => s.id), [R, M] = C(""), y = k.join(",");
|
|
80
|
+
te(() => {
|
|
81
|
+
M((s) => k.includes(s) ? s : k[0] ?? "");
|
|
82
|
+
}, [y]);
|
|
83
|
+
const { data: L } = T({
|
|
84
|
+
queryKey: ["task-open-counts", k.join(",")],
|
|
81
85
|
queryFn: () => u.request(
|
|
82
|
-
|
|
86
|
+
A("/tasks/open-counts", { ids: k.join(",") })
|
|
83
87
|
).then((s) => s.data).catch(() => ({})),
|
|
84
|
-
enabled: x &&
|
|
88
|
+
enabled: x && k.length > 0,
|
|
85
89
|
staleTime: 6e4
|
|
86
|
-
}),
|
|
87
|
-
const
|
|
90
|
+
}), H = (s, S) => {
|
|
91
|
+
const E = (L == null ? void 0 : L[String(s.id).toUpperCase()]) ?? 0;
|
|
88
92
|
return /* @__PURE__ */ n(
|
|
89
93
|
ve,
|
|
90
94
|
{
|
|
91
95
|
value: s.id,
|
|
92
96
|
onSelect: () => {
|
|
93
|
-
|
|
97
|
+
i(q(s.id, d) ? null : s.id, q(s.id, d) ? null : s), m(!1);
|
|
94
98
|
},
|
|
95
99
|
className: "text-[12px]",
|
|
96
100
|
"data-task-person": s.id,
|
|
97
101
|
children: [
|
|
98
102
|
/* @__PURE__ */ t(
|
|
99
|
-
|
|
103
|
+
Ke,
|
|
100
104
|
{
|
|
101
|
-
className:
|
|
105
|
+
className: U("mr-2 h-3.5 w-3.5", q(d, s.id) ? "opacity-100" : "opacity-0")
|
|
102
106
|
}
|
|
103
107
|
),
|
|
104
108
|
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate", children: [
|
|
105
|
-
|
|
106
|
-
|
|
109
|
+
G(s),
|
|
110
|
+
S != null && S.length ? /* @__PURE__ */ t("span", { className: "ml-1.5 text-[10.5px] text-muted-foreground", children: S.join(", ") }) : null
|
|
107
111
|
] }),
|
|
108
112
|
s.is_out_of_office ? /* @__PURE__ */ t("span", { className: "ml-2 shrink-0 text-[10px] text-amber-600 dark:text-amber-400", children: "out" }) : null,
|
|
109
|
-
|
|
113
|
+
E > 0 && /* @__PURE__ */ t(
|
|
110
114
|
"span",
|
|
111
115
|
{
|
|
112
116
|
className: "ml-2 shrink-0 rounded-full bg-slate-100 px-1.5 text-[10px] font-semibold tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400",
|
|
113
|
-
title: `${
|
|
114
|
-
children:
|
|
117
|
+
title: `${E} open task${E === 1 ? "" : "s"} already assigned`,
|
|
118
|
+
children: E
|
|
115
119
|
}
|
|
116
120
|
)
|
|
117
121
|
]
|
|
@@ -129,48 +133,48 @@ function Qe({
|
|
|
129
133
|
"data-task-assignee-picker": !0,
|
|
130
134
|
className: "h-8 w-full justify-between px-2.5 text-[12px] font-normal",
|
|
131
135
|
children: [
|
|
132
|
-
/* @__PURE__ */ t("span", { className:
|
|
133
|
-
/* @__PURE__ */ t(
|
|
136
|
+
/* @__PURE__ */ t("span", { className: U("truncate", !d && "text-muted-foreground"), children: d ? c ?? "Selected" : "Assign to…" }),
|
|
137
|
+
/* @__PURE__ */ t(xe, { className: "ml-1 h-3.5 w-3.5 shrink-0 opacity-50" })
|
|
134
138
|
]
|
|
135
139
|
}
|
|
136
140
|
) }),
|
|
137
|
-
/* @__PURE__ */ t(Ce, { className: "w-[300px] p-0", align: "start", children: /* @__PURE__ */ n(be, { shouldFilter: !1, children: [
|
|
141
|
+
/* @__PURE__ */ t(Ce, { className: "w-[300px] p-0", align: "start", children: /* @__PURE__ */ n(be, { shouldFilter: !1, value: R, onValueChange: M, children: [
|
|
138
142
|
/* @__PURE__ */ t(
|
|
139
143
|
ke,
|
|
140
144
|
{
|
|
141
145
|
placeholder: "Search people…",
|
|
142
146
|
className: "h-8 text-[12px]",
|
|
143
147
|
value: h,
|
|
144
|
-
onValueChange:
|
|
148
|
+
onValueChange: r
|
|
145
149
|
}
|
|
146
150
|
),
|
|
147
151
|
/* @__PURE__ */ n(ye, { children: [
|
|
148
|
-
/* @__PURE__ */ t(Ne, { className: "py-3 text-center text-[12px] text-muted-foreground", children:
|
|
149
|
-
l.length > 0 && /* @__PURE__ */ t(
|
|
150
|
-
g.length > 0 && /* @__PURE__ */ t(
|
|
152
|
+
/* @__PURE__ */ t(Ne, { className: "py-3 text-center text-[12px] text-muted-foreground", children: D.isFetching ? "Searching…" : "No one matches" }),
|
|
153
|
+
l.length > 0 && /* @__PURE__ */ t(ae, { heading: "On this record", children: l.map((s) => H(s, s.reasons)) }),
|
|
154
|
+
g.length > 0 && /* @__PURE__ */ t(ae, { heading: f ? "Everyone" : "Everyone (type to search)", children: g.map((s) => H(s)) })
|
|
151
155
|
] })
|
|
152
156
|
] }) })
|
|
153
157
|
] });
|
|
154
158
|
}
|
|
155
159
|
function Ye(a) {
|
|
156
|
-
const
|
|
157
|
-
return
|
|
160
|
+
const o = j();
|
|
161
|
+
return T({
|
|
158
162
|
queryKey: ["task-agents"],
|
|
159
|
-
queryFn: () =>
|
|
163
|
+
queryFn: () => o.request(A("/tasks/agents")).then((d) => d.data ?? []).catch(() => []),
|
|
160
164
|
enabled: a,
|
|
161
165
|
staleTime: 5 * 6e4
|
|
162
166
|
});
|
|
163
167
|
}
|
|
164
168
|
function Ze({
|
|
165
169
|
agents: a,
|
|
166
|
-
value:
|
|
170
|
+
value: o,
|
|
167
171
|
onChange: d
|
|
168
172
|
}) {
|
|
169
173
|
return /* @__PURE__ */ t(
|
|
170
|
-
|
|
174
|
+
J,
|
|
171
175
|
{
|
|
172
|
-
value:
|
|
173
|
-
onChange: (c) => d(a.find((
|
|
176
|
+
value: o ?? "",
|
|
177
|
+
onChange: (c) => d(a.find((i) => i.conn === c) ?? null),
|
|
174
178
|
ariaLabel: "Agent",
|
|
175
179
|
options: [
|
|
176
180
|
{ value: "", label: a.length ? "Choose an agent…" : "No agents connected" },
|
|
@@ -184,51 +188,51 @@ function Ze({
|
|
|
184
188
|
}
|
|
185
189
|
function et({
|
|
186
190
|
value: a,
|
|
187
|
-
onChange:
|
|
191
|
+
onChange: o
|
|
188
192
|
}) {
|
|
189
|
-
const d =
|
|
193
|
+
const d = j(), { data: c = [] } = T({
|
|
190
194
|
queryKey: ["user-groups", "task-picker"],
|
|
191
|
-
queryFn: () => d.request(
|
|
195
|
+
queryFn: () => d.request(A("/user-groups")).then((i) => i.data).catch(() => []),
|
|
192
196
|
staleTime: 5 * 6e4
|
|
193
197
|
});
|
|
194
198
|
return /* @__PURE__ */ t(
|
|
195
|
-
|
|
199
|
+
J,
|
|
196
200
|
{
|
|
197
201
|
value: a == null ? "" : String(a),
|
|
198
|
-
onChange: (
|
|
199
|
-
const u = c.find((x) => String(x.id) ===
|
|
200
|
-
|
|
202
|
+
onChange: (i) => {
|
|
203
|
+
const u = c.find((x) => String(x.id) === i) ?? null;
|
|
204
|
+
o(u ? u.id : null, u);
|
|
201
205
|
},
|
|
202
206
|
ariaLabel: "Team",
|
|
203
207
|
options: [
|
|
204
208
|
{ value: "", label: c.length ? "Choose a team…" : "No teams yet" },
|
|
205
|
-
...c.map((
|
|
206
|
-
value: String(
|
|
207
|
-
label: `${
|
|
209
|
+
...c.map((i) => ({
|
|
210
|
+
value: String(i.id),
|
|
211
|
+
label: `${i.name}${i.member_count ? ` · ${i.member_count}` : ""}`
|
|
208
212
|
}))
|
|
209
213
|
]
|
|
210
214
|
}
|
|
211
215
|
);
|
|
212
216
|
}
|
|
213
|
-
function
|
|
214
|
-
const
|
|
217
|
+
function Pe(a) {
|
|
218
|
+
const o = j(), { data: d } = T({
|
|
215
219
|
queryKey: ["task-field-labels", a],
|
|
216
|
-
queryFn: () =>
|
|
220
|
+
queryFn: () => o.request(A(`/collections/${a}`)).then((u) => u.data.fields ?? []).catch(() => []),
|
|
217
221
|
staleTime: 10 * 6e4
|
|
218
222
|
}), c = (d ?? []).filter(
|
|
219
223
|
(u) => !u.hidden && u.field !== "id" && u.type !== "alias" && !u.field.startsWith("__")
|
|
220
|
-
),
|
|
224
|
+
), i = Re(
|
|
221
225
|
() => new Map(c.map((u) => [u.field, u.label || u.field.replace(/_/g, " ")])),
|
|
222
226
|
[c]
|
|
223
227
|
);
|
|
224
|
-
return { fields: c, labels:
|
|
228
|
+
return { fields: c, labels: i };
|
|
225
229
|
}
|
|
226
230
|
function tt({
|
|
227
231
|
collection: a,
|
|
228
|
-
value:
|
|
232
|
+
value: o,
|
|
229
233
|
onChange: d
|
|
230
234
|
}) {
|
|
231
|
-
const { fields: c, labels:
|
|
235
|
+
const { fields: c, labels: i } = Pe(a), [u, x] = C(!1), m = o[0] ?? null;
|
|
232
236
|
return /* @__PURE__ */ n("div", { className: "space-y-1.5", "data-task-done-when": !0, children: [
|
|
233
237
|
/* @__PURE__ */ t(W, { className: "block text-[11px]", children: "Close automatically when (optional)" }),
|
|
234
238
|
/* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
@@ -239,8 +243,8 @@ function tt({
|
|
|
239
243
|
variant: "outline",
|
|
240
244
|
className: "h-8 max-w-[220px] justify-between px-2.5 text-[12px] font-normal",
|
|
241
245
|
children: [
|
|
242
|
-
/* @__PURE__ */ t("span", { className:
|
|
243
|
-
/* @__PURE__ */ t(
|
|
246
|
+
/* @__PURE__ */ t("span", { className: U("truncate", !m && "text-muted-foreground"), children: m ? i.get(m.field) ?? m.field : "A field on this record…" }),
|
|
247
|
+
/* @__PURE__ */ t(xe, { className: "ml-1 h-3.5 w-3.5 shrink-0 opacity-50" })
|
|
244
248
|
]
|
|
245
249
|
}
|
|
246
250
|
) }),
|
|
@@ -248,17 +252,17 @@ function tt({
|
|
|
248
252
|
/* @__PURE__ */ t(ke, { placeholder: "Search fields…", className: "h-8 text-[12px]" }),
|
|
249
253
|
/* @__PURE__ */ n(ye, { children: [
|
|
250
254
|
/* @__PURE__ */ t(Ne, { className: "py-3 text-center text-[12px] text-muted-foreground", children: "No field" }),
|
|
251
|
-
/* @__PURE__ */ t(
|
|
255
|
+
/* @__PURE__ */ t(ae, { children: c.map((h) => /* @__PURE__ */ t(
|
|
252
256
|
ve,
|
|
253
257
|
{
|
|
254
|
-
value: `${
|
|
258
|
+
value: `${i.get(h.field)} ${h.field}`,
|
|
255
259
|
onSelect: () => {
|
|
256
260
|
d([
|
|
257
261
|
{ field: h.field, op: (m == null ? void 0 : m.op) ?? "nnull", value: (m == null ? void 0 : m.value) ?? null }
|
|
258
262
|
]), x(!1);
|
|
259
263
|
},
|
|
260
264
|
className: "text-[12px]",
|
|
261
|
-
children:
|
|
265
|
+
children: i.get(h.field)
|
|
262
266
|
},
|
|
263
267
|
h.field
|
|
264
268
|
)) })
|
|
@@ -267,7 +271,7 @@ function tt({
|
|
|
267
271
|
] }),
|
|
268
272
|
m && /* @__PURE__ */ n(Ae, { children: [
|
|
269
273
|
/* @__PURE__ */ t("div", { className: "w-[130px]", children: /* @__PURE__ */ t(
|
|
270
|
-
|
|
274
|
+
J,
|
|
271
275
|
{
|
|
272
276
|
value: m.op,
|
|
273
277
|
onChange: (h) => d([{ ...m, op: h, value: h === "eq" ? m.value ?? "" : null }]),
|
|
@@ -278,7 +282,7 @@ function tt({
|
|
|
278
282
|
}
|
|
279
283
|
) }),
|
|
280
284
|
m.op === "eq" && /* @__PURE__ */ t(
|
|
281
|
-
|
|
285
|
+
ne,
|
|
282
286
|
{
|
|
283
287
|
value: String(m.value ?? ""),
|
|
284
288
|
onChange: (h) => d([{ ...m, value: h.target.value }]),
|
|
@@ -293,7 +297,7 @@ function tt({
|
|
|
293
297
|
onClick: () => d([]),
|
|
294
298
|
className: "rounded p-1 text-slate-400 hover:text-slate-600",
|
|
295
299
|
"aria-label": "Remove condition",
|
|
296
|
-
children: /* @__PURE__ */ t(
|
|
300
|
+
children: /* @__PURE__ */ t(ee, { className: "h-3.5 w-3.5" })
|
|
297
301
|
}
|
|
298
302
|
)
|
|
299
303
|
] })
|
|
@@ -332,19 +336,19 @@ function nt(a) {
|
|
|
332
336
|
doneWhen: Se(a.done_when)
|
|
333
337
|
};
|
|
334
338
|
}
|
|
335
|
-
function
|
|
339
|
+
function he({
|
|
336
340
|
collection: a,
|
|
337
|
-
item:
|
|
341
|
+
item: o,
|
|
338
342
|
initial: d,
|
|
339
343
|
submitLabel: c,
|
|
340
|
-
busy:
|
|
344
|
+
busy: i,
|
|
341
345
|
allowTeam: u,
|
|
342
346
|
allowAgent: x = !1,
|
|
343
347
|
onSubmit: m,
|
|
344
348
|
onCancel: h
|
|
345
349
|
}) {
|
|
346
|
-
var
|
|
347
|
-
const [
|
|
350
|
+
var P;
|
|
351
|
+
const [r, f] = C(d), b = (l, g) => f((k) => ({ ...k, [l]: g })), F = Ye(x).data ?? [], D = x && (F.length > 0 || r.mode === "agent"), N = r.mode === "team" ? r.teamId != null : r.mode === "agent" ? !!r.agent : !!r.assignee, _ = r.mode === "person" && ((P = r.assigneePerson) != null && P.is_out_of_office) ? r.assigneePerson : null;
|
|
348
352
|
return /* @__PURE__ */ n(
|
|
349
353
|
"div",
|
|
350
354
|
{
|
|
@@ -354,9 +358,9 @@ function pe({
|
|
|
354
358
|
/* @__PURE__ */ n("div", { children: [
|
|
355
359
|
/* @__PURE__ */ t(W, { className: "mb-1 block text-[11px]", children: "Title" }),
|
|
356
360
|
/* @__PURE__ */ t(
|
|
357
|
-
|
|
361
|
+
ne,
|
|
358
362
|
{
|
|
359
|
-
value:
|
|
363
|
+
value: r.title,
|
|
360
364
|
onChange: (l) => b("title", l.target.value),
|
|
361
365
|
className: "h-8 bg-white text-[12px] dark:bg-background",
|
|
362
366
|
placeholder: "What needs to be done?",
|
|
@@ -370,7 +374,7 @@ function pe({
|
|
|
370
374
|
/* @__PURE__ */ t(
|
|
371
375
|
Ge,
|
|
372
376
|
{
|
|
373
|
-
value:
|
|
377
|
+
value: r.description,
|
|
374
378
|
onChange: (l) => b("description", l.target.value),
|
|
375
379
|
className: "min-h-[56px] bg-white text-[12px] dark:bg-background",
|
|
376
380
|
placeholder: "Anything the person needs to know",
|
|
@@ -383,11 +387,11 @@ function pe({
|
|
|
383
387
|
/* @__PURE__ */ n("div", { className: "col-span-2 sm:col-span-1", children: [
|
|
384
388
|
/* @__PURE__ */ n("div", { className: "mb-1 flex items-center justify-between gap-2", children: [
|
|
385
389
|
/* @__PURE__ */ n(W, { className: "text-[11px]", children: [
|
|
386
|
-
|
|
390
|
+
r.mode === "team" ? "Team" : r.mode === "agent" ? "Agent" : "Assignee",
|
|
387
391
|
/* @__PURE__ */ t("span", { "aria-hidden": !0, className: "ml-0.5 text-red-500", "data-task-required": !0, children: "*" })
|
|
388
392
|
] }),
|
|
389
393
|
/* @__PURE__ */ t("span", { className: "flex items-center gap-2", children: ["person", "team", "agent"].filter(
|
|
390
|
-
(l) => l !==
|
|
394
|
+
(l) => l !== r.mode && (l !== "team" || u) && (l !== "agent" || D)
|
|
391
395
|
).map((l) => /* @__PURE__ */ t(
|
|
392
396
|
"button",
|
|
393
397
|
{
|
|
@@ -400,50 +404,50 @@ function pe({
|
|
|
400
404
|
l
|
|
401
405
|
)) })
|
|
402
406
|
] }),
|
|
403
|
-
|
|
407
|
+
r.mode === "agent" ? /* @__PURE__ */ t(
|
|
404
408
|
Ze,
|
|
405
409
|
{
|
|
406
|
-
agents:
|
|
407
|
-
value:
|
|
410
|
+
agents: F,
|
|
411
|
+
value: r.agent,
|
|
408
412
|
onChange: (l) => f((g) => ({ ...g, agent: (l == null ? void 0 : l.conn) ?? null, agentName: (l == null ? void 0 : l.name) ?? null }))
|
|
409
413
|
}
|
|
410
|
-
) :
|
|
414
|
+
) : r.mode === "team" ? /* @__PURE__ */ t(
|
|
411
415
|
et,
|
|
412
416
|
{
|
|
413
|
-
value:
|
|
414
|
-
onChange: (l, g) => f((
|
|
417
|
+
value: r.teamId,
|
|
418
|
+
onChange: (l, g) => f((k) => ({ ...k, teamId: l, teamName: (g == null ? void 0 : g.name) ?? null }))
|
|
415
419
|
}
|
|
416
420
|
) : /* @__PURE__ */ t(
|
|
417
421
|
Qe,
|
|
418
422
|
{
|
|
419
423
|
collection: a,
|
|
420
|
-
item:
|
|
421
|
-
value:
|
|
422
|
-
valueLabel:
|
|
423
|
-
onChange: (l, g) => f((
|
|
424
|
-
...
|
|
424
|
+
item: o,
|
|
425
|
+
value: r.assignee,
|
|
426
|
+
valueLabel: r.assigneeName,
|
|
427
|
+
onChange: (l, g) => f((k) => ({
|
|
428
|
+
...k,
|
|
425
429
|
assignee: l,
|
|
426
|
-
assigneeName: g ?
|
|
430
|
+
assigneeName: g ? G(g) : null,
|
|
427
431
|
assigneePerson: g
|
|
428
432
|
}))
|
|
429
433
|
}
|
|
430
434
|
),
|
|
431
|
-
|
|
432
|
-
|
|
435
|
+
_ && /* @__PURE__ */ n("p", { className: "mt-1 rounded bg-amber-50 px-2 py-1 text-[11px] text-amber-700 dark:bg-amber-400/10 dark:text-amber-400", children: [
|
|
436
|
+
G(_),
|
|
433
437
|
" is out of office",
|
|
434
|
-
|
|
438
|
+
_.ooo_end ? ` until ${String(_.ooo_end).slice(0, 10)}` : "",
|
|
435
439
|
" — the task goes to their delegate if one is set."
|
|
436
440
|
] }),
|
|
437
|
-
|
|
438
|
-
|
|
441
|
+
r.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." }),
|
|
442
|
+
r.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." })
|
|
439
443
|
] }),
|
|
440
444
|
/* @__PURE__ */ n("div", { children: [
|
|
441
445
|
/* @__PURE__ */ t(W, { className: "mb-1 block text-[11px]", children: "Due date" }),
|
|
442
446
|
/* @__PURE__ */ t(
|
|
443
|
-
|
|
447
|
+
ne,
|
|
444
448
|
{
|
|
445
449
|
type: "date",
|
|
446
|
-
value:
|
|
450
|
+
value: r.due,
|
|
447
451
|
onChange: (l) => b("due", l.target.value),
|
|
448
452
|
className: "h-8 bg-white text-[12px] dark:bg-background",
|
|
449
453
|
"data-task-due": !0
|
|
@@ -453,9 +457,9 @@ function pe({
|
|
|
453
457
|
/* @__PURE__ */ n("div", { children: [
|
|
454
458
|
/* @__PURE__ */ t(W, { className: "mb-1 block text-[11px]", children: "Priority" }),
|
|
455
459
|
/* @__PURE__ */ t(
|
|
456
|
-
|
|
460
|
+
J,
|
|
457
461
|
{
|
|
458
|
-
value:
|
|
462
|
+
value: r.priority,
|
|
459
463
|
onChange: (l) => b("priority", l),
|
|
460
464
|
options: [
|
|
461
465
|
{ value: "low", label: "Low" },
|
|
@@ -470,7 +474,7 @@ function pe({
|
|
|
470
474
|
tt,
|
|
471
475
|
{
|
|
472
476
|
collection: a,
|
|
473
|
-
value:
|
|
477
|
+
value: r.doneWhen,
|
|
474
478
|
onChange: (l) => b("doneWhen", l)
|
|
475
479
|
}
|
|
476
480
|
),
|
|
@@ -486,23 +490,35 @@ function pe({
|
|
|
486
490
|
children: "Cancel"
|
|
487
491
|
}
|
|
488
492
|
),
|
|
489
|
-
/* @__PURE__ */
|
|
493
|
+
/* @__PURE__ */ n(
|
|
490
494
|
"span",
|
|
491
495
|
{
|
|
492
496
|
className: "inline-flex",
|
|
493
|
-
"data-tip":
|
|
494
|
-
children:
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
497
|
+
"data-tip": i ? void 0 : r.title.trim() ? N ? void 0 : r.mode === "team" ? "Pick a team first" : r.mode === "agent" ? "Pick an agent first" : "Pick an assignee first" : "Write what needs to be done first",
|
|
498
|
+
children: [
|
|
499
|
+
/* @__PURE__ */ t(
|
|
500
|
+
z,
|
|
501
|
+
{
|
|
502
|
+
type: "button",
|
|
503
|
+
size: "sm",
|
|
504
|
+
className: "h-7 text-[12px]",
|
|
505
|
+
disabled: !r.title.trim() || !N || i,
|
|
506
|
+
"aria-describedby": !i && r.title.trim() && !N ? "task-submit-why" : void 0,
|
|
507
|
+
onClick: () => m(r),
|
|
508
|
+
"data-task-submit": !0,
|
|
509
|
+
children: i ? "Saving…" : c
|
|
510
|
+
}
|
|
511
|
+
),
|
|
512
|
+
!i && r.title.trim() && !N && /* @__PURE__ */ t(
|
|
513
|
+
"span",
|
|
514
|
+
{
|
|
515
|
+
id: "task-submit-why",
|
|
516
|
+
className: "ml-2 text-[11.5px] text-slate-500 dark:text-slate-400",
|
|
517
|
+
"data-task-submit-why": !0,
|
|
518
|
+
children: r.mode === "team" ? "Pick a team first" : r.mode === "agent" ? "Pick an agent first" : "Pick an assignee first"
|
|
519
|
+
}
|
|
520
|
+
)
|
|
521
|
+
]
|
|
506
522
|
}
|
|
507
523
|
)
|
|
508
524
|
] })
|
|
@@ -510,10 +526,10 @@ function pe({
|
|
|
510
526
|
}
|
|
511
527
|
);
|
|
512
528
|
}
|
|
513
|
-
function
|
|
514
|
-
const
|
|
529
|
+
function ge({ taskId: a }) {
|
|
530
|
+
const o = j(), { data: d = [], isLoading: c } = T({
|
|
515
531
|
queryKey: ["task-history", a],
|
|
516
|
-
queryFn: () =>
|
|
532
|
+
queryFn: () => o.request(A(`/tasks/${a}/history`)).then((i) => i.data),
|
|
517
533
|
staleTime: 3e4
|
|
518
534
|
});
|
|
519
535
|
return c ? /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "Loading history…" }) : d.length ? /* @__PURE__ */ t(
|
|
@@ -521,41 +537,41 @@ function he({ taskId: a }) {
|
|
|
521
537
|
{
|
|
522
538
|
className: "mt-1.5 space-y-1 border-l border-slate-200 pl-3 dark:border-border",
|
|
523
539
|
"data-task-history": !0,
|
|
524
|
-
children: d.map((
|
|
525
|
-
/* @__PURE__ */ t("span", { className: "text-slate-800 dark:text-slate-200", children:
|
|
540
|
+
children: d.map((i) => /* @__PURE__ */ n("li", { className: "text-[11px] text-slate-600 dark:text-slate-400", children: [
|
|
541
|
+
/* @__PURE__ */ t("span", { className: "text-slate-800 dark:text-slate-200", children: i.text }),
|
|
526
542
|
/* @__PURE__ */ n("span", { className: "text-slate-400", children: [
|
|
527
543
|
" ",
|
|
528
544
|
"· ",
|
|
529
|
-
|
|
530
|
-
/* @__PURE__ */ t("span", { title: new Date(
|
|
545
|
+
i.user_name ? `${i.user_name}, ` : "",
|
|
546
|
+
/* @__PURE__ */ t("span", { title: new Date(i.at).toLocaleString(), children: fe(i.at) })
|
|
531
547
|
] })
|
|
532
|
-
] },
|
|
548
|
+
] }, i.id))
|
|
533
549
|
}
|
|
534
550
|
) : /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "No history yet." });
|
|
535
551
|
}
|
|
536
552
|
function vt({
|
|
537
553
|
collection: a,
|
|
538
|
-
item:
|
|
554
|
+
item: o,
|
|
539
555
|
title: d,
|
|
540
556
|
defaultExpanded: c,
|
|
541
|
-
queuedTasks:
|
|
557
|
+
queuedTasks: i,
|
|
542
558
|
onQueueTask: u,
|
|
543
559
|
onRemoveQueuedTask: x
|
|
544
560
|
}) {
|
|
545
|
-
const m =
|
|
546
|
-
|
|
547
|
-
!
|
|
561
|
+
const m = j(), h = Fe(), { isAdmin: r, userId: f } = Me(), [b, F] = C(!1), D = Ue(!1);
|
|
562
|
+
te(() => {
|
|
563
|
+
!D.current && c !== void 0 && (D.current = !0, F(c));
|
|
548
564
|
}, [c]);
|
|
549
|
-
const [
|
|
550
|
-
queryKey: ["tasks", a,
|
|
551
|
-
queryFn: () => m.request(
|
|
552
|
-
enabled: !!a && !
|
|
553
|
-
}), { labels:
|
|
554
|
-
|
|
555
|
-
},
|
|
556
|
-
var
|
|
557
|
-
return ((
|
|
558
|
-
},
|
|
565
|
+
const [N, _] = C(!1), [P, l] = C(null), [g, k] = C(null), [R, M] = C(!1), y = !o || o === "new", { data: L = [] } = T({
|
|
566
|
+
queryKey: ["tasks", a, o],
|
|
567
|
+
queryFn: () => m.request(A("/tasks", { collection: a, item: o })).then((e) => e.data),
|
|
568
|
+
enabled: !!a && !y
|
|
569
|
+
}), { labels: H } = Pe(a), s = () => {
|
|
570
|
+
Ve(h, a, o), h.invalidateQueries({ queryKey: ["task-history"] });
|
|
571
|
+
}, S = (e, p) => {
|
|
572
|
+
var I;
|
|
573
|
+
return ((I = e == null ? void 0 : e.response) == null ? void 0 : I.error) ?? (e instanceof Error && e.message ? e.message : p);
|
|
574
|
+
}, E = (e) => ({
|
|
559
575
|
title: e.title.trim(),
|
|
560
576
|
description: e.description.trim() || null,
|
|
561
577
|
assignee: e.mode === "person" ? e.assignee : null,
|
|
@@ -564,44 +580,44 @@ function vt({
|
|
|
564
580
|
due_date: e.due || null,
|
|
565
581
|
priority: e.priority,
|
|
566
582
|
done_when: e.doneWhen.length ? e.doneWhen : null
|
|
567
|
-
}),
|
|
583
|
+
}), se = K({
|
|
568
584
|
mutationFn: (e) => m.request(
|
|
569
|
-
|
|
585
|
+
Y("/tasks", { collection: a, item: o, ...E(e) })
|
|
570
586
|
),
|
|
571
587
|
onSuccess: (e) => {
|
|
572
588
|
var p;
|
|
573
|
-
|
|
589
|
+
s(), _(!1), w.success(
|
|
574
590
|
(p = e == null ? void 0 : e.data) != null && p.delegated_from ? "Task created — it went to their delegate" : "Task created"
|
|
575
591
|
);
|
|
576
592
|
},
|
|
577
|
-
onError: (e) =>
|
|
578
|
-
}),
|
|
593
|
+
onError: (e) => w.error(S(e, "Could not create the task"))
|
|
594
|
+
}), B = K({
|
|
579
595
|
mutationFn: ({ id: e, body: p }) => m.request(He(`/tasks/${e}`, p)),
|
|
580
596
|
onSuccess: (e, p) => {
|
|
581
|
-
|
|
597
|
+
s(), l(null), p.body.status === "open" ? w.success("Task reopened") : w.success("Task updated");
|
|
582
598
|
},
|
|
583
|
-
onError: (e) =>
|
|
584
|
-
}),
|
|
585
|
-
mutationFn: (e) => m.request(
|
|
599
|
+
onError: (e) => w.error(S(e, "Could not update the task"))
|
|
600
|
+
}), le = K({
|
|
601
|
+
mutationFn: (e) => m.request(Y(`/tasks/${e}/complete`, {})),
|
|
586
602
|
onSuccess: () => {
|
|
587
|
-
|
|
603
|
+
s(), w.success("Task completed");
|
|
588
604
|
},
|
|
589
|
-
onError: (e) =>
|
|
590
|
-
}),
|
|
591
|
-
mutationFn: (e) => m.request(
|
|
605
|
+
onError: (e) => w.error(S(e, "Could not complete the task"))
|
|
606
|
+
}), ie = K({
|
|
607
|
+
mutationFn: (e) => m.request(Y(`/tasks/${e}/claim`, {})),
|
|
592
608
|
onSuccess: () => {
|
|
593
|
-
|
|
609
|
+
s(), w.success("It’s yours");
|
|
594
610
|
},
|
|
595
|
-
onError: (e) =>
|
|
611
|
+
onError: (e) => w.error(S(e, "Could not pick it up"))
|
|
596
612
|
}), re = K({
|
|
597
613
|
mutationFn: (e) => m.request(Be(`/tasks/${e}`)),
|
|
598
614
|
onSuccess: () => {
|
|
599
|
-
|
|
615
|
+
s(), w.success("Task deleted");
|
|
600
616
|
},
|
|
601
|
-
onError: (e) =>
|
|
617
|
+
onError: (e) => w.error(S(e, "Could not delete the task"))
|
|
602
618
|
});
|
|
603
619
|
if (!a) return null;
|
|
604
|
-
const
|
|
620
|
+
const v = L.filter((e) => me.has(e.status)), X = L.filter((e) => !me.has(e.status)), $e = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), Q = (e) => r || q(e.assignee, f) || q(e.created_by, f), qe = (e) => r || q(e.created_by, f);
|
|
605
621
|
function Te(e) {
|
|
606
622
|
u == null || u({
|
|
607
623
|
title: e.title.trim(),
|
|
@@ -612,12 +628,12 @@ function vt({
|
|
|
612
628
|
team_name: e.mode === "team" ? e.teamName : null,
|
|
613
629
|
due_date: e.due,
|
|
614
630
|
priority: e.priority
|
|
615
|
-
}),
|
|
631
|
+
}), _(!1);
|
|
616
632
|
}
|
|
617
|
-
const
|
|
618
|
-
const
|
|
633
|
+
const oe = (e, p) => {
|
|
634
|
+
const I = !p && !!e.due_date && String(e.due_date).slice(0, 10) < $e;
|
|
619
635
|
return /* @__PURE__ */ n("div", { className: "mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-slate-400", children: [
|
|
620
|
-
/* @__PURE__ */ t(
|
|
636
|
+
/* @__PURE__ */ t(pe, { priority: e.priority }),
|
|
621
637
|
e.agent_assignee ? /* @__PURE__ */ n(
|
|
622
638
|
"span",
|
|
623
639
|
{
|
|
@@ -637,28 +653,28 @@ function vt({
|
|
|
637
653
|
"Waiting for ",
|
|
638
654
|
e.team_name ?? "the team"
|
|
639
655
|
] }) : null,
|
|
640
|
-
!p && e.due_date && /* @__PURE__ */ n("span", { className:
|
|
656
|
+
!p && e.due_date && /* @__PURE__ */ n("span", { className: U(I && "font-medium text-red-500"), children: [
|
|
641
657
|
"Due ",
|
|
642
|
-
|
|
643
|
-
|
|
658
|
+
Z(e.due_date),
|
|
659
|
+
I && " (overdue)"
|
|
644
660
|
] }),
|
|
645
661
|
p && e.completed_at && /* @__PURE__ */ n("span", { "data-task-completed-by": !0, children: [
|
|
646
662
|
e.status === "cancelled" ? "Cancelled" : `Done${e.completed_by_name ? ` by ${e.completed_by_name}` : ""}`,
|
|
647
663
|
" ",
|
|
648
664
|
/* @__PURE__ */ t("span", { title: new Date(e.completed_at).toLocaleString(), children: fe(e.completed_at) })
|
|
649
665
|
] }),
|
|
650
|
-
e.created_by_name &&
|
|
666
|
+
e.created_by_name && !q(e.created_by, e.assignee) && /* @__PURE__ */ n("span", { children: [
|
|
651
667
|
"Asked by ",
|
|
652
668
|
e.created_by_name
|
|
653
669
|
] })
|
|
654
670
|
] });
|
|
655
|
-
},
|
|
656
|
-
!p && /* @__PURE__ */ t(
|
|
671
|
+
}, de = (e, p) => /* @__PURE__ */ n("div", { className: "flex shrink-0 items-center gap-0.5", children: [
|
|
672
|
+
!p && /* @__PURE__ */ t(ze, { task: e, compact: !0, onTaskChanged: s }),
|
|
657
673
|
/* @__PURE__ */ t(
|
|
658
674
|
"button",
|
|
659
675
|
{
|
|
660
676
|
type: "button",
|
|
661
|
-
onClick: () =>
|
|
677
|
+
onClick: () => k(g === e.id ? null : e.id),
|
|
662
678
|
className: "rounded p-1 text-slate-300 transition-colors hover:bg-muted hover:text-slate-600",
|
|
663
679
|
"aria-label": `History of ${e.title}`,
|
|
664
680
|
title: "History",
|
|
@@ -666,33 +682,33 @@ function vt({
|
|
|
666
682
|
children: /* @__PURE__ */ t(We, { className: "h-3.5 w-3.5" })
|
|
667
683
|
}
|
|
668
684
|
),
|
|
669
|
-
!p &&
|
|
685
|
+
!p && Q(e) && /* @__PURE__ */ t(
|
|
670
686
|
"button",
|
|
671
687
|
{
|
|
672
688
|
type: "button",
|
|
673
|
-
onClick: () => l(
|
|
689
|
+
onClick: () => l(P === e.id ? null : e.id),
|
|
674
690
|
className: "rounded p-1 text-slate-300 transition-colors hover:bg-muted hover:text-slate-600",
|
|
675
691
|
"aria-label": `Edit ${e.title}`,
|
|
676
692
|
title: "Edit",
|
|
677
693
|
"data-task-edit": e.id,
|
|
678
|
-
children: /* @__PURE__ */ t(
|
|
694
|
+
children: /* @__PURE__ */ t(je, { className: "h-3.5 w-3.5" })
|
|
679
695
|
}
|
|
680
696
|
),
|
|
681
|
-
p &&
|
|
697
|
+
p && Q(e) && /* @__PURE__ */ n(
|
|
682
698
|
"button",
|
|
683
699
|
{
|
|
684
700
|
type: "button",
|
|
685
|
-
onClick: () =>
|
|
686
|
-
disabled:
|
|
701
|
+
onClick: () => B.mutate({ id: e.id, body: { status: "open" } }),
|
|
702
|
+
disabled: B.isPending,
|
|
687
703
|
className: "inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-slate-500 transition-colors hover:bg-muted hover:text-slate-800 dark:hover:text-slate-200",
|
|
688
704
|
"data-task-reopen": e.id,
|
|
689
705
|
children: [
|
|
690
|
-
/* @__PURE__ */ t(
|
|
706
|
+
/* @__PURE__ */ t(Oe, { className: "h-3 w-3" }),
|
|
691
707
|
"Reopen"
|
|
692
708
|
]
|
|
693
709
|
}
|
|
694
710
|
),
|
|
695
|
-
|
|
711
|
+
qe(e) && /* @__PURE__ */ t(
|
|
696
712
|
"button",
|
|
697
713
|
{
|
|
698
714
|
type: "button",
|
|
@@ -701,7 +717,7 @@ function vt({
|
|
|
701
717
|
className: "rounded p-1 text-slate-300 transition-colors hover:bg-red-50 hover:text-red-400 disabled:opacity-40 dark:hover:bg-red-500/10",
|
|
702
718
|
"aria-label": `Delete ${e.title}`,
|
|
703
719
|
title: "Delete",
|
|
704
|
-
children: /* @__PURE__ */ t(
|
|
720
|
+
children: /* @__PURE__ */ t(ee, { className: "h-3.5 w-3.5" })
|
|
705
721
|
}
|
|
706
722
|
)
|
|
707
723
|
] });
|
|
@@ -710,7 +726,7 @@ function vt({
|
|
|
710
726
|
"button",
|
|
711
727
|
{
|
|
712
728
|
type: "button",
|
|
713
|
-
onClick: () =>
|
|
729
|
+
onClick: () => F((e) => !e),
|
|
714
730
|
"aria-expanded": b,
|
|
715
731
|
"data-task-panel-toggle": b ? "open" : "closed",
|
|
716
732
|
className: "flex w-full flex-col px-5 py-3.5 text-left transition-colors hover:bg-slate-50/50 dark:hover:bg-white/[0.02]",
|
|
@@ -718,34 +734,34 @@ function vt({
|
|
|
718
734
|
/* @__PURE__ */ n("span", { className: "flex w-full items-center gap-2.5", children: [
|
|
719
735
|
/* @__PURE__ */ t(De, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
720
736
|
/* @__PURE__ */ t("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: d || "Tasks" }),
|
|
721
|
-
(
|
|
737
|
+
(y ? (i ?? []).length : v.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: y ? `${(i ?? []).length} queued` : `${v.length} open` }),
|
|
722
738
|
/* @__PURE__ */ t(
|
|
723
|
-
|
|
739
|
+
ce,
|
|
724
740
|
{
|
|
725
741
|
className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${b ? " rotate-180" : ""}`
|
|
726
742
|
}
|
|
727
743
|
)
|
|
728
744
|
] }),
|
|
729
|
-
!b &&
|
|
730
|
-
|
|
731
|
-
|
|
745
|
+
!b && v.length > 0 && /* @__PURE__ */ n("span", { className: "mt-1 w-full truncate pl-6 text-[11.5px] text-slate-400", children: [
|
|
746
|
+
v[v.length - 1].title,
|
|
747
|
+
v[v.length - 1].due_date && /* @__PURE__ */ n("span", { className: "text-slate-400/80", children: [
|
|
732
748
|
" ",
|
|
733
749
|
"· due ",
|
|
734
|
-
|
|
750
|
+
Z(v[v.length - 1].due_date)
|
|
735
751
|
] })
|
|
736
752
|
] })
|
|
737
753
|
]
|
|
738
754
|
}
|
|
739
755
|
),
|
|
740
756
|
b && /* @__PURE__ */ t("div", { className: "border-t border-slate-100 dark:border-border/60", children: /* @__PURE__ */ n("div", { className: "space-y-3 px-5 py-3", children: [
|
|
741
|
-
|
|
757
|
+
y && (i ?? []).length > 0 && /* @__PURE__ */ t("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: (i ?? []).map((e, p) => (
|
|
742
758
|
// biome-ignore lint/suspicious/noArrayIndexKey: queued rows have no id yet
|
|
743
759
|
/* @__PURE__ */ n("div", { className: "flex items-start gap-2.5 py-2", children: [
|
|
744
760
|
/* @__PURE__ */ t("span", { className: "mt-0.5 inline-flex shrink-0 items-center rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:bg-amber-500/15 dark:text-amber-400", children: "Pending" }),
|
|
745
761
|
/* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
|
|
746
762
|
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: e.title }),
|
|
747
763
|
/* @__PURE__ */ n("div", { className: "mt-0.5 flex items-center gap-3 text-[11px] text-slate-400", children: [
|
|
748
|
-
/* @__PURE__ */ t(
|
|
764
|
+
/* @__PURE__ */ t(pe, { priority: e.priority }),
|
|
749
765
|
e.assignee_name && /* @__PURE__ */ t("span", { children: e.assignee_name }),
|
|
750
766
|
e.team_name && /* @__PURE__ */ n("span", { children: [
|
|
751
767
|
"Team: ",
|
|
@@ -753,7 +769,7 @@ function vt({
|
|
|
753
769
|
] }),
|
|
754
770
|
e.due_date && /* @__PURE__ */ n("span", { children: [
|
|
755
771
|
"Due ",
|
|
756
|
-
|
|
772
|
+
Z(e.due_date)
|
|
757
773
|
] })
|
|
758
774
|
] })
|
|
759
775
|
] }),
|
|
@@ -764,80 +780,80 @@ function vt({
|
|
|
764
780
|
onClick: () => x(p),
|
|
765
781
|
className: "shrink-0 rounded p-1 text-slate-300 hover:text-red-400",
|
|
766
782
|
"aria-label": `Remove ${e.title}`,
|
|
767
|
-
children: /* @__PURE__ */ t(
|
|
783
|
+
children: /* @__PURE__ */ t(ee, { className: "h-3.5 w-3.5" })
|
|
768
784
|
}
|
|
769
785
|
)
|
|
770
786
|
] }, p)
|
|
771
787
|
)) }),
|
|
772
|
-
|
|
773
|
-
!
|
|
774
|
-
!
|
|
775
|
-
const p = Se(e.done_when),
|
|
788
|
+
y && (i ?? []).length === 0 && !N && /* @__PURE__ */ t("p", { className: "py-1 text-[12px] text-slate-400", children: "Tasks are created once the record is saved." }),
|
|
789
|
+
!y && v.length === 0 && !N && /* @__PURE__ */ t("p", { className: "py-1 text-[13px] text-slate-400", children: "No open tasks" }),
|
|
790
|
+
!y && v.length > 0 && /* @__PURE__ */ t("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: v.map((e) => {
|
|
791
|
+
const p = Se(e.done_when), I = !e.assignee && e.team_id != null;
|
|
776
792
|
return /* @__PURE__ */ n("div", { className: "nvr-rise-in py-2", "data-task-row": e.id, children: [
|
|
777
793
|
/* @__PURE__ */ n("div", { className: "flex items-start gap-2.5", children: [
|
|
778
794
|
/* @__PURE__ */ t(
|
|
779
|
-
|
|
795
|
+
ue,
|
|
780
796
|
{
|
|
781
797
|
className: "mt-0.5",
|
|
782
798
|
checked: !1,
|
|
783
|
-
onCheckedChange: () =>
|
|
784
|
-
disabled:
|
|
799
|
+
onCheckedChange: () => le.mutate(e.id),
|
|
800
|
+
disabled: le.isPending || !Q(e),
|
|
785
801
|
"aria-label": `Complete task: ${e.title}`
|
|
786
802
|
}
|
|
787
803
|
),
|
|
788
804
|
/* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
|
|
789
805
|
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: e.title }),
|
|
790
806
|
e.description && /* @__PURE__ */ t("p", { className: "mt-0.5 line-clamp-2 whitespace-pre-line text-[12px] text-slate-500", children: e.description }),
|
|
791
|
-
|
|
807
|
+
oe(e, !1),
|
|
792
808
|
p.length > 0 && /* @__PURE__ */ n("p", { className: "mt-0.5 text-[11px] text-slate-500", "data-task-rule": !0, children: [
|
|
793
809
|
"Closes itself when ",
|
|
794
|
-
Xe(p,
|
|
810
|
+
Xe(p, H)
|
|
795
811
|
] }),
|
|
796
|
-
|
|
812
|
+
I && /* @__PURE__ */ t(
|
|
797
813
|
"button",
|
|
798
814
|
{
|
|
799
815
|
type: "button",
|
|
800
|
-
onClick: () =>
|
|
801
|
-
disabled:
|
|
816
|
+
onClick: () => ie.mutate(e.id),
|
|
817
|
+
disabled: ie.isPending,
|
|
802
818
|
className: "mt-1 rounded border border-slate-200 px-2 py-0.5 text-[11px] font-medium text-slate-700 hover:bg-muted dark:border-border dark:text-slate-300",
|
|
803
819
|
"data-task-claim": e.id,
|
|
804
820
|
children: "Pick it up"
|
|
805
821
|
}
|
|
806
822
|
)
|
|
807
823
|
] }),
|
|
808
|
-
|
|
824
|
+
de(e, !1)
|
|
809
825
|
] }),
|
|
810
|
-
|
|
811
|
-
|
|
826
|
+
P === e.id && /* @__PURE__ */ t("div", { className: "mt-2 pl-6", children: /* @__PURE__ */ t(
|
|
827
|
+
he,
|
|
812
828
|
{
|
|
813
829
|
collection: a,
|
|
814
|
-
item:
|
|
830
|
+
item: o,
|
|
815
831
|
initial: nt(e),
|
|
816
832
|
submitLabel: "Save changes",
|
|
817
|
-
busy:
|
|
833
|
+
busy: B.isPending,
|
|
818
834
|
allowTeam: !1,
|
|
819
835
|
allowAgent: !0,
|
|
820
836
|
onCancel: () => l(null),
|
|
821
|
-
onSubmit: (
|
|
822
|
-
const
|
|
823
|
-
title:
|
|
824
|
-
description:
|
|
825
|
-
due_date:
|
|
826
|
-
priority:
|
|
827
|
-
done_when:
|
|
837
|
+
onSubmit: ($) => {
|
|
838
|
+
const O = E($), V = {
|
|
839
|
+
title: O.title,
|
|
840
|
+
description: O.description,
|
|
841
|
+
due_date: O.due_date,
|
|
842
|
+
priority: O.priority,
|
|
843
|
+
done_when: O.done_when
|
|
828
844
|
};
|
|
829
|
-
|
|
845
|
+
$.mode === "agent" ? $.agent && $.agent !== e.agent_assignee && (V.agent = $.agent) : $.mode === "person" && (q($.assignee, e.assignee) ? e.agent_assignee && (V.agent = null) : V.assignee = $.assignee), B.mutate({ id: e.id, body: V });
|
|
830
846
|
}
|
|
831
847
|
}
|
|
832
848
|
) }),
|
|
833
|
-
g === e.id && /* @__PURE__ */ t("div", { className: "pl-6", children: /* @__PURE__ */ t(
|
|
849
|
+
g === e.id && /* @__PURE__ */ t("div", { className: "pl-6", children: /* @__PURE__ */ t(ge, { taskId: e.id }) })
|
|
834
850
|
] }, e.id);
|
|
835
851
|
}) }),
|
|
836
|
-
!
|
|
852
|
+
!N && /* @__PURE__ */ n(
|
|
837
853
|
"button",
|
|
838
854
|
{
|
|
839
855
|
type: "button",
|
|
840
|
-
onClick: () =>
|
|
856
|
+
onClick: () => _(!0),
|
|
841
857
|
className: "flex items-center gap-1.5 text-[12px] text-slate-400 transition-colors hover:text-nvr-cyan",
|
|
842
858
|
"data-task-add": !0,
|
|
843
859
|
children: [
|
|
@@ -846,21 +862,21 @@ function vt({
|
|
|
846
862
|
]
|
|
847
863
|
}
|
|
848
864
|
),
|
|
849
|
-
|
|
850
|
-
|
|
865
|
+
N && /* @__PURE__ */ t(
|
|
866
|
+
he,
|
|
851
867
|
{
|
|
852
868
|
collection: a,
|
|
853
|
-
item:
|
|
869
|
+
item: o,
|
|
854
870
|
initial: at(),
|
|
855
|
-
submitLabel:
|
|
856
|
-
busy:
|
|
871
|
+
submitLabel: y ? "Queue task" : "Create task",
|
|
872
|
+
busy: se.isPending,
|
|
857
873
|
allowTeam: !0,
|
|
858
|
-
allowAgent: !
|
|
859
|
-
onCancel: () =>
|
|
860
|
-
onSubmit: (e) =>
|
|
874
|
+
allowAgent: !y,
|
|
875
|
+
onCancel: () => _(!1),
|
|
876
|
+
onSubmit: (e) => y ? Te(e) : se.mutate(e)
|
|
861
877
|
}
|
|
862
878
|
),
|
|
863
|
-
!
|
|
879
|
+
!y && X.length > 0 && /* @__PURE__ */ n("div", { children: [
|
|
864
880
|
/* @__PURE__ */ n(
|
|
865
881
|
"button",
|
|
866
882
|
{
|
|
@@ -869,24 +885,24 @@ function vt({
|
|
|
869
885
|
className: "flex items-center gap-1 text-[12px] text-slate-400 transition-colors hover:text-slate-600",
|
|
870
886
|
children: [
|
|
871
887
|
/* @__PURE__ */ t(
|
|
872
|
-
|
|
888
|
+
ce,
|
|
873
889
|
{
|
|
874
|
-
className:
|
|
890
|
+
className: U(
|
|
875
891
|
"h-3.5 w-3.5 transition-transform",
|
|
876
|
-
|
|
892
|
+
R && "rotate-180"
|
|
877
893
|
)
|
|
878
894
|
}
|
|
879
895
|
),
|
|
880
896
|
"Completed (",
|
|
881
|
-
|
|
897
|
+
X.length,
|
|
882
898
|
")"
|
|
883
899
|
]
|
|
884
900
|
}
|
|
885
901
|
),
|
|
886
|
-
|
|
902
|
+
R && /* @__PURE__ */ t("div", { className: "mt-1 divide-y divide-slate-100 dark:divide-border/60", children: X.map((e) => /* @__PURE__ */ n("div", { className: "nvr-rise-in py-2", "data-task-row": e.id, children: [
|
|
887
903
|
/* @__PURE__ */ n("div", { className: "flex items-start gap-2.5", children: [
|
|
888
904
|
/* @__PURE__ */ t(
|
|
889
|
-
|
|
905
|
+
ue,
|
|
890
906
|
{
|
|
891
907
|
className: "mt-0.5 opacity-60",
|
|
892
908
|
checked: !0,
|
|
@@ -896,11 +912,11 @@ function vt({
|
|
|
896
912
|
),
|
|
897
913
|
/* @__PURE__ */ n("div", { className: "min-w-0 flex-1 opacity-70", children: [
|
|
898
914
|
/* @__PURE__ */ t("p", { className: "text-[13px] text-slate-600 line-through dark:text-slate-400", children: e.title }),
|
|
899
|
-
|
|
915
|
+
oe(e, !0)
|
|
900
916
|
] }),
|
|
901
|
-
|
|
917
|
+
de(e, !0)
|
|
902
918
|
] }),
|
|
903
|
-
g === e.id && /* @__PURE__ */ t("div", { className: "pl-6", children: /* @__PURE__ */ t(
|
|
919
|
+
g === e.id && /* @__PURE__ */ t("div", { className: "pl-6", children: /* @__PURE__ */ t(ge, { taskId: e.id }) })
|
|
904
920
|
] }, e.id)) })
|
|
905
921
|
] })
|
|
906
922
|
] }) })
|