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