@nivaro/react 0.3.127 → 0.3.128
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 +20 -2
- package/dist/index.js +150 -147
- package/dist/shared/components/CollectionBrowserView.js +3259 -3211
- package/dist/shared/components/DataTable.js +406 -401
- package/dist/shared/components/ItemEditForm.js +4203 -4156
- package/dist/shared/components/MatrixEditor.js +548 -490
- package/dist/shared/components/MyWorkView.js +284 -274
- package/dist/shared/components/NotificationBell.js +264 -218
- package/dist/shared/components/RecordGridEditor.js +582 -472
- package/dist/shared/components/chat/chat-core.js +331 -346
- package/dist/shared/components/chat/chat-typing.js +25 -0
- package/dist/shared/components/command-center/CommandCenterView.js +1 -1
- package/dist/shared/components/command-center/PeekPanel.js +8 -1
- package/dist/shared/components/command-center/api.js +17 -9
- package/dist/shared/components/command-center/panels/AttentionPanel.js +4 -1
- package/dist/shared/components/command-center/panels/PartnersPanel.js +2 -1
- package/dist/shared/components/item-edit/GroupSection.js +1 -1
- package/dist/shared/components/item-edit/InlineTableField.js +432 -429
- package/dist/shared/components/item-edit/RecordLiveSync.js +115 -108
- package/dist/shared/components/item-edit/RecordViewersChip.js +17 -16
- package/dist/shared/components/item-edit/RowComments.js +33 -30
- package/dist/shared/components/item-edit/cascade-clear-notice.js +30 -28
- package/dist/shared/components/item-edit/live-related.js +29 -16
- package/dist/shared/components/item-edit/record-opened-live.js +86 -0
- package/dist/shared/components/panels/OwnerOpenedLine.js +24 -23
- package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
- package/dist/shared/components/pipeline/TeamSuggestions.js +1 -1
- package/dist/shared/components/queue/QueueItemSheet.js +171 -130
- package/dist/shared/components/record-grid-guard.js +85 -0
- package/dist/shared/components/support/TicketDetailSheet.js +168 -151
- package/dist/shared/lib/at-risk-fields.js +14 -0
- package/dist/shared/lib/live-queries.js +9 -8
- package/dist/shared/lib/live-screen.js +77 -76
- package/dist/shared/lib/presence-hooks.js +190 -127
- package/dist/shared/lib/user-sync.js +78 -65
- package/dist/shared/lib/waiting-count.js +40 -29
- package/package.json +1 -1
|
@@ -1,87 +1,92 @@
|
|
|
1
1
|
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Check as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useApiFetchConfig as
|
|
6
|
-
import { useDeadlineNow as
|
|
7
|
-
import { useLiveEvent as
|
|
8
|
-
import { useLiveOps as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
|
|
2
|
+
import { useQueryClient as Se, useQuery as Ce, useMutation as H } from "@tanstack/react-query";
|
|
3
|
+
import { Check as $e, Bot as Te } from "lucide-react";
|
|
4
|
+
import { useState as O, useMemo as J, useRef as W, useEffect as V } from "react";
|
|
5
|
+
import { useApiFetchConfig as je, useItemNavigation as Oe, useNavigation as Ie } from "../context.js";
|
|
6
|
+
import { useDeadlineNow as Le, liveSlaReading as Me } from "../lib/deadline-ticker.js";
|
|
7
|
+
import { useLiveEvent as Ae } from "../lib/live.js";
|
|
8
|
+
import { useLiveOps as De, useFreshIds as qe } from "../lib/live-ops.js";
|
|
9
|
+
import { useSettledRows as Fe } from "../lib/live-screen.js";
|
|
10
|
+
import { resolveNotificationTarget as ue, runNotificationTarget as We } from "../lib/notification-target.js";
|
|
11
|
+
import { usePrefetchIntent as Ee } from "../lib/prefetch.js";
|
|
12
|
+
import { useOptionalRealtime as Ue, updateItemIds as Ke } from "../lib/realtime.js";
|
|
13
|
+
import { usePeekOrOpen as Pe, peekable as pe } from "../lib/record-peek.js";
|
|
14
|
+
import { userErrorMessage as Qe } from "../lib/safe-error.js";
|
|
15
|
+
import { withinDay as Be, slaChip as Re } from "../lib/sla-chip.js";
|
|
16
|
+
import { cn as I, formatRelative as ze } from "../lib/utils.js";
|
|
17
|
+
import { AgentQuestionsCard as He } from "./AgentQuestionsCard.js";
|
|
18
|
+
import { FirstWeekCard as Je } from "./ai/FirstWeekCard.js";
|
|
19
|
+
import { TaskDoButton as Ve } from "./ai/TaskDo.js";
|
|
20
|
+
import { openChatRoom as Ye, canOpenChatRoom as Ze } from "./chat/chat-core.js";
|
|
21
|
+
import { useMyRecordRooms as Ge } from "./chat/chat-hooks.js";
|
|
22
|
+
import { useCoveringQuery as Xe, DelegateCoverLine as et } from "./DelegateCoverLine.js";
|
|
23
|
+
import { LearningPathCard as tt } from "./help-videos/viewer/LearningPathCard.js";
|
|
24
|
+
import { RequiredVideosCard as rt } from "./help-videos/viewer/RequiredVideosCard.js";
|
|
25
|
+
import { SkeletonBar as at, ListSkeleton as nt } from "./Skeletons.js";
|
|
26
|
+
import { TickerNumber as st } from "./TickerNumber.js";
|
|
27
|
+
import { UserAvatar as dt } from "./UserAvatar.js";
|
|
28
|
+
const ot = 8e3, he = ["records", "proposals", "tasks", "team", "waiting", "notifications"], be = /* @__PURE__ */ new Set(["records", "proposals"]), xe = {
|
|
28
29
|
records: "Waiting on you",
|
|
29
30
|
proposals: "Changes to review",
|
|
30
31
|
tasks: "My tasks",
|
|
31
32
|
team: "Team tasks",
|
|
32
33
|
waiting: "Waiting on others",
|
|
33
34
|
notifications: "Notifications"
|
|
34
|
-
},
|
|
35
|
+
}, it = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), E = (d) => !!d && String(d).slice(0, 10) < it(), lt = {
|
|
35
36
|
alert: "bg-red-500/10 text-red-600 dark:text-red-400",
|
|
36
37
|
warn: "bg-amber-400/15 text-amber-700 dark:text-amber-400",
|
|
37
38
|
neutral: "bg-slate-500/10 text-slate-600 dark:text-slate-400",
|
|
38
39
|
ok: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400"
|
|
39
40
|
};
|
|
40
|
-
function
|
|
41
|
-
return
|
|
41
|
+
function Y(d, u) {
|
|
42
|
+
return d != null && d.due_at ? Me(d, u) : d;
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
-
|
|
44
|
+
function ct(d, u) {
|
|
45
|
+
const l = Ke(d);
|
|
46
|
+
return l == null ? !0 : l.some((g) => String(g) === "*" || u.has(`${d.collection}:${g}`));
|
|
45
47
|
}
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
function Z(d) {
|
|
49
|
+
return !d || d.status === "breached" ? !1 : d.status === "warning" || Be(d);
|
|
50
|
+
}
|
|
51
|
+
function mt({ sla: d }) {
|
|
52
|
+
const u = Re(d), l = u && Z(d) ? { ...u, tone: "warn" } : u;
|
|
53
|
+
return l ? /* @__PURE__ */ e(
|
|
49
54
|
"span",
|
|
50
55
|
{
|
|
51
|
-
"data-sla-chip":
|
|
52
|
-
className: `rounded px-1.5 py-0.5 text-[10px] font-semibold tabular-nums transition-colors duration-500 ${
|
|
53
|
-
children:
|
|
56
|
+
"data-sla-chip": l.tone,
|
|
57
|
+
className: `rounded px-1.5 py-0.5 text-[10px] font-semibold tabular-nums transition-colors duration-500 ${lt[l.tone]}`,
|
|
58
|
+
children: l.label
|
|
54
59
|
}
|
|
55
60
|
) : null;
|
|
56
61
|
}
|
|
57
|
-
function
|
|
58
|
-
return
|
|
62
|
+
function ut({ state: d, color: u }) {
|
|
63
|
+
return d ? /* @__PURE__ */ e(
|
|
59
64
|
"span",
|
|
60
65
|
{
|
|
61
|
-
"data-tip":
|
|
66
|
+
"data-tip": d,
|
|
62
67
|
className: "min-w-0 truncate rounded-full px-2 py-0.5 text-[10.5px] font-medium",
|
|
63
68
|
style: {
|
|
64
69
|
backgroundColor: u ? `${u}22` : "rgba(100,116,139,.12)",
|
|
65
70
|
color: u ?? void 0
|
|
66
71
|
},
|
|
67
|
-
children:
|
|
72
|
+
children: d
|
|
68
73
|
}
|
|
69
74
|
) : null;
|
|
70
75
|
}
|
|
71
|
-
function
|
|
72
|
-
const
|
|
76
|
+
function pt({ order: d, hidden: u }) {
|
|
77
|
+
const l = d.filter(
|
|
73
78
|
(p) => !u.includes(p) && (p === "records" || p === "tasks" || p === "notifications")
|
|
74
|
-
),
|
|
79
|
+
), g = (p, w) => /* @__PURE__ */ n(
|
|
75
80
|
"section",
|
|
76
81
|
{
|
|
77
82
|
className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card",
|
|
78
83
|
children: [
|
|
79
84
|
/* @__PURE__ */ n("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
|
|
80
|
-
/* @__PURE__ */ e("h2", { className: "text-[13px] font-medium text-slate-400 dark:text-slate-500", children:
|
|
85
|
+
/* @__PURE__ */ e("h2", { className: "text-[13px] font-medium text-slate-400 dark:text-slate-500", children: xe[p] ?? p }),
|
|
81
86
|
p === "records" && /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Records whose current step resolves you as an owner — most urgent first." })
|
|
82
87
|
] }),
|
|
83
88
|
/* @__PURE__ */ e(
|
|
84
|
-
|
|
89
|
+
nt,
|
|
85
90
|
{
|
|
86
91
|
header: !1,
|
|
87
92
|
rows: w,
|
|
@@ -100,15 +105,15 @@ function lt({ order: o, hidden: u }) {
|
|
|
100
105
|
]
|
|
101
106
|
},
|
|
102
107
|
p
|
|
103
|
-
),
|
|
104
|
-
for (let p = 0; p <
|
|
105
|
-
if (
|
|
106
|
-
|
|
108
|
+
), k = [];
|
|
109
|
+
for (let p = 0; p < l.length; ) {
|
|
110
|
+
if (l[p] === "records") {
|
|
111
|
+
k.push(g("records", 5)), p++;
|
|
107
112
|
continue;
|
|
108
113
|
}
|
|
109
|
-
const w =
|
|
110
|
-
|
|
111
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children: w.map((
|
|
114
|
+
const w = l.slice(p, p + 2).filter((y) => y !== "records");
|
|
115
|
+
k.push(
|
|
116
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children: w.map((y) => g(y, 4)) }, w.join("+"))
|
|
112
117
|
), p += w.length;
|
|
113
118
|
}
|
|
114
119
|
return /* @__PURE__ */ n("div", { className: "space-y-5 p-4 sm:p-6", "data-my-work-loading": !0, "aria-busy": "true", children: [
|
|
@@ -119,7 +124,7 @@ function lt({ order: o, hidden: u }) {
|
|
|
119
124
|
className: "rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card",
|
|
120
125
|
children: [
|
|
121
126
|
/* @__PURE__ */ e("p", { className: "text-[10.5px] uppercase tracking-wide text-muted-foreground", children: p }),
|
|
122
|
-
/* @__PURE__ */ e("p", { className: "mt-0.5 flex h-[27px] items-center", children: /* @__PURE__ */ e(
|
|
127
|
+
/* @__PURE__ */ e("p", { className: "mt-0.5 flex h-[27px] items-center", children: /* @__PURE__ */ e(at, { width: 34, className: "h-[18px] rounded-md" }) })
|
|
123
128
|
]
|
|
124
129
|
},
|
|
125
130
|
p
|
|
@@ -127,154 +132,163 @@ function lt({ order: o, hidden: u }) {
|
|
|
127
132
|
/* @__PURE__ */ e("span", { className: "ml-3 rounded-md border border-slate-200 px-2.5 py-1.5 text-[12px] text-slate-400 dark:border-border dark:text-slate-500", children: "Refresh" }),
|
|
128
133
|
/* @__PURE__ */ e("span", { className: "ml-2 rounded-md border border-slate-200 px-2.5 py-1.5 text-[12px] text-slate-400 dark:border-border dark:text-slate-500", children: "Customize" })
|
|
129
134
|
] }),
|
|
130
|
-
|
|
135
|
+
k
|
|
131
136
|
] });
|
|
132
137
|
}
|
|
133
|
-
function U({ label:
|
|
138
|
+
function U({ label: d, value: u, tone: l }) {
|
|
134
139
|
return /* @__PURE__ */ n("div", { className: "min-w-0 rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card", children: [
|
|
135
|
-
/* @__PURE__ */ e("p", { className: "break-words text-[10.5px] uppercase tracking-wide text-muted-foreground", children:
|
|
136
|
-
/* @__PURE__ */ e("p", { className: `mt-0.5 text-[18px] font-semibold tabular-nums ${
|
|
140
|
+
/* @__PURE__ */ e("p", { className: "break-words text-[10.5px] uppercase tracking-wide text-muted-foreground", children: d }),
|
|
141
|
+
/* @__PURE__ */ e("p", { className: `mt-0.5 text-[18px] font-semibold tabular-nums ${l ?? ""}`, children: /* @__PURE__ */ e(st, { value: u }) })
|
|
137
142
|
] });
|
|
138
143
|
}
|
|
139
|
-
function
|
|
140
|
-
notificationRoutes:
|
|
144
|
+
function Pt({
|
|
145
|
+
notificationRoutes: d,
|
|
141
146
|
onOpenPath: u
|
|
142
147
|
} = {}) {
|
|
143
|
-
const { apiBase:
|
|
144
|
-
var h,
|
|
145
|
-
const s = ((h =
|
|
146
|
-
u ? u(s) :
|
|
147
|
-
},
|
|
148
|
+
const { apiBase: l, authHeaders: g, credentials: k } = je(), { open: p } = Oe(), w = Pe(), y = Ie(), v = Se(), G = Ee(), X = (r) => {
|
|
149
|
+
var h, c;
|
|
150
|
+
const s = ((h = d == null ? void 0 : d.support) == null ? void 0 : h.call(d, String(r))) ?? ((c = y.consoleUrl) == null ? void 0 : c.call(y, `/support?ticket=${r}`)) ?? `/support?ticket=${r}`;
|
|
151
|
+
u ? u(s) : y.navigate(s);
|
|
152
|
+
}, K = Ue(), [x, ge] = O(() => {
|
|
148
153
|
try {
|
|
149
154
|
const r = localStorage.getItem("nvr_mywork_sections");
|
|
150
155
|
if (r) {
|
|
151
156
|
const s = JSON.parse(r);
|
|
152
157
|
if (Array.isArray(s == null ? void 0 : s.order) && Array.isArray(s == null ? void 0 : s.hidden)) {
|
|
153
|
-
const h =
|
|
154
|
-
k:
|
|
155
|
-
at: s.order.indexOf(
|
|
156
|
-
})).sort((
|
|
157
|
-
return { order: h, hidden: s.hidden.filter((
|
|
158
|
+
const h = he.map((c, b) => ({
|
|
159
|
+
k: c,
|
|
160
|
+
at: s.order.indexOf(c) >= 0 ? s.order.indexOf(c) : b - 0.5
|
|
161
|
+
})).sort((c, b) => c.at - b.at).map((c) => c.k);
|
|
162
|
+
return { order: h, hidden: s.hidden.filter((c) => h.includes(c)) };
|
|
158
163
|
}
|
|
159
164
|
}
|
|
160
165
|
} catch {
|
|
161
166
|
}
|
|
162
|
-
return { order: [...
|
|
163
|
-
}),
|
|
164
|
-
|
|
167
|
+
return { order: [...he], hidden: [] };
|
|
168
|
+
}), ee = (r) => {
|
|
169
|
+
ge(r);
|
|
165
170
|
try {
|
|
166
171
|
localStorage.setItem("nvr_mywork_sections", JSON.stringify(r));
|
|
167
172
|
} catch {
|
|
168
173
|
}
|
|
169
|
-
}, [
|
|
170
|
-
const r =
|
|
174
|
+
}, [fe, ke] = O(!1), [_, ye] = O("all"), L = Le(!0), [M, te] = O(null), { data: A } = Xe(), f = J(() => {
|
|
175
|
+
const r = M ? A == null ? void 0 : A.find((s) => s.user_id === M) : null;
|
|
171
176
|
return r ? { userId: r.user_id, name: r.first_name || r.name, keys: new Set(r.keys) } : null;
|
|
172
|
-
}, [
|
|
177
|
+
}, [M, A]), { data: a, isLoading: we, refetch: Ne, isFetching: re } = Ce({
|
|
173
178
|
queryKey: ["my-work"],
|
|
174
179
|
queryFn: async () => {
|
|
175
|
-
const r = await fetch(`${
|
|
180
|
+
const r = await fetch(`${l}/my-work`, { headers: g, credentials: k });
|
|
176
181
|
if (!r.ok) throw new Error("my-work failed");
|
|
177
182
|
return (await r.json()).data;
|
|
178
183
|
},
|
|
179
184
|
staleTime: 6e4
|
|
180
|
-
}),
|
|
185
|
+
}), ae = W(0), $ = W(null), D = () => {
|
|
181
186
|
const r = () => {
|
|
182
|
-
$.current = null,
|
|
183
|
-
}, s =
|
|
187
|
+
$.current = null, ae.current = Date.now(), v.invalidateQueries({ queryKey: ["my-work"] });
|
|
188
|
+
}, s = ae.current + ot - Date.now();
|
|
184
189
|
$.current || (s <= 0 ? r() : $.current = setTimeout(r, s));
|
|
185
190
|
};
|
|
186
|
-
|
|
191
|
+
De("my-work", D, { debounceMs: 1500 }), Ae("notification:new", D, { debounceMs: 1500 }), V(
|
|
187
192
|
() => () => {
|
|
188
193
|
$.current && clearTimeout($.current);
|
|
189
194
|
},
|
|
190
195
|
[]
|
|
191
196
|
);
|
|
192
|
-
const
|
|
197
|
+
const ne = qe([
|
|
193
198
|
...((a == null ? void 0 : a.owned) ?? []).map((r) => `o:${r.collection}:${r.item}`),
|
|
194
199
|
...((a == null ? void 0 : a.tasks) ?? []).map((r) => `t:${r.id}`),
|
|
195
200
|
...((a == null ? void 0 : a.team_tasks) ?? []).map((r) => `tt:${r.id}`),
|
|
196
201
|
...((a == null ? void 0 : a.requested) ?? []).map((r) => `r:${r.id}`),
|
|
197
202
|
...((a == null ? void 0 : a.notifications) ?? []).map((r) => `n:${r.id}`),
|
|
198
203
|
...((a == null ? void 0 : a.proposals) ?? []).map((r) => `p:${r.id}`)
|
|
199
|
-
]),
|
|
204
|
+
]), S = (r) => ne.has(r) ? "bg-nvr-cyan/10 transition-colors duration-700" : "transition-colors duration-700", P = J(() => {
|
|
200
205
|
const r = /* @__PURE__ */ new Set();
|
|
201
206
|
for (const s of (a == null ? void 0 : a.owned) ?? []) s.collection && r.add(s.collection);
|
|
202
207
|
return [...r];
|
|
203
|
-
}, [a]);
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
}, [a]), se = W(/* @__PURE__ */ new Set());
|
|
209
|
+
se.current = new Set(((a == null ? void 0 : a.owned) ?? []).map((r) => `${r.collection}:${r.item}`));
|
|
210
|
+
const de = W(D);
|
|
211
|
+
de.current = D, V(() => {
|
|
212
|
+
if (!(!K || P.length === 0))
|
|
213
|
+
return K.subscribeCollections(P, (r) => {
|
|
214
|
+
ct(r, se.current) && de.current();
|
|
209
215
|
});
|
|
210
|
-
}, [
|
|
211
|
-
const
|
|
216
|
+
}, [K, P]);
|
|
217
|
+
const oe = J(() => {
|
|
218
|
+
const r = (a == null ? void 0 : a.owned) ?? [], s = _ === "all" ? r : r.filter((h) => {
|
|
219
|
+
const c = Y(h.sla, L);
|
|
220
|
+
return _ === "soon" ? Z(c) : (c == null ? void 0 : c.status) === "breached";
|
|
221
|
+
});
|
|
222
|
+
return f ? s.filter((h) => f.keys.has(`${h.collection}:${h.item}`)) : s;
|
|
223
|
+
}, [a, _, L, f]), Q = Fe(oe, (r) => `${r.collection}:${r.item}`, {
|
|
224
|
+
resetKey: `${_}|${M ?? ""}`
|
|
225
|
+
}), ie = H({
|
|
212
226
|
// A ticket closes through /support so its requester hears about it.
|
|
213
|
-
mutationFn: (r) => fetch(`${
|
|
227
|
+
mutationFn: (r) => fetch(`${l}/${r.kind === "support" ? "support/tickets" : "tasks"}/${r.id}`, {
|
|
214
228
|
method: "PATCH",
|
|
215
|
-
headers: { ...
|
|
216
|
-
credentials:
|
|
229
|
+
headers: { ...g, "content-type": "application/json" },
|
|
230
|
+
credentials: k,
|
|
217
231
|
body: JSON.stringify({ status: "done" })
|
|
218
232
|
}),
|
|
219
233
|
onSuccess: () => v.invalidateQueries({ queryKey: ["my-work"] })
|
|
220
|
-
}),
|
|
234
|
+
}), q = H({
|
|
221
235
|
mutationFn: async ({ id: r, action: s }) => {
|
|
222
|
-
const h = await fetch(`${
|
|
236
|
+
const h = await fetch(`${l}/tasks/${r}/${s}`, {
|
|
223
237
|
method: "POST",
|
|
224
|
-
headers: { ...
|
|
225
|
-
credentials:
|
|
238
|
+
headers: { ...g, "content-type": "application/json" },
|
|
239
|
+
credentials: k,
|
|
226
240
|
body: "{}"
|
|
227
|
-
}),
|
|
228
|
-
if (!h.ok) throw new Error(
|
|
241
|
+
}), c = await h.json().catch(() => ({}));
|
|
242
|
+
if (!h.ok) throw new Error(c.error ?? "Failed");
|
|
229
243
|
return s;
|
|
230
244
|
},
|
|
231
245
|
onSuccess: (r) => {
|
|
232
|
-
|
|
246
|
+
B(r === "claim" ? "It’s yours — it moved to My tasks." : "Reminder sent."), v.invalidateQueries({ queryKey: ["my-work"] });
|
|
233
247
|
},
|
|
234
|
-
onError: (r) =>
|
|
235
|
-
}), [
|
|
236
|
-
|
|
237
|
-
if (!
|
|
238
|
-
const r = setTimeout(() =>
|
|
248
|
+
onError: (r) => B(Qe(r, "Failed"))
|
|
249
|
+
}), [F, B] = O(null);
|
|
250
|
+
V(() => {
|
|
251
|
+
if (!F) return;
|
|
252
|
+
const r = setTimeout(() => B(null), 4e3);
|
|
239
253
|
return () => clearTimeout(r);
|
|
240
|
-
}, [
|
|
241
|
-
const
|
|
242
|
-
mutationFn: (r) => fetch(`${
|
|
254
|
+
}, [F]);
|
|
255
|
+
const le = H({
|
|
256
|
+
mutationFn: (r) => fetch(`${l}/notifications/mark-read`, {
|
|
243
257
|
method: "POST",
|
|
244
|
-
headers: { ...
|
|
245
|
-
credentials:
|
|
258
|
+
headers: { ...g, "content-type": "application/json" },
|
|
259
|
+
credentials: k,
|
|
246
260
|
body: JSON.stringify({ ids: r })
|
|
247
261
|
}),
|
|
248
262
|
onSuccess: () => {
|
|
249
263
|
v.invalidateQueries({ queryKey: ["my-work"] }), v.invalidateQueries({ queryKey: ["notifications"] });
|
|
250
264
|
}
|
|
251
|
-
}), C = (r, s, h,
|
|
252
|
-
if (r && s &&
|
|
253
|
-
const
|
|
254
|
-
if (w({ collection: r, itemId: String(s) }, h, { list:
|
|
265
|
+
}), C = (r, s, h, c) => {
|
|
266
|
+
if (r && s && pe(r)) {
|
|
267
|
+
const m = (c ?? []).filter((o) => o.collection && o.item && pe(o.collection)).map((o) => ({ collection: o.collection, itemId: String(o.item) }));
|
|
268
|
+
if (w({ collection: r, itemId: String(s) }, h, { list: m }) !== "navigate")
|
|
255
269
|
return;
|
|
256
270
|
}
|
|
257
271
|
const b = {
|
|
258
|
-
record: (
|
|
259
|
-
...
|
|
260
|
-
}, t =
|
|
272
|
+
record: (m, o) => (p({ collection: m, itemId: o }), null),
|
|
273
|
+
...d
|
|
274
|
+
}, t = ue(r, s, {
|
|
261
275
|
...b,
|
|
262
|
-
record: (
|
|
276
|
+
record: (m, o) => {
|
|
263
277
|
var N;
|
|
264
|
-
return ((N =
|
|
278
|
+
return ((N = d == null ? void 0 : d.record) == null ? void 0 : N.call(d, m, o)) ?? null;
|
|
265
279
|
}
|
|
266
280
|
});
|
|
267
281
|
if (t) {
|
|
268
|
-
|
|
282
|
+
We(t, (m) => u == null ? void 0 : u(m));
|
|
269
283
|
return;
|
|
270
284
|
}
|
|
271
285
|
r && s && !/^nivaro_/i.test(r) && r !== "__chat__" && p({ collection: r, itemId: s });
|
|
272
|
-
},
|
|
286
|
+
}, ve = (r, s) => r && s && !/^nivaro_/i.test(r) && r !== "__chat__" ? !0 : !!ue(r, s, {
|
|
273
287
|
record: () => null,
|
|
274
|
-
...
|
|
288
|
+
...d
|
|
275
289
|
});
|
|
276
|
-
return
|
|
277
|
-
/* @__PURE__ */ e(
|
|
290
|
+
return we || !a ? /* @__PURE__ */ e(pt, { order: x.order, hidden: x.hidden }) : /* @__PURE__ */ n("div", { className: "space-y-5 p-4 sm:p-6", "data-my-work": !0, children: [
|
|
291
|
+
/* @__PURE__ */ e(Je, { onOpenPath: u }),
|
|
278
292
|
/* @__PURE__ */ n("div", { className: "flex flex-col-reverse gap-3 sm:flex-row sm:items-start sm:justify-between", children: [
|
|
279
293
|
/* @__PURE__ */ n("div", { className: "grid min-w-0 flex-1 grid-cols-2 gap-3 lg:grid-cols-4", children: [
|
|
280
294
|
/* @__PURE__ */ e(U, { label: "Waiting on you", value: a.counts.owned }),
|
|
@@ -290,30 +304,14 @@ function Ft({
|
|
|
290
304
|
/* @__PURE__ */ e(U, { label: "Unread notifications", value: a.counts.notifications })
|
|
291
305
|
] }),
|
|
292
306
|
/* @__PURE__ */ n("div", { className: "flex shrink-0 flex-wrap items-center justify-end gap-2", children: [
|
|
293
|
-
he && /* @__PURE__ */ n(
|
|
294
|
-
"button",
|
|
295
|
-
{
|
|
296
|
-
type: "button",
|
|
297
|
-
onClick: () => {
|
|
298
|
-
O(!1), X();
|
|
299
|
-
},
|
|
300
|
-
className: "inline-flex items-center gap-1.5 rounded-full border border-nvr-cyan/40 bg-nvr-cyan/10 px-3 py-1.5 text-[12px] font-medium text-[#0e7490] hover:bg-nvr-cyan/20 dark:text-[#67e8f9]",
|
|
301
|
-
children: [
|
|
302
|
-
/* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
|
|
303
|
-
"Updates available — refresh"
|
|
304
|
-
]
|
|
305
|
-
}
|
|
306
|
-
),
|
|
307
307
|
/* @__PURE__ */ e(
|
|
308
308
|
"button",
|
|
309
309
|
{
|
|
310
310
|
type: "button",
|
|
311
|
-
onClick: () =>
|
|
312
|
-
|
|
313
|
-
},
|
|
314
|
-
disabled: ee,
|
|
311
|
+
onClick: () => void Ne(),
|
|
312
|
+
disabled: re,
|
|
315
313
|
className: "rounded-md border border-slate-200 px-2.5 py-1.5 text-[12px] hover:bg-muted disabled:opacity-50 dark:border-border",
|
|
316
|
-
children:
|
|
314
|
+
children: re ? "Refreshing…" : "Refresh"
|
|
317
315
|
}
|
|
318
316
|
),
|
|
319
317
|
/* @__PURE__ */ n("div", { className: "relative", children: [
|
|
@@ -321,17 +319,17 @@ function Ft({
|
|
|
321
319
|
"button",
|
|
322
320
|
{
|
|
323
321
|
type: "button",
|
|
324
|
-
onClick: () =>
|
|
322
|
+
onClick: () => ke((r) => !r),
|
|
325
323
|
className: "rounded-md border border-slate-200 px-2.5 py-1.5 text-[12px] hover:bg-muted dark:border-border",
|
|
326
324
|
children: "Customize"
|
|
327
325
|
}
|
|
328
326
|
),
|
|
329
|
-
|
|
327
|
+
fe && /* @__PURE__ */ n("div", { className: "absolute right-0 top-full z-20 mt-1 w-56 rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
|
|
330
328
|
/* @__PURE__ */ e("p", { className: "px-1 pb-1.5 text-[11px] font-semibold text-slate-500", children: "Sections" }),
|
|
331
329
|
x.order.map((r, s) => {
|
|
332
|
-
const h =
|
|
333
|
-
const
|
|
334
|
-
|
|
330
|
+
const h = xe[r] ?? r, c = x.hidden.includes(r), b = (t) => {
|
|
331
|
+
const m = [...x.order], o = s + t;
|
|
332
|
+
o < 0 || o >= m.length || ([m[s], m[o]] = [m[o], m[s]], ee({ ...x, order: m }));
|
|
335
333
|
};
|
|
336
334
|
return /* @__PURE__ */ n(
|
|
337
335
|
"div",
|
|
@@ -342,19 +340,19 @@ function Ft({
|
|
|
342
340
|
"button",
|
|
343
341
|
{
|
|
344
342
|
type: "button",
|
|
345
|
-
onClick: () =>
|
|
343
|
+
onClick: () => ee({
|
|
346
344
|
...x,
|
|
347
|
-
hidden:
|
|
345
|
+
hidden: c ? x.hidden.filter((t) => t !== r) : [...x.hidden, r]
|
|
348
346
|
}),
|
|
349
347
|
className: "flex h-4 w-4 items-center justify-center rounded border border-slate-300 text-[10px] dark:border-border",
|
|
350
|
-
title:
|
|
351
|
-
children:
|
|
348
|
+
title: c ? "Show section" : "Hide section",
|
|
349
|
+
children: c ? "" : "✓"
|
|
352
350
|
}
|
|
353
351
|
),
|
|
354
352
|
/* @__PURE__ */ e(
|
|
355
353
|
"span",
|
|
356
354
|
{
|
|
357
|
-
className: `min-w-0 flex-1 truncate text-[12px] ${
|
|
355
|
+
className: `min-w-0 flex-1 truncate text-[12px] ${c ? "text-slate-400 line-through" : ""}`,
|
|
358
356
|
children: h
|
|
359
357
|
}
|
|
360
358
|
),
|
|
@@ -387,32 +385,32 @@ function Ft({
|
|
|
387
385
|
] })
|
|
388
386
|
] })
|
|
389
387
|
] }),
|
|
390
|
-
|
|
388
|
+
F && /* @__PURE__ */ e(
|
|
391
389
|
"p",
|
|
392
390
|
{
|
|
393
391
|
className: "rounded-md border border-slate-200 bg-white px-3 py-2 text-[12px] dark:border-border dark:bg-card",
|
|
394
392
|
role: "status",
|
|
395
393
|
"data-my-work-task-note": !0,
|
|
396
|
-
children:
|
|
394
|
+
children: F
|
|
397
395
|
}
|
|
398
396
|
),
|
|
399
|
-
/* @__PURE__ */ e(
|
|
397
|
+
/* @__PURE__ */ e(He, { questions: a.questions ?? [] }),
|
|
400
398
|
/* @__PURE__ */ e(
|
|
401
|
-
|
|
399
|
+
et,
|
|
402
400
|
{
|
|
403
|
-
showing: (
|
|
404
|
-
onShow: (r) =>
|
|
401
|
+
showing: (f == null ? void 0 : f.userId) ?? null,
|
|
402
|
+
onShow: (r) => te((s) => s === r.user_id ? null : r.user_id)
|
|
405
403
|
}
|
|
406
404
|
),
|
|
407
|
-
/* @__PURE__ */ e(
|
|
408
|
-
/* @__PURE__ */ e(
|
|
405
|
+
/* @__PURE__ */ e(rt, { className: "mb-4" }),
|
|
406
|
+
/* @__PURE__ */ e(tt, { className: "mb-4" }),
|
|
409
407
|
(() => {
|
|
410
408
|
const r = {
|
|
411
409
|
records: () => {
|
|
412
|
-
const t = new Map(a.owned.map((i) => [i,
|
|
410
|
+
const t = new Map(a.owned.map((i) => [i, Y(i.sla, L)])), m = (i) => Z(t.get(i) ?? null), o = (i) => {
|
|
413
411
|
var j;
|
|
414
412
|
return ((j = t.get(i)) == null ? void 0 : j.status) === "breached";
|
|
415
|
-
}, N = a.owned.filter(
|
|
413
|
+
}, N = a.owned.filter(m).length, T = a.owned.filter(o).length, R = oe, _e = [
|
|
416
414
|
{ key: "all", label: `All (${a.owned.length})` },
|
|
417
415
|
{ key: "soon", label: `Due soon (${N})` },
|
|
418
416
|
{ key: "breached", label: `Breached (${T})` }
|
|
@@ -423,77 +421,88 @@ function Ft({
|
|
|
423
421
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Records whose current step resolves you as an owner — most urgent first." })
|
|
424
422
|
] }),
|
|
425
423
|
a.owned.length > 0 && /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-1 border-b border-slate-100 px-4 py-2 dark:border-border/60", children: [
|
|
426
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-1 rounded-lg bg-slate-100 p-1 dark:bg-muted", children:
|
|
424
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-1 rounded-lg bg-slate-100 p-1 dark:bg-muted", children: _e.map((i) => /* @__PURE__ */ e(
|
|
427
425
|
"button",
|
|
428
426
|
{
|
|
429
427
|
type: "button",
|
|
430
428
|
"data-my-work-sla-filter": i.key,
|
|
431
|
-
"aria-pressed":
|
|
432
|
-
onClick: () =>
|
|
429
|
+
"aria-pressed": _ === i.key,
|
|
430
|
+
onClick: () => ye(i.key),
|
|
433
431
|
className: [
|
|
434
432
|
"rounded-md px-2.5 py-1 text-[11px] font-medium transition-colors duration-150",
|
|
435
|
-
|
|
433
|
+
_ === i.key ? "bg-white text-slate-900 shadow-sm dark:bg-card dark:text-foreground" : "text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200"
|
|
436
434
|
].join(" "),
|
|
437
435
|
children: i.label
|
|
438
436
|
},
|
|
439
437
|
i.key
|
|
440
438
|
)) }),
|
|
441
|
-
|
|
439
|
+
f && /* @__PURE__ */ n(
|
|
442
440
|
"button",
|
|
443
441
|
{
|
|
444
442
|
type: "button",
|
|
445
443
|
"data-my-work-cover-filter": !0,
|
|
446
|
-
onClick: () =>
|
|
447
|
-
"aria-label": `Show all records, not only ${
|
|
444
|
+
onClick: () => te(null),
|
|
445
|
+
"aria-label": `Show all records, not only ${f.name}'s`,
|
|
448
446
|
className: "ml-1 inline-flex items-center gap-1 rounded-full border border-nvr-cyan/40 bg-nvr-cyan/10 px-2.5 py-1 text-[11px] font-medium text-[#0e7490] hover:bg-nvr-cyan/20 dark:text-[#67e8f9]",
|
|
449
447
|
children: [
|
|
450
|
-
|
|
448
|
+
f.name,
|
|
451
449
|
"'s records",
|
|
452
450
|
/* @__PURE__ */ e("span", { "aria-hidden": !0, className: "text-[12px] leading-none", children: "×" })
|
|
453
451
|
]
|
|
454
452
|
}
|
|
455
453
|
)
|
|
456
454
|
] }),
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
"
|
|
455
|
+
Q.rows.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-6 text-center text-[12.5px] text-muted-foreground", children: a.owned.length === 0 ? "Nothing is waiting on you. Enjoy it." : "Nothing matches this filter." }) : /* @__PURE__ */ e(
|
|
456
|
+
"ul",
|
|
457
|
+
{
|
|
458
|
+
ref: Q.containerRef,
|
|
459
|
+
className: "divide-y divide-slate-100 dark:divide-border/60",
|
|
460
|
+
children: Q.rows.map(({ row: i, state: j }) => {
|
|
461
|
+
var ce, me;
|
|
462
|
+
return /* @__PURE__ */ e(
|
|
463
|
+
"li",
|
|
466
464
|
{
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
465
|
+
className: I(
|
|
466
|
+
S(`o:${i.collection}:${i.item}`),
|
|
467
|
+
j === "departed" && "opacity-50"
|
|
468
|
+
),
|
|
469
|
+
"data-my-work-fresh": ne.has(`o:${i.collection}:${i.item}`) || void 0,
|
|
470
|
+
"data-my-work-departed": j === "departed" || void 0,
|
|
471
|
+
children: /* @__PURE__ */ n(
|
|
472
|
+
"button",
|
|
473
|
+
{
|
|
474
|
+
type: "button",
|
|
475
|
+
onClick: (z) => C(i.collection, i.item, z, R),
|
|
476
|
+
...G.record(i.collection, i.item),
|
|
477
|
+
className: "flex w-full items-center gap-2.5 px-4 py-2 text-left hover:bg-muted",
|
|
478
|
+
children: [
|
|
479
|
+
/* @__PURE__ */ e("span", { className: "min-w-[6.5rem] flex-1 truncate text-[12.5px] font-medium", children: i.label }),
|
|
480
|
+
/* @__PURE__ */ e("span", { className: "hidden text-[11px] text-muted-foreground sm:inline", children: i.collection.replace(/_/g, " ") }),
|
|
481
|
+
((ce = i.flags) == null ? void 0 : ce.some((z) => /^on hold$/i.test(z.name.trim()))) && /* @__PURE__ */ e(
|
|
482
|
+
"span",
|
|
483
|
+
{
|
|
484
|
+
"data-my-work-hold": !0,
|
|
485
|
+
className: "shrink-0 rounded-full bg-amber-500/15 px-1.5 py-px text-[10.5px] font-semibold text-amber-800 dark:text-amber-300",
|
|
486
|
+
children: "On hold"
|
|
487
|
+
}
|
|
488
|
+
),
|
|
489
|
+
/* @__PURE__ */ e(
|
|
490
|
+
ut,
|
|
491
|
+
{
|
|
492
|
+
state: i.state_label || ((me = i.state) == null ? void 0 : me.replace(/_/g, " ")) || null,
|
|
493
|
+
color: i.state_color
|
|
494
|
+
}
|
|
495
|
+
),
|
|
496
|
+
/* @__PURE__ */ e("span", { className: "shrink-0", children: /* @__PURE__ */ e(mt, { sla: t.get(i) ?? Y(i.sla, L) }) })
|
|
497
|
+
]
|
|
498
|
+
}
|
|
499
|
+
)
|
|
500
|
+
},
|
|
501
|
+
`${i.collection}:${i.item}`
|
|
502
|
+
);
|
|
503
|
+
})
|
|
504
|
+
}
|
|
505
|
+
)
|
|
497
506
|
] });
|
|
498
507
|
},
|
|
499
508
|
// Idea 6 — only when something waits on this person's decision.
|
|
@@ -507,12 +516,12 @@ function Ft({
|
|
|
507
516
|
/* @__PURE__ */ e("h2", { className: "text-[13px] font-medium", children: "Changes to review" }),
|
|
508
517
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Proposed changes on locked records — open one to compare old and new and accept or decline it." })
|
|
509
518
|
] }),
|
|
510
|
-
/* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: (a.proposals ?? []).map((t) => /* @__PURE__ */ e("li", { className:
|
|
519
|
+
/* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: (a.proposals ?? []).map((t) => /* @__PURE__ */ e("li", { className: S(`p:${t.id}`), "data-my-work-proposal": t.id, children: /* @__PURE__ */ n(
|
|
511
520
|
"button",
|
|
512
521
|
{
|
|
513
522
|
type: "button",
|
|
514
523
|
onClick: () => C(t.collection, t.item),
|
|
515
|
-
...
|
|
524
|
+
...G.record(t.collection, t.item),
|
|
516
525
|
className: "flex w-full items-start gap-2.5 px-4 py-2 text-left hover:bg-muted",
|
|
517
526
|
children: [
|
|
518
527
|
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1", children: [
|
|
@@ -526,7 +535,7 @@ function Ft({
|
|
|
526
535
|
t.reason
|
|
527
536
|
] })
|
|
528
537
|
] }),
|
|
529
|
-
/* @__PURE__ */ e("span", { className: "shrink-0 pt-0.5 text-[11px] text-muted-foreground", children:
|
|
538
|
+
/* @__PURE__ */ e("span", { className: "shrink-0 pt-0.5 text-[11px] text-muted-foreground", children: ze(t.created_at) })
|
|
530
539
|
]
|
|
531
540
|
}
|
|
532
541
|
) }, t.id)) })
|
|
@@ -538,15 +547,15 @@ function Ft({
|
|
|
538
547
|
a.tasks.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-5 text-center text-[12.5px] text-muted-foreground", children: "No open tasks." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: a.tasks.map((t) => /* @__PURE__ */ n(
|
|
539
548
|
"li",
|
|
540
549
|
{
|
|
541
|
-
className:
|
|
550
|
+
className: I("flex items-center gap-2.5 px-4 py-2", S(`t:${t.id}`)),
|
|
542
551
|
children: [
|
|
543
552
|
/* @__PURE__ */ e(
|
|
544
553
|
"button",
|
|
545
554
|
{
|
|
546
555
|
type: "button",
|
|
547
556
|
title: "Mark done",
|
|
548
|
-
onClick: () =>
|
|
549
|
-
disabled:
|
|
557
|
+
onClick: () => ie.mutate(t),
|
|
558
|
+
disabled: ie.isPending,
|
|
550
559
|
className: "flex h-4 w-4 shrink-0 items-center justify-center rounded border border-slate-300 text-transparent hover:border-emerald-500 hover:text-emerald-500 dark:border-border",
|
|
551
560
|
children: "✓"
|
|
552
561
|
}
|
|
@@ -560,7 +569,7 @@ function Ft({
|
|
|
560
569
|
"data-tip": `Handed to ${t.agent_name ?? "your agent"} — it picks this up through My Work`,
|
|
561
570
|
"data-my-work-agent-task": t.id,
|
|
562
571
|
children: [
|
|
563
|
-
/* @__PURE__ */ e(
|
|
572
|
+
/* @__PURE__ */ e(Te, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
564
573
|
t.agent_name ?? "Agent"
|
|
565
574
|
]
|
|
566
575
|
}
|
|
@@ -569,7 +578,7 @@ function Ft({
|
|
|
569
578
|
"button",
|
|
570
579
|
{
|
|
571
580
|
type: "button",
|
|
572
|
-
onClick: (
|
|
581
|
+
onClick: (m) => t.kind === "support" ? X(t.id) : C(t.collection, t.item, m),
|
|
573
582
|
className: "min-w-0 flex-1 truncate text-left text-[12.5px] hover:underline",
|
|
574
583
|
children: [
|
|
575
584
|
t.title,
|
|
@@ -578,7 +587,7 @@ function Ft({
|
|
|
578
587
|
}
|
|
579
588
|
),
|
|
580
589
|
/* @__PURE__ */ e(
|
|
581
|
-
|
|
590
|
+
Ve,
|
|
582
591
|
{
|
|
583
592
|
task: t,
|
|
584
593
|
isAssignee: !0,
|
|
@@ -589,7 +598,7 @@ function Ft({
|
|
|
589
598
|
t.due_date && /* @__PURE__ */ e(
|
|
590
599
|
"span",
|
|
591
600
|
{
|
|
592
|
-
className: `text-[11px] tabular-nums ${
|
|
601
|
+
className: `text-[11px] tabular-nums ${E(t.due_date) ? "font-medium text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
|
|
593
602
|
children: new Date(t.due_date).toLocaleDateString(void 0, { timeZone: "UTC" })
|
|
594
603
|
}
|
|
595
604
|
)
|
|
@@ -611,7 +620,7 @@ function Ft({
|
|
|
611
620
|
(a.team_tasks ?? []).length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-5 text-center text-[12.5px] text-muted-foreground", children: "Nothing waiting with your teams." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: (a.team_tasks ?? []).map((t) => /* @__PURE__ */ n(
|
|
612
621
|
"li",
|
|
613
622
|
{
|
|
614
|
-
className:
|
|
623
|
+
className: I("flex items-center gap-2.5 px-4 py-2", S(`tt:${t.id}`)),
|
|
615
624
|
"data-my-work-team-task": t.id,
|
|
616
625
|
children: [
|
|
617
626
|
t.priority === "urgent" && /* @__PURE__ */ e("span", { className: "shrink-0 rounded bg-red-500/10 px-1 py-px text-[9.5px] font-semibold uppercase tracking-wide text-red-600 dark:text-red-400", children: "urgent" }),
|
|
@@ -619,7 +628,7 @@ function Ft({
|
|
|
619
628
|
"button",
|
|
620
629
|
{
|
|
621
630
|
type: "button",
|
|
622
|
-
onClick: (
|
|
631
|
+
onClick: (m) => C(t.collection, t.item, m),
|
|
623
632
|
className: "min-w-0 flex-1 truncate text-left text-[12.5px] hover:underline",
|
|
624
633
|
children: [
|
|
625
634
|
t.title,
|
|
@@ -630,7 +639,7 @@ function Ft({
|
|
|
630
639
|
t.due_date && /* @__PURE__ */ e(
|
|
631
640
|
"span",
|
|
632
641
|
{
|
|
633
|
-
className: `text-[11px] tabular-nums ${
|
|
642
|
+
className: `text-[11px] tabular-nums ${E(t.due_date) ? "font-medium text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
|
|
634
643
|
children: new Date(t.due_date).toLocaleDateString(void 0, {
|
|
635
644
|
timeZone: "UTC"
|
|
636
645
|
})
|
|
@@ -640,8 +649,8 @@ function Ft({
|
|
|
640
649
|
"button",
|
|
641
650
|
{
|
|
642
651
|
type: "button",
|
|
643
|
-
onClick: () =>
|
|
644
|
-
disabled:
|
|
652
|
+
onClick: () => q.mutate({ id: t.id, action: "claim" }),
|
|
653
|
+
disabled: q.isPending,
|
|
645
654
|
className: "shrink-0 rounded-md border border-slate-200 px-2 py-0.5 text-[11px] font-medium hover:bg-muted dark:border-border",
|
|
646
655
|
"data-my-work-claim": t.id,
|
|
647
656
|
children: "Pick it up"
|
|
@@ -655,7 +664,7 @@ function Ft({
|
|
|
655
664
|
}
|
|
656
665
|
),
|
|
657
666
|
waiting: () => {
|
|
658
|
-
const t = a.requested ?? [],
|
|
667
|
+
const t = a.requested ?? [], m = t.filter((o) => E(o.due_date)).length;
|
|
659
668
|
return /* @__PURE__ */ n(
|
|
660
669
|
"section",
|
|
661
670
|
{
|
|
@@ -665,63 +674,63 @@ function Ft({
|
|
|
665
674
|
/* @__PURE__ */ n("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
|
|
666
675
|
/* @__PURE__ */ n("h2", { className: "text-[13px] font-medium", children: [
|
|
667
676
|
"Waiting on others",
|
|
668
|
-
|
|
669
|
-
|
|
677
|
+
m > 0 && /* @__PURE__ */ n("span", { className: "ml-2 rounded bg-red-500/10 px-1.5 py-0.5 text-[10.5px] font-semibold text-red-600 dark:text-red-400", children: [
|
|
678
|
+
m,
|
|
670
679
|
" overdue"
|
|
671
680
|
] })
|
|
672
681
|
] }),
|
|
673
682
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Tasks you asked someone else to do." })
|
|
674
683
|
] }),
|
|
675
|
-
t.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-5 text-center text-[12.5px] text-muted-foreground", children: "You are not waiting on anyone." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: t.map((
|
|
676
|
-
const N =
|
|
684
|
+
t.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-5 text-center text-[12.5px] text-muted-foreground", children: "You are not waiting on anyone." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: t.map((o) => {
|
|
685
|
+
const N = E(o.due_date), T = !!o.nudged_at && Date.now() - new Date(o.nudged_at).getTime() < 20 * 36e5;
|
|
677
686
|
return /* @__PURE__ */ n(
|
|
678
687
|
"li",
|
|
679
688
|
{
|
|
680
|
-
className:
|
|
681
|
-
"data-my-work-requested":
|
|
689
|
+
className: I("flex items-center gap-2.5 px-4 py-2", S(`r:${o.id}`)),
|
|
690
|
+
"data-my-work-requested": o.id,
|
|
682
691
|
children: [
|
|
683
692
|
/* @__PURE__ */ n(
|
|
684
693
|
"button",
|
|
685
694
|
{
|
|
686
695
|
type: "button",
|
|
687
|
-
onClick: (
|
|
696
|
+
onClick: (R) => o.kind === "support" ? X(o.id) : C(o.collection, o.item, R),
|
|
688
697
|
className: "min-w-0 flex-1 truncate text-left text-[12.5px] hover:underline",
|
|
689
698
|
children: [
|
|
690
|
-
|
|
699
|
+
o.title,
|
|
691
700
|
/* @__PURE__ */ e("span", { className: "ml-1.5 text-[11px] text-muted-foreground", children: [
|
|
692
|
-
|
|
693
|
-
|
|
701
|
+
o.assignee_name ?? (o.team_name ? `${o.team_name} team` : "Unassigned"),
|
|
702
|
+
o.item_label
|
|
694
703
|
].filter(Boolean).join(" · ") })
|
|
695
704
|
]
|
|
696
705
|
}
|
|
697
706
|
),
|
|
698
|
-
|
|
707
|
+
o.due_date && /* @__PURE__ */ n(
|
|
699
708
|
"span",
|
|
700
709
|
{
|
|
701
710
|
className: `text-[11px] tabular-nums ${N ? "font-medium text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
|
|
702
711
|
children: [
|
|
703
712
|
N ? "Overdue · " : "",
|
|
704
|
-
new Date(
|
|
713
|
+
new Date(o.due_date).toLocaleDateString(void 0, {
|
|
705
714
|
timeZone: "UTC"
|
|
706
715
|
})
|
|
707
716
|
]
|
|
708
717
|
}
|
|
709
718
|
),
|
|
710
|
-
|
|
719
|
+
o.kind !== "support" && /* @__PURE__ */ e(
|
|
711
720
|
"button",
|
|
712
721
|
{
|
|
713
722
|
type: "button",
|
|
714
|
-
onClick: () =>
|
|
715
|
-
disabled:
|
|
723
|
+
onClick: () => q.mutate({ id: o.id, action: "nudge" }),
|
|
724
|
+
disabled: q.isPending || T,
|
|
716
725
|
title: T ? "Already nudged today" : "Send a reminder",
|
|
717
726
|
className: "shrink-0 rounded-md border border-slate-200 px-2 py-0.5 text-[11px] font-medium hover:bg-muted disabled:opacity-50 dark:border-border",
|
|
718
|
-
"data-my-work-nudge":
|
|
727
|
+
"data-my-work-nudge": o.id,
|
|
719
728
|
children: T ? "Nudged" : "Nudge"
|
|
720
729
|
}
|
|
721
730
|
)
|
|
722
731
|
]
|
|
723
732
|
},
|
|
724
|
-
|
|
733
|
+
o.id
|
|
725
734
|
);
|
|
726
735
|
}) })
|
|
727
736
|
]
|
|
@@ -735,7 +744,7 @@ function Ft({
|
|
|
735
744
|
"button",
|
|
736
745
|
{
|
|
737
746
|
type: "button",
|
|
738
|
-
onClick: () =>
|
|
747
|
+
onClick: () => le.mutate(a.notifications.map((t) => t.id)),
|
|
739
748
|
className: "text-[11px] text-[#00a5cc] hover:underline",
|
|
740
749
|
children: "Mark all read"
|
|
741
750
|
}
|
|
@@ -744,21 +753,21 @@ function Ft({
|
|
|
744
753
|
a.notifications.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-5 text-center text-[12.5px] text-muted-foreground", children: "You're all caught up." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: a.notifications.map((t) => /* @__PURE__ */ n(
|
|
745
754
|
"li",
|
|
746
755
|
{
|
|
747
|
-
className:
|
|
756
|
+
className: I("flex items-start gap-2.5 px-4 py-2", S(`n:${t.id}`)),
|
|
748
757
|
children: [
|
|
749
758
|
/* @__PURE__ */ e(
|
|
750
|
-
|
|
759
|
+
dt,
|
|
751
760
|
{
|
|
752
761
|
userId: t.sender,
|
|
753
762
|
className: "mt-0.5 h-5 w-5",
|
|
754
763
|
fallback: /* @__PURE__ */ e("span", { className: "mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-slate-100 text-[9px] font-semibold text-slate-500 dark:bg-muted" })
|
|
755
764
|
}
|
|
756
765
|
),
|
|
757
|
-
|
|
766
|
+
ve(t.collection, t.item) ? /* @__PURE__ */ n(
|
|
758
767
|
"button",
|
|
759
768
|
{
|
|
760
769
|
type: "button",
|
|
761
|
-
onClick: (
|
|
770
|
+
onClick: (m) => C(t.collection, t.item, m, a.notifications),
|
|
762
771
|
className: "min-w-0 flex-1 cursor-pointer text-left hover:opacity-80",
|
|
763
772
|
children: [
|
|
764
773
|
/* @__PURE__ */ e("p", { className: "truncate text-[12.5px] font-medium", children: t.subject }),
|
|
@@ -778,9 +787,9 @@ function Ft({
|
|
|
778
787
|
type: "button",
|
|
779
788
|
"aria-label": "Mark read",
|
|
780
789
|
"data-tip": "Mark read",
|
|
781
|
-
onClick: () =>
|
|
790
|
+
onClick: () => le.mutate([t.id]),
|
|
782
791
|
className: "mt-0.5 shrink-0 rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
|
|
783
|
-
children: /* @__PURE__ */ e(
|
|
792
|
+
children: /* @__PURE__ */ e($e, { className: "h-3 w-3" })
|
|
784
793
|
}
|
|
785
794
|
)
|
|
786
795
|
]
|
|
@@ -790,59 +799,60 @@ function Ft({
|
|
|
790
799
|
] })
|
|
791
800
|
}, s = new Map(
|
|
792
801
|
x.order.filter((t) => !x.hidden.includes(t) && r[t]).map((t) => [t, r[t]()]).filter(([, t]) => t != null)
|
|
793
|
-
), h = [...s.keys()],
|
|
802
|
+
), h = [...s.keys()], c = [];
|
|
794
803
|
let b = 0;
|
|
795
804
|
for (; b < h.length; ) {
|
|
796
805
|
const t = h[b];
|
|
797
|
-
if (
|
|
798
|
-
|
|
806
|
+
if (be.has(t))
|
|
807
|
+
c.push(
|
|
799
808
|
/* @__PURE__ */ e("div", { className: "min-w-0", children: s.get(t) }, t)
|
|
800
809
|
), b++;
|
|
801
810
|
else {
|
|
802
|
-
const
|
|
803
|
-
b + 1 < h.length && !
|
|
804
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children:
|
|
805
|
-
), b +=
|
|
811
|
+
const m = [t];
|
|
812
|
+
b + 1 < h.length && !be.has(h[b + 1]) && m.push(h[b + 1]), c.push(
|
|
813
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children: m.map((o) => /* @__PURE__ */ e("div", { className: "min-w-0", children: s.get(o) }, o)) }, m.join("+"))
|
|
814
|
+
), b += m.length;
|
|
806
815
|
}
|
|
807
816
|
}
|
|
808
|
-
return
|
|
817
|
+
return c;
|
|
809
818
|
})(),
|
|
810
|
-
/* @__PURE__ */ e(
|
|
819
|
+
/* @__PURE__ */ e(ht, {})
|
|
811
820
|
] });
|
|
812
821
|
}
|
|
813
|
-
function
|
|
814
|
-
const
|
|
815
|
-
return !
|
|
822
|
+
function ht() {
|
|
823
|
+
const d = Ze(), { rooms: u } = Ge(d);
|
|
824
|
+
return !d || u.length === 0 ? null : /* @__PURE__ */ n(
|
|
816
825
|
"section",
|
|
817
826
|
{
|
|
818
827
|
className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card",
|
|
819
828
|
"data-my-work-chat": !0,
|
|
820
829
|
children: [
|
|
821
830
|
/* @__PURE__ */ e("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: /* @__PURE__ */ e("h2", { className: "text-[13px] font-medium", children: "Record conversations" }) }),
|
|
822
|
-
/* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: u.map((
|
|
831
|
+
/* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: u.map((l) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ n(
|
|
823
832
|
"button",
|
|
824
833
|
{
|
|
825
834
|
type: "button",
|
|
826
|
-
onClick: () =>
|
|
835
|
+
onClick: () => Ye(l.room, l.label),
|
|
827
836
|
className: "flex w-full items-center gap-2.5 px-4 py-2 text-left hover:bg-slate-50 dark:hover:bg-muted/40",
|
|
828
|
-
"data-my-work-chat-room":
|
|
837
|
+
"data-my-work-chat-room": l.room,
|
|
829
838
|
children: [
|
|
830
839
|
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1", children: [
|
|
831
|
-
/* @__PURE__ */ e("span", { className: "block truncate text-[12.5px] font-medium", children:
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
840
|
+
/* @__PURE__ */ e("span", { className: "block truncate text-[12.5px] font-medium", children: l.label }),
|
|
841
|
+
l.last_message && /* @__PURE__ */ n("span", { className: "block truncate text-[11.5px] text-muted-foreground", children: [
|
|
842
|
+
l.last_message.sender_name ? `${l.last_message.sender_name}: ` : "",
|
|
843
|
+
l.last_message.message.replace(/@\[([^\]]+)\]/g, "@$1")
|
|
835
844
|
] })
|
|
836
845
|
] }),
|
|
837
|
-
|
|
838
|
-
/* @__PURE__ */ e("span", { className: "flex h-5 min-w-5 items-center justify-center rounded-full bg-slate-100 px-1.5 text-[10px] font-bold tabular-nums text-slate-600 dark:bg-muted dark:text-slate-300", children:
|
|
846
|
+
l.mentions > 0 && /* @__PURE__ */ e("span", { className: "flex h-5 min-w-5 items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-bold text-white", children: "@" }),
|
|
847
|
+
/* @__PURE__ */ e("span", { className: "flex h-5 min-w-5 items-center justify-center rounded-full bg-slate-100 px-1.5 text-[10px] font-bold tabular-nums text-slate-600 dark:bg-muted dark:text-slate-300", children: l.unread > 99 ? "99+" : l.unread })
|
|
839
848
|
]
|
|
840
849
|
}
|
|
841
|
-
) },
|
|
850
|
+
) }, l.room)) })
|
|
842
851
|
]
|
|
843
852
|
}
|
|
844
853
|
);
|
|
845
854
|
}
|
|
846
855
|
export {
|
|
847
|
-
|
|
856
|
+
Pt as MyWorkView,
|
|
857
|
+
ct as touchesOnScreen
|
|
848
858
|
};
|