@nivaro/react 0.3.51 → 0.3.53
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 +47 -3
- package/dist/shared/components/ItemEditForm.js +3885 -3847
- package/dist/shared/components/NotificationBell.js +163 -150
- package/dist/shared/components/PageRenderer.js +600 -549
- package/dist/shared/components/ProfileView.js +36 -34
- package/dist/shared/components/QueryStatStrip.js +96 -89
- package/dist/shared/components/QueryTable.js +214 -215
- package/dist/shared/components/ReportView.js +548 -529
- package/dist/shared/components/alerts/AlertManagerView.js +346 -320
- package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
- package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
- package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
- package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
- package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
- package/dist/shared/components/item-edit/PlanGrid.js +718 -705
- package/dist/shared/components/item-edit/SummaryPanel.js +351 -337
- package/dist/shared/components/item-edit/line-qty.js +115 -53
- package/dist/shared/components/item-edit/save-refusal.js +18 -18
- package/dist/shared/components/item-edit/usePersonalDefaults.js +210 -207
- package/dist/shared/components/panels/CommentPanel.js +204 -197
- package/dist/shared/components/panels/ItemLockBanner.js +318 -291
- package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
- package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
- package/dist/shared/components/panels/RevisionsPanel.js +101 -106
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
- package/dist/shared/components/panels/requirement-side-effects.js +46 -29
- package/dist/shared/components/queue/QueueItemSheet.js +219 -146
- package/dist/shared/components/queue/QueueWorklist.js +738 -730
- package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
- package/dist/shared/lib/activity-sentence.js +236 -227
- package/dist/shared/lib/record-ref.js +43 -34
- package/package.json +1 -1
|
@@ -1,291 +1,317 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { QueryClientContext as
|
|
3
|
-
import { Lock as
|
|
4
|
-
import { useState as
|
|
1
|
+
import { jsxs as x, jsx as v } from "react/jsx-runtime";
|
|
2
|
+
import { QueryClientContext as Pe } from "@tanstack/react-query";
|
|
3
|
+
import { Lock as ue, LockOpen as ve } from "lucide-react";
|
|
4
|
+
import { useState as S, useEffect as w, useRef as T, useCallback as E, useContext as je } from "react";
|
|
5
5
|
import { toast as d } from "sonner";
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { post as
|
|
8
|
-
import { idleState as
|
|
9
|
-
import { useOptionalRealtime as
|
|
10
|
-
import { announceRecordTabs as
|
|
6
|
+
import { useNivaroClient as Be, useItemEditAuth as Qe } from "../../context.js";
|
|
7
|
+
import { post as I, get as Ue, del as W } from "../../lib/commands.js";
|
|
8
|
+
import { idleState as Ve } from "../../lib/idle.js";
|
|
9
|
+
import { useOptionalRealtime as ye, updateTouches as We } from "../../lib/realtime.js";
|
|
10
|
+
import { announceRecordTabs as Z, useRecordTabsSignal as He } from "../../lib/record-tabs.js";
|
|
11
|
+
import { noteTakeOverHold as ie } from "../item-edit/FieldAffordances.js";
|
|
11
12
|
import { Button as O } from "../ui/button.js";
|
|
12
|
-
import { Popover as
|
|
13
|
-
const
|
|
14
|
-
function
|
|
13
|
+
import { Popover as ge, PopoverTrigger as we, PopoverContent as xe } from "../ui/popover.js";
|
|
14
|
+
const ee = 1e4, _e = 1500, Je = 2e3, Ge = 5 * 6e4, Xe = 3e4, Ze = 6e4, et = 15e3, pe = 1500, tt = 6e4;
|
|
15
|
+
function Le(e, t) {
|
|
15
16
|
return e ? `${t ?? "Someone else"} took over editing — your changes are still here, but can’t be saved until they release it` : "Someone else started editing while you were away — your changes are still here, but can’t be saved until they release it";
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
-
const [e, t] =
|
|
19
|
-
return
|
|
18
|
+
function rt() {
|
|
19
|
+
const [e, t] = S(!0);
|
|
20
|
+
return w(() => {
|
|
20
21
|
if (typeof window > "u" || typeof document > "u") return;
|
|
21
|
-
let s = null,
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
}, o = (
|
|
27
|
-
|
|
28
|
-
},
|
|
22
|
+
let s = null, N = null, k = 0;
|
|
23
|
+
const q = () => typeof document.hasFocus == "function" ? document.hasFocus() : !0, g = () => {
|
|
24
|
+
N && clearInterval(N), N = null;
|
|
25
|
+
}, $ = (y) => y instanceof HTMLInputElement && y.type === "file", _ = (y) => {
|
|
26
|
+
$(y.target) && (k = Date.now() + Ge);
|
|
27
|
+
}, o = (y) => {
|
|
28
|
+
!$(y.target) || !k || (k = 0, q() || C());
|
|
29
|
+
}, C = () => {
|
|
29
30
|
s && clearTimeout(s);
|
|
30
|
-
const
|
|
31
|
+
const y = k - Date.now();
|
|
31
32
|
s = setTimeout(
|
|
32
33
|
() => {
|
|
33
|
-
if (s = null, !
|
|
34
|
+
if (s = null, !q()) {
|
|
34
35
|
g(), t(!1);
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
37
|
-
g(),
|
|
38
|
-
|
|
39
|
-
},
|
|
38
|
+
g(), N = setInterval(() => {
|
|
39
|
+
q() || (g(), t(!1));
|
|
40
|
+
}, Je);
|
|
40
41
|
},
|
|
41
|
-
|
|
42
|
+
y > 0 ? Math.max(y, _e) : _e
|
|
42
43
|
);
|
|
43
44
|
}, c = () => {
|
|
44
|
-
s && clearTimeout(s), s = null,
|
|
45
|
+
s && clearTimeout(s), s = null, k = 0, g(), t(!0);
|
|
45
46
|
};
|
|
46
|
-
return window.addEventListener("blur",
|
|
47
|
-
window.removeEventListener("blur",
|
|
47
|
+
return window.addEventListener("blur", C), window.addEventListener("focus", c), document.addEventListener("click", _, !0), document.addEventListener("change", o, !0), document.addEventListener("cancel", o, !0), () => {
|
|
48
|
+
window.removeEventListener("blur", C), window.removeEventListener("focus", c), document.removeEventListener("click", _, !0), document.removeEventListener("change", o, !0), document.removeEventListener("cancel", o, !0), s && clearTimeout(s), g();
|
|
48
49
|
};
|
|
49
50
|
}, []), e;
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
-
const [e, t] =
|
|
52
|
+
function nt() {
|
|
53
|
+
const [e, t] = S(
|
|
53
54
|
() => typeof document > "u" || document.visibilityState !== "hidden"
|
|
54
55
|
);
|
|
55
|
-
return
|
|
56
|
+
return w(() => {
|
|
56
57
|
const s = () => t(document.visibilityState !== "hidden");
|
|
57
58
|
return document.addEventListener("visibilitychange", s), () => document.removeEventListener("visibilitychange", s);
|
|
58
59
|
}, []), e;
|
|
59
60
|
}
|
|
60
|
-
function
|
|
61
|
-
const { lazy:
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
}, []),
|
|
61
|
+
function vt(e, t, s, N = {}) {
|
|
62
|
+
const { lazy: k = !1, active: q = !0, dirty: g } = N, $ = T(g);
|
|
63
|
+
$.current = g;
|
|
64
|
+
const _ = E(() => k && $.current === !1, [k]), o = Be(), { isAdmin: C, userId: c } = Qe(), y = je(Pe), [D, R] = S(null), [Y, L] = S(!1), [j, le] = S(!1), [Ee, $e] = S([]), [Se, B] = S(null), [Ne, ce] = S(!1), [Re, de] = S(""), [Ce, te] = S(!1), [Te, fe] = S(!1), H = T(null), i = T(!1), A = T(!1), re = T(!1), ne = T(0), M = T(!1), Q = T(null), U = T(null), V = T(null), J = T(!1), F = `${e ?? ""}:${t ?? ""}`, z = E(() => {
|
|
65
|
+
V.current = null, J.current = !1, ie(F, !1);
|
|
66
|
+
}, [F]), f = E(() => {
|
|
67
|
+
H.current && (clearInterval(H.current), H.current = null);
|
|
68
|
+
}, []), ae = E(
|
|
66
69
|
(a) => {
|
|
67
|
-
var r,
|
|
68
|
-
const n = a,
|
|
69
|
-
return
|
|
70
|
+
var r, u;
|
|
71
|
+
const n = a, m = n.status ?? ((r = n.response) == null ? void 0 : r.status), l = ((u = n.response) == null ? void 0 : u.data) ?? n.response;
|
|
72
|
+
return m !== 403 || (l == null ? void 0 : l.code) !== "EDIT_LOCKED" ? !1 : (f(), i.current = !1, L(!1), d.warning(l.error || "You can no longer edit this record — your edit lock was let go"), y == null || y.invalidateQueries({ queryKey: ["pipeline-instance-lock", e, t] }), y == null || y.invalidateQueries({ queryKey: ["pipeline-instance", e, t] }), !0);
|
|
70
73
|
},
|
|
71
|
-
[
|
|
72
|
-
), h =
|
|
74
|
+
[y, e, t, f]
|
|
75
|
+
), h = E(async () => {
|
|
73
76
|
var a, n;
|
|
74
|
-
if (!e || !t ||
|
|
75
|
-
|
|
77
|
+
if (!e || !t || M.current) return !1;
|
|
78
|
+
Q.current = null, U.current = null;
|
|
76
79
|
try {
|
|
77
80
|
return await o.request(
|
|
78
|
-
|
|
79
|
-
), i.current = !0,
|
|
80
|
-
const
|
|
81
|
+
I(`/item-locks/${e}/${t}/lock`, { beat_ms: ee })
|
|
82
|
+
), i.current = !0, L(!0), te(!1), R(null), f(), H.current = setInterval(() => {
|
|
83
|
+
const m = Math.max(
|
|
81
84
|
0,
|
|
82
|
-
Math.floor((Date.now() - new Date(
|
|
85
|
+
Math.floor((Date.now() - new Date(Ve().last_active).getTime()) / 1e3)
|
|
83
86
|
);
|
|
84
87
|
o.request(
|
|
85
|
-
|
|
86
|
-
idle_seconds:
|
|
87
|
-
beat_ms:
|
|
88
|
+
I(`/item-locks/${e}/${t}/heartbeat`, {
|
|
89
|
+
idle_seconds: m,
|
|
90
|
+
beat_ms: ee
|
|
88
91
|
})
|
|
89
|
-
).then((
|
|
90
|
-
if (!(
|
|
91
|
-
|
|
92
|
+
).then((l) => {
|
|
93
|
+
if (!(l != null && l.idle_released)) return;
|
|
94
|
+
f(), i.current = !1, L(!1), d.info(
|
|
92
95
|
"Your edit lock was released after inactivity — it re-locks when you resume."
|
|
93
96
|
);
|
|
94
97
|
const r = () => {
|
|
95
|
-
window.removeEventListener("pointerdown", r, !0), window.removeEventListener("keydown", r, !0), !
|
|
98
|
+
window.removeEventListener("pointerdown", r, !0), window.removeEventListener("keydown", r, !0), !_() && h();
|
|
96
99
|
};
|
|
97
100
|
window.addEventListener("pointerdown", r, !0), window.addEventListener("keydown", r, !0);
|
|
98
|
-
}).catch((
|
|
99
|
-
var
|
|
100
|
-
const r =
|
|
101
|
-
if (
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
}).catch((l) => {
|
|
102
|
+
var ke, he;
|
|
103
|
+
const r = l, u = r.status ?? ((ke = r.response) == null ? void 0 : ke.status);
|
|
104
|
+
if (ae(l) || u !== 404 && u !== 409) return;
|
|
105
|
+
const b = ((he = r.response) == null ? void 0 : he.data) ?? r.response;
|
|
106
|
+
if (u === 404 && !(b != null && b.locked_by) && (b == null ? void 0 : b.taken_over) === !0) {
|
|
107
|
+
f(), i.current = !1, L(!1);
|
|
108
|
+
const be = b.taken_over_by_name ?? null;
|
|
109
|
+
U.current = be ?? "Someone else", d.warning(
|
|
110
|
+
`${be ?? "Someone else"} took over editing — your changes are still here; they save once you edit again`
|
|
111
|
+
);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (u === 404 && !(b != null && b.locked_by)) {
|
|
115
|
+
if (_()) {
|
|
116
|
+
f(), i.current = !1, L(!1);
|
|
106
117
|
return;
|
|
107
118
|
}
|
|
108
119
|
h();
|
|
109
120
|
return;
|
|
110
121
|
}
|
|
111
|
-
|
|
112
|
-
locked_by:
|
|
113
|
-
locked_by_name:
|
|
122
|
+
f(), i.current = !1, L(!1), b != null && b.locked_by && (R({
|
|
123
|
+
locked_by: b.locked_by,
|
|
124
|
+
locked_by_name: b.locked_by_name ?? null
|
|
114
125
|
}), d.warning(
|
|
115
|
-
|
|
126
|
+
b.taken_over === !1 ? Le(!1) : `${b.locked_by_name ?? "Another user"} took over editing — your changes are no longer being saved`
|
|
116
127
|
));
|
|
117
128
|
});
|
|
118
|
-
},
|
|
119
|
-
} catch (
|
|
120
|
-
const
|
|
121
|
-
return
|
|
122
|
-
locked_by:
|
|
123
|
-
locked_by_name:
|
|
124
|
-
...typeof
|
|
129
|
+
}, ee), !0;
|
|
130
|
+
} catch (m) {
|
|
131
|
+
const l = m, r = l.status ?? ((a = l.response) == null ? void 0 : a.status), u = ((n = l.response) == null ? void 0 : n.data) ?? l.response;
|
|
132
|
+
return Q.current = r ?? null, U.current = (u == null ? void 0 : u.taken_over) === !0 ? u.locked_by_name ?? "Someone else" : null, ae(m) ? !1 : r === 404 ? (M.current = !0, f(), i.current = !1, L(!1), !1) : (r === 409 && (u != null && u.locked_by) && (i.current = !1, L(!1), R({
|
|
133
|
+
locked_by: u.locked_by,
|
|
134
|
+
locked_by_name: u.locked_by_name ?? null,
|
|
135
|
+
...typeof u.may_take_over == "boolean" ? { may_take_over: u.may_take_over } : {}
|
|
125
136
|
})), !1);
|
|
126
137
|
}
|
|
127
|
-
}, [o, e, t,
|
|
138
|
+
}, [o, e, t, f, ae, _]), p = E(async () => {
|
|
128
139
|
if (!(!e || !t))
|
|
129
140
|
try {
|
|
130
|
-
const a = await o.request(
|
|
131
|
-
|
|
132
|
-
const
|
|
141
|
+
const a = await o.request(Ue(`/item-locks/${e}/${t}/lock`)), n = a == null ? void 0 : a.data;
|
|
142
|
+
$e(Array.isArray(n == null ? void 0 : n.queue) ? n.queue : []), B(typeof (n == null ? void 0 : n.my_position) == "number" ? n.my_position : null);
|
|
143
|
+
const m = (n == null ? void 0 : n.is_mine) === !0 || !!c && String((n == null ? void 0 : n.locked_by) ?? "").toLowerCase() === c.toLowerCase(), l = typeof (n == null ? void 0 : n.may_take_over) == "boolean" ? { may_take_over: n.may_take_over } : {};
|
|
133
144
|
if (i.current) return;
|
|
134
|
-
if (!(n != null && n.locked_by) ||
|
|
135
|
-
|
|
145
|
+
if (!(n != null && n.locked_by) || m) {
|
|
146
|
+
R(null);
|
|
136
147
|
return;
|
|
137
148
|
}
|
|
138
|
-
|
|
149
|
+
R(
|
|
139
150
|
(r) => r && r.locked_by === String(n.locked_by) ? {
|
|
140
151
|
...r,
|
|
141
152
|
note: n.note ?? r.note ?? null,
|
|
142
153
|
idle_minutes: n.locked_by_idle_minutes ?? r.idle_minutes ?? null,
|
|
143
|
-
...
|
|
154
|
+
...l
|
|
144
155
|
} : {
|
|
145
156
|
locked_by: String(n.locked_by),
|
|
146
157
|
locked_by_name: n.locked_by_name ?? null,
|
|
147
158
|
note: n.note ?? null,
|
|
148
159
|
idle_minutes: n.locked_by_idle_minutes ?? null,
|
|
149
|
-
...
|
|
160
|
+
...l
|
|
150
161
|
}
|
|
151
|
-
),
|
|
162
|
+
), te(!1);
|
|
152
163
|
} catch (a) {
|
|
153
|
-
(a == null ? void 0 : a.status) === 404 && (
|
|
164
|
+
(a == null ? void 0 : a.status) === 404 && (M.current = !0);
|
|
154
165
|
}
|
|
155
|
-
}, [o, e, t, c]),
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}, [
|
|
159
|
-
if (!
|
|
160
|
-
const a = setInterval(() => void
|
|
166
|
+
}, [o, e, t, c]), K = (D == null ? void 0 : D.locked_by) ?? null;
|
|
167
|
+
w(() => {
|
|
168
|
+
K && p();
|
|
169
|
+
}, [K, p]), w(() => {
|
|
170
|
+
if (!K) return;
|
|
171
|
+
const a = setInterval(() => void p(), Xe);
|
|
161
172
|
return () => clearInterval(a);
|
|
162
|
-
}, [
|
|
173
|
+
}, [K, p]), w(() => {
|
|
163
174
|
if (!(!s || !e || !t))
|
|
164
|
-
return
|
|
165
|
-
|
|
175
|
+
return A.current = !1, M.current = !1, k ? p() : h(), () => {
|
|
176
|
+
f(), A.current = !1, i.current && (i.current = !1, o.request(W(`/item-locks/${e}/${t}/lock`)).then(() => Z(c, "lock-released", e, t)).catch(() => {
|
|
166
177
|
}));
|
|
167
178
|
};
|
|
168
|
-
}, [s, e, t, h, o,
|
|
169
|
-
const
|
|
170
|
-
if (!(!s || i.current ||
|
|
171
|
-
|
|
179
|
+
}, [s, e, t, h, o, f, c, k, p]);
|
|
180
|
+
const qe = E(async () => {
|
|
181
|
+
if (!(!s || i.current || re.current) && !(Date.now() < ne.current)) {
|
|
182
|
+
re.current = !0;
|
|
172
183
|
try {
|
|
173
184
|
const a = await h();
|
|
174
|
-
!a &&
|
|
185
|
+
!a && Q.current === 409 && d.warning("Someone else is editing this record — your change can’t be saved yet"), !a && Q.current !== 409 && !M.current && (ne.current = Date.now() + et);
|
|
175
186
|
} finally {
|
|
176
|
-
|
|
187
|
+
re.current = !1;
|
|
177
188
|
}
|
|
178
189
|
}
|
|
179
190
|
}, [s, h]);
|
|
180
|
-
|
|
191
|
+
w(() => {
|
|
181
192
|
const a = () => {
|
|
182
|
-
|
|
193
|
+
ne.current = 0;
|
|
183
194
|
};
|
|
184
195
|
return window.addEventListener("online", a), () => window.removeEventListener("online", a);
|
|
185
196
|
}, []);
|
|
186
|
-
const
|
|
197
|
+
const G = E(() => {
|
|
187
198
|
var a;
|
|
188
199
|
if (!(!e || !t))
|
|
189
200
|
try {
|
|
190
|
-
const n = (a = o.getToken) == null ? void 0 : a.call(o),
|
|
201
|
+
const n = (a = o.getToken) == null ? void 0 : a.call(o), m = o.url ?? "";
|
|
191
202
|
fetch(
|
|
192
|
-
`${
|
|
203
|
+
`${m}/api/item-locks/${encodeURIComponent(e)}/${encodeURIComponent(t)}/lock/release`,
|
|
193
204
|
{
|
|
194
205
|
method: "POST",
|
|
195
206
|
keepalive: !0,
|
|
196
207
|
credentials: n ? "omit" : "include",
|
|
197
208
|
headers: n ? { Authorization: `Bearer ${n}` } : {}
|
|
198
209
|
}
|
|
199
|
-
).then(() =>
|
|
210
|
+
).then(() => Z(c, "lock-released", e, t)).catch(() => {
|
|
200
211
|
});
|
|
201
212
|
} catch {
|
|
202
213
|
}
|
|
203
|
-
}, [o, e, t, c]),
|
|
204
|
-
|
|
214
|
+
}, [o, e, t, c]), se = nt(), Ae = rt(), X = q && se && Ae;
|
|
215
|
+
w(() => {
|
|
205
216
|
if (!(!s || !e || !t)) {
|
|
206
|
-
if (
|
|
207
|
-
if (
|
|
208
|
-
if (
|
|
217
|
+
if (X) {
|
|
218
|
+
if (A.current) {
|
|
219
|
+
if (A.current = !1, _()) return;
|
|
209
220
|
h().then((a) => {
|
|
210
|
-
!a &&
|
|
221
|
+
!a && Q.current === 409 && d.warning(Le(U.current != null, U.current));
|
|
211
222
|
});
|
|
212
223
|
}
|
|
213
224
|
return;
|
|
214
225
|
}
|
|
215
|
-
i.current && (
|
|
216
|
-
}) :
|
|
226
|
+
i.current && (f(), i.current = !1, L(!1), A.current = !0, se ? o.request(W(`/item-locks/${e}/${t}/lock`)).then(() => Z(c, "lock-released", e, t)).catch(() => {
|
|
227
|
+
}) : G());
|
|
217
228
|
}
|
|
218
229
|
}, [
|
|
219
230
|
s,
|
|
220
|
-
|
|
221
|
-
|
|
231
|
+
X,
|
|
232
|
+
se,
|
|
222
233
|
e,
|
|
223
234
|
t,
|
|
224
235
|
h,
|
|
225
236
|
o,
|
|
226
|
-
|
|
237
|
+
f,
|
|
227
238
|
c,
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
]),
|
|
231
|
-
if (!s || !
|
|
239
|
+
G,
|
|
240
|
+
_
|
|
241
|
+
]), w(() => {
|
|
242
|
+
if (!s || !k || !e || !t || K || !X) return;
|
|
232
243
|
const a = setInterval(() => {
|
|
233
|
-
!i.current && !
|
|
234
|
-
},
|
|
244
|
+
!i.current && !M.current && p();
|
|
245
|
+
}, Ze);
|
|
235
246
|
return () => clearInterval(a);
|
|
236
|
-
}, [s,
|
|
247
|
+
}, [s, k, e, t, K, X, p]), w(() => {
|
|
237
248
|
if (!s || !e || !t) return;
|
|
238
249
|
const a = () => {
|
|
239
|
-
i.current && (
|
|
240
|
-
}, n = (
|
|
241
|
-
|
|
250
|
+
i.current && (f(), i.current = !1, A.current = !0, G());
|
|
251
|
+
}, n = (m) => {
|
|
252
|
+
m.persisted && A.current && (A.current = !1, _() || h());
|
|
242
253
|
};
|
|
243
254
|
return window.addEventListener("pagehide", a), window.addEventListener("pageshow", n), () => {
|
|
244
255
|
window.removeEventListener("pagehide", a), window.removeEventListener("pageshow", n);
|
|
245
256
|
};
|
|
246
|
-
}, [s, e, t,
|
|
247
|
-
if (!s || !
|
|
248
|
-
const a = setTimeout(() => {
|
|
249
|
-
|
|
257
|
+
}, [s, e, t, f, h, G, _]), w(() => {
|
|
258
|
+
if (!s || !k || !e || !t || g !== !1 || !i.current) return;
|
|
259
|
+
const a = V.current, n = a != null && !J.current ? Math.max(pe, a + tt - Date.now()) : pe, m = setTimeout(() => {
|
|
260
|
+
$.current !== !1 || !i.current || (f(), i.current = !1, L(!1), z(), o.request(W(`/item-locks/${e}/${t}/lock`)).then(() => Z(c, "lock-released", e, t)).catch(() => {
|
|
250
261
|
}));
|
|
251
|
-
},
|
|
252
|
-
return () => clearTimeout(
|
|
253
|
-
}, [
|
|
262
|
+
}, n);
|
|
263
|
+
return () => clearTimeout(m);
|
|
264
|
+
}, [
|
|
265
|
+
s,
|
|
266
|
+
k,
|
|
267
|
+
e,
|
|
268
|
+
t,
|
|
269
|
+
g,
|
|
270
|
+
Y,
|
|
271
|
+
o,
|
|
272
|
+
f,
|
|
273
|
+
c,
|
|
274
|
+
z
|
|
275
|
+
]), w(() => {
|
|
276
|
+
g === !0 && V.current != null && (J.current = !0);
|
|
277
|
+
}, [g]), w(() => {
|
|
278
|
+
!Y && V.current != null && z();
|
|
279
|
+
}, [Y, z]), w(() => () => ie(F, !1), [F]), He(c, "lock-released", e, t, () => {
|
|
254
280
|
s && i.current && h();
|
|
255
281
|
});
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
if (!(!s || !
|
|
259
|
-
return
|
|
282
|
+
const oe = ye();
|
|
283
|
+
w(() => {
|
|
284
|
+
if (!(!s || !oe || !e || !t))
|
|
285
|
+
return oe.subscribeCollections([e], (a) => {
|
|
260
286
|
var n;
|
|
261
|
-
i.current ||
|
|
287
|
+
i.current || M.current || !((n = a.changed_fields) != null && n.includes("$lock")) || !We(a, t) || p();
|
|
262
288
|
});
|
|
263
|
-
}, [s,
|
|
264
|
-
const
|
|
289
|
+
}, [s, oe, e, t, p]);
|
|
290
|
+
const P = ye(), [Ie, me] = S(!1), Oe = E(async () => {
|
|
265
291
|
if (!(!e || !t)) {
|
|
266
|
-
|
|
292
|
+
me(!0);
|
|
267
293
|
try {
|
|
268
|
-
await o.request(
|
|
294
|
+
await o.request(I(`/item-locks/${e}/${t}/lock/request`, {})), d.success("Asked the current editor to release the lock");
|
|
269
295
|
} catch {
|
|
270
296
|
d.error("Could not send the lock request");
|
|
271
297
|
} finally {
|
|
272
|
-
|
|
298
|
+
me(!1);
|
|
273
299
|
}
|
|
274
300
|
}
|
|
275
301
|
}, [o, e, t]);
|
|
276
|
-
|
|
277
|
-
if (!
|
|
278
|
-
const a =
|
|
302
|
+
w(() => {
|
|
303
|
+
if (!P || !e || !t) return;
|
|
304
|
+
const a = P.on("lock:requested", (r) => {
|
|
279
305
|
if ((r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || !i.current) return;
|
|
280
|
-
const
|
|
281
|
-
d(`${
|
|
306
|
+
const u = (r == null ? void 0 : r.from) ?? {};
|
|
307
|
+
d(`${u.name ?? "Someone"} is asking you to release this record`, {
|
|
282
308
|
duration: 3e4,
|
|
283
309
|
action: {
|
|
284
310
|
label: "Release",
|
|
285
311
|
onClick: () => {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
to:
|
|
312
|
+
f(), i.current = !1, L(!1), o.request(
|
|
313
|
+
I(`/item-locks/${e}/${t}/lock/respond`, {
|
|
314
|
+
to: u.id,
|
|
289
315
|
action: "release"
|
|
290
316
|
})
|
|
291
317
|
).then(() => d.success("Lock released")).catch(() => d.error("Failed to release the lock"));
|
|
@@ -295,8 +321,8 @@ function lt(e, t, s, C = {}) {
|
|
|
295
321
|
label: "Keep editing",
|
|
296
322
|
onClick: () => {
|
|
297
323
|
o.request(
|
|
298
|
-
|
|
299
|
-
to:
|
|
324
|
+
I(`/item-locks/${e}/${t}/lock/respond`, {
|
|
325
|
+
to: u.id,
|
|
300
326
|
action: "decline"
|
|
301
327
|
})
|
|
302
328
|
).catch(() => {
|
|
@@ -304,127 +330,127 @@ function lt(e, t, s, C = {}) {
|
|
|
304
330
|
}
|
|
305
331
|
}
|
|
306
332
|
});
|
|
307
|
-
}), n =
|
|
308
|
-
var
|
|
309
|
-
(r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || i.current || ((r == null ? void 0 : r.action) === "release" ? (d.success(`${((
|
|
310
|
-
`${((
|
|
333
|
+
}), n = P.on("lock:response", (r) => {
|
|
334
|
+
var u, b;
|
|
335
|
+
(r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || i.current || ((r == null ? void 0 : r.action) === "release" ? (d.success(`${((u = r == null ? void 0 : r.from) == null ? void 0 : u.name) ?? "The editor"} released the lock — it's yours`), h()) : d.warning(
|
|
336
|
+
`${((b = r == null ? void 0 : r.from) == null ? void 0 : b.name) ?? "The editor"} is keeping the lock${r != null && r.note ? `: "${r.note}"` : ""}`
|
|
311
337
|
));
|
|
312
|
-
}),
|
|
313
|
-
(r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || i.current || (d.success("Your turn — the edit lock is yours"),
|
|
314
|
-
}),
|
|
315
|
-
(r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || (i.current && d(`${(r == null ? void 0 : r.user_name) ?? "Someone"} is waiting to edit this record`, { duration: 8e3 }),
|
|
338
|
+
}), m = P.on("lock:available", (r) => {
|
|
339
|
+
(r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || i.current || (d.success("Your turn — the edit lock is yours"), B(null), h());
|
|
340
|
+
}), l = P.on("lock:queued", (r) => {
|
|
341
|
+
(r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || (i.current && d(`${(r == null ? void 0 : r.user_name) ?? "Someone"} is waiting to edit this record`, { duration: 8e3 }), p());
|
|
316
342
|
});
|
|
317
343
|
return () => {
|
|
318
|
-
a(), n(),
|
|
344
|
+
a(), n(), m(), l();
|
|
319
345
|
};
|
|
320
|
-
}, [
|
|
321
|
-
const
|
|
346
|
+
}, [P, e, t, o, h, f, p]);
|
|
347
|
+
const De = E(async () => {
|
|
322
348
|
if (!(!e || !t)) {
|
|
323
|
-
|
|
349
|
+
ce(!0);
|
|
324
350
|
try {
|
|
325
351
|
const a = await o.request(
|
|
326
|
-
|
|
352
|
+
I(`/item-locks/${e}/${t}/lock/queue`, {})
|
|
327
353
|
), n = a == null ? void 0 : a.data;
|
|
328
354
|
if (n != null && n.free) {
|
|
329
|
-
|
|
355
|
+
B(null), R(null), d.success("Nobody is editing this record now — go ahead");
|
|
330
356
|
return;
|
|
331
357
|
}
|
|
332
|
-
const
|
|
333
|
-
|
|
358
|
+
const m = n == null ? void 0 : n.position;
|
|
359
|
+
B(typeof m == "number" ? m : 1), d.success("You are in line — the lock comes to you automatically when it frees up"), p();
|
|
334
360
|
} catch {
|
|
335
361
|
d.error("Could not join the queue");
|
|
336
362
|
} finally {
|
|
337
|
-
|
|
363
|
+
ce(!1);
|
|
338
364
|
}
|
|
339
365
|
}
|
|
340
|
-
}, [o, e, t,
|
|
366
|
+
}, [o, e, t, p]), Me = E(async () => {
|
|
341
367
|
if (!(!e || !t))
|
|
342
368
|
try {
|
|
343
|
-
await o.request(
|
|
369
|
+
await o.request(W(`/item-locks/${e}/${t}/lock/queue`)), B(null), p();
|
|
344
370
|
} catch {
|
|
345
371
|
}
|
|
346
|
-
}, [o, e, t,
|
|
372
|
+
}, [o, e, t, p]), Ye = E(
|
|
347
373
|
async (a) => {
|
|
348
374
|
if (!(!e || !t || !i.current)) {
|
|
349
|
-
|
|
375
|
+
de(a);
|
|
350
376
|
try {
|
|
351
|
-
await o.request(
|
|
377
|
+
await o.request(I(`/item-locks/${e}/${t}/lock/note`, { note: a }));
|
|
352
378
|
} catch {
|
|
353
379
|
}
|
|
354
380
|
}
|
|
355
381
|
},
|
|
356
382
|
[o, e, t]
|
|
357
|
-
),
|
|
383
|
+
), Fe = E(async () => {
|
|
358
384
|
if (!(!e || !t || !i.current)) {
|
|
359
|
-
|
|
385
|
+
fe(!0), f(), i.current = !1, L(!1);
|
|
360
386
|
try {
|
|
361
|
-
await o.request(
|
|
387
|
+
await o.request(W(`/item-locks/${e}/${t}/lock`)), te(!0), de(""), d.success("Lock released — anyone can edit this record now");
|
|
362
388
|
} catch {
|
|
363
389
|
d.error("Failed to release the lock"), h();
|
|
364
390
|
} finally {
|
|
365
|
-
|
|
391
|
+
fe(!1);
|
|
366
392
|
}
|
|
367
393
|
}
|
|
368
|
-
}, [o, e, t,
|
|
394
|
+
}, [o, e, t, f, h]), ze = E(async () => {
|
|
369
395
|
if (i.current) return !0;
|
|
370
396
|
const a = await h();
|
|
371
397
|
return a && d.success("You hold the edit lock again"), a;
|
|
372
|
-
}, [h]),
|
|
398
|
+
}, [h]), Ke = E(async () => {
|
|
373
399
|
var a;
|
|
374
400
|
if (!(!e || !t)) {
|
|
375
|
-
|
|
401
|
+
le(!0);
|
|
376
402
|
try {
|
|
377
403
|
await o.request(
|
|
378
|
-
|
|
379
|
-
), d.success("You now hold the edit lock"), await h();
|
|
404
|
+
I(`/item-locks/${e}/${t}/lock/force`, { beat_ms: ee })
|
|
405
|
+
), d.success("You now hold the edit lock"), V.current = Date.now(), J.current = !1, ie(F, !0), await h() || z();
|
|
380
406
|
} catch (n) {
|
|
381
|
-
const
|
|
382
|
-
d.error(
|
|
407
|
+
const m = ((a = n == null ? void 0 : n.response) == null ? void 0 : a.error) ?? "Failed to take over the lock";
|
|
408
|
+
d.error(m), (n == null ? void 0 : n.status) === 403 && R((l) => l && { ...l, may_take_over: !1 });
|
|
383
409
|
} finally {
|
|
384
|
-
|
|
410
|
+
le(!1);
|
|
385
411
|
}
|
|
386
412
|
}
|
|
387
|
-
}, [o, e, t, h]);
|
|
413
|
+
}, [o, e, t, h, F, z]);
|
|
388
414
|
return {
|
|
389
|
-
lockHolder:
|
|
390
|
-
acquired:
|
|
391
|
-
isReadOnly: !!
|
|
392
|
-
takeOver:
|
|
393
|
-
takingOver:
|
|
394
|
-
isAdmin:
|
|
395
|
-
requestLock:
|
|
396
|
-
requesting:
|
|
397
|
-
queue:
|
|
398
|
-
myPosition:
|
|
399
|
-
joinQueue:
|
|
400
|
-
leaveQueue:
|
|
401
|
-
joining:
|
|
402
|
-
myNote:
|
|
403
|
-
saveNote:
|
|
404
|
-
release:
|
|
405
|
-
releasing:
|
|
406
|
-
released:
|
|
407
|
-
relock:
|
|
408
|
-
claim:
|
|
415
|
+
lockHolder: D,
|
|
416
|
+
acquired: Y,
|
|
417
|
+
isReadOnly: !!D,
|
|
418
|
+
takeOver: Ke,
|
|
419
|
+
takingOver: j,
|
|
420
|
+
isAdmin: C,
|
|
421
|
+
requestLock: Oe,
|
|
422
|
+
requesting: Ie,
|
|
423
|
+
queue: Ee,
|
|
424
|
+
myPosition: Se,
|
|
425
|
+
joinQueue: De,
|
|
426
|
+
leaveQueue: Me,
|
|
427
|
+
joining: Ne,
|
|
428
|
+
myNote: Re,
|
|
429
|
+
saveNote: Ye,
|
|
430
|
+
release: Fe,
|
|
431
|
+
releasing: Te,
|
|
432
|
+
released: Ce,
|
|
433
|
+
relock: ze,
|
|
434
|
+
claim: qe
|
|
409
435
|
};
|
|
410
436
|
}
|
|
411
|
-
function
|
|
437
|
+
function yt({
|
|
412
438
|
note: e,
|
|
413
439
|
onSave: t,
|
|
414
440
|
waiting: s,
|
|
415
|
-
onRelease:
|
|
416
|
-
releasing:
|
|
417
|
-
released:
|
|
441
|
+
onRelease: N,
|
|
442
|
+
releasing: k,
|
|
443
|
+
released: q,
|
|
418
444
|
onRelock: g
|
|
419
445
|
}) {
|
|
420
|
-
var
|
|
421
|
-
const [_
|
|
422
|
-
|
|
446
|
+
var C;
|
|
447
|
+
const [$, _] = S(e);
|
|
448
|
+
w(() => _(e), [e]);
|
|
423
449
|
const o = () => {
|
|
424
|
-
|
|
450
|
+
$.trim() !== e && t($.trim());
|
|
425
451
|
};
|
|
426
|
-
return
|
|
427
|
-
/* @__PURE__ */
|
|
452
|
+
return q ? /* @__PURE__ */ x(ge, { children: [
|
|
453
|
+
/* @__PURE__ */ v(we, { asChild: !0, children: /* @__PURE__ */ v(
|
|
428
454
|
"button",
|
|
429
455
|
{
|
|
430
456
|
type: "button",
|
|
@@ -432,13 +458,13 @@ function ct({
|
|
|
432
458
|
title: "Lock released — anyone can edit this record",
|
|
433
459
|
"data-lock-released": !0,
|
|
434
460
|
className: "relative inline-flex h-8 w-8 items-center justify-center text-slate-400 transition-colors hover:bg-accent hover:text-accent-foreground dark:text-slate-500",
|
|
435
|
-
children: /* @__PURE__ */
|
|
461
|
+
children: /* @__PURE__ */ v(ve, { className: "h-4 w-4", strokeWidth: 2 })
|
|
436
462
|
}
|
|
437
463
|
) }),
|
|
438
|
-
/* @__PURE__ */
|
|
439
|
-
/* @__PURE__ */
|
|
440
|
-
/* @__PURE__ */
|
|
441
|
-
/* @__PURE__ */
|
|
464
|
+
/* @__PURE__ */ x(xe, { align: "end", sideOffset: 6, className: "w-[300px] p-3", children: [
|
|
465
|
+
/* @__PURE__ */ v("p", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "You released the edit lock" }),
|
|
466
|
+
/* @__PURE__ */ v("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: "Anyone can edit this record now. Your next edit locks it again — or lock it now." }),
|
|
467
|
+
/* @__PURE__ */ x(
|
|
442
468
|
O,
|
|
443
469
|
{
|
|
444
470
|
type: "button",
|
|
@@ -447,14 +473,14 @@ function ct({
|
|
|
447
473
|
onClick: g,
|
|
448
474
|
"data-lock-relock": !0,
|
|
449
475
|
children: [
|
|
450
|
-
/* @__PURE__ */
|
|
476
|
+
/* @__PURE__ */ v(ue, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
451
477
|
" Lock again"
|
|
452
478
|
]
|
|
453
479
|
}
|
|
454
480
|
)
|
|
455
481
|
] })
|
|
456
|
-
] }) : /* @__PURE__ */
|
|
457
|
-
/* @__PURE__ */
|
|
482
|
+
] }) : /* @__PURE__ */ x(ge, { children: [
|
|
483
|
+
/* @__PURE__ */ v(we, { asChild: !0, children: /* @__PURE__ */ x(
|
|
458
484
|
"button",
|
|
459
485
|
{
|
|
460
486
|
type: "button",
|
|
@@ -463,19 +489,19 @@ function ct({
|
|
|
463
489
|
"data-lock-holder": !0,
|
|
464
490
|
className: "relative inline-flex h-8 w-8 items-center justify-center text-[#0e7490] transition-colors hover:bg-accent hover:text-accent-foreground dark:text-nvr-cyan",
|
|
465
491
|
children: [
|
|
466
|
-
/* @__PURE__ */
|
|
467
|
-
s.length > 0 && /* @__PURE__ */
|
|
492
|
+
/* @__PURE__ */ v(ue, { className: "h-4 w-4", strokeWidth: 2 }),
|
|
493
|
+
s.length > 0 && /* @__PURE__ */ v("span", { className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-amber-500 ring-2 ring-background" })
|
|
468
494
|
]
|
|
469
495
|
}
|
|
470
496
|
) }),
|
|
471
|
-
/* @__PURE__ */
|
|
472
|
-
/* @__PURE__ */
|
|
473
|
-
/* @__PURE__ */
|
|
474
|
-
/* @__PURE__ */
|
|
497
|
+
/* @__PURE__ */ x(xe, { align: "end", sideOffset: 6, className: "w-[300px] p-3", children: [
|
|
498
|
+
/* @__PURE__ */ v("p", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "You hold the edit lock" }),
|
|
499
|
+
/* @__PURE__ */ v("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: "Others see this record read-only. A note tells them what you’re doing." }),
|
|
500
|
+
/* @__PURE__ */ v(
|
|
475
501
|
"input",
|
|
476
502
|
{
|
|
477
|
-
value:
|
|
478
|
-
onChange: (c) =>
|
|
503
|
+
value: $,
|
|
504
|
+
onChange: (c) => _(c.target.value.slice(0, 300)),
|
|
479
505
|
onBlur: o,
|
|
480
506
|
onKeyDown: (c) => {
|
|
481
507
|
c.key === "Enter" && (c.preventDefault(), o());
|
|
@@ -485,65 +511,65 @@ function ct({
|
|
|
485
511
|
className: "mt-2 h-7 w-full rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card"
|
|
486
512
|
}
|
|
487
513
|
),
|
|
488
|
-
s.length > 0 && /* @__PURE__ */
|
|
489
|
-
/* @__PURE__ */
|
|
514
|
+
s.length > 0 && /* @__PURE__ */ x("div", { className: "mt-2 rounded-md bg-amber-50 px-2 py-1.5 text-[11px] text-amber-800 dark:bg-amber-500/10 dark:text-amber-200", children: [
|
|
515
|
+
/* @__PURE__ */ x("span", { className: "font-semibold", children: [
|
|
490
516
|
s.length,
|
|
491
517
|
" waiting for the lock:"
|
|
492
518
|
] }),
|
|
493
519
|
" ",
|
|
494
520
|
s.map((c) => c.name ?? "someone").join(", ")
|
|
495
521
|
] }),
|
|
496
|
-
|
|
522
|
+
N && /* @__PURE__ */ x(
|
|
497
523
|
O,
|
|
498
524
|
{
|
|
499
525
|
type: "button",
|
|
500
526
|
variant: "outline",
|
|
501
527
|
size: "sm",
|
|
502
528
|
className: "mt-2 h-7 w-full text-[12px]",
|
|
503
|
-
onClick:
|
|
504
|
-
disabled:
|
|
529
|
+
onClick: N,
|
|
530
|
+
disabled: k,
|
|
505
531
|
"data-lock-release": !0,
|
|
506
532
|
children: [
|
|
507
|
-
/* @__PURE__ */
|
|
508
|
-
|
|
533
|
+
/* @__PURE__ */ v(ve, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
534
|
+
k ? "Releasing…" : s.length > 0 ? `Release lock to ${((C = s[0]) == null ? void 0 : C.name) ?? "the next person"}` : "Release lock"
|
|
509
535
|
]
|
|
510
536
|
}
|
|
511
537
|
)
|
|
512
538
|
] })
|
|
513
539
|
] });
|
|
514
540
|
}
|
|
515
|
-
function
|
|
541
|
+
function gt({
|
|
516
542
|
lockHolder: e,
|
|
517
543
|
onTakeOver: t,
|
|
518
544
|
takingOver: s,
|
|
519
|
-
isAdmin:
|
|
520
|
-
onRequestLock:
|
|
521
|
-
requesting:
|
|
545
|
+
isAdmin: N,
|
|
546
|
+
onRequestLock: k,
|
|
547
|
+
requesting: q,
|
|
522
548
|
queue: g,
|
|
523
|
-
myPosition:
|
|
524
|
-
onJoinQueue:
|
|
549
|
+
myPosition: $,
|
|
550
|
+
onJoinQueue: _,
|
|
525
551
|
onLeaveQueue: o,
|
|
526
|
-
joining:
|
|
552
|
+
joining: C,
|
|
527
553
|
noun: c = "this item",
|
|
528
|
-
readOnlyText:
|
|
554
|
+
readOnlyText: y = "fields are read-only"
|
|
529
555
|
}) {
|
|
530
|
-
const [
|
|
531
|
-
if (
|
|
532
|
-
const
|
|
533
|
-
return /* @__PURE__ */
|
|
556
|
+
const [D, R] = S(!1), Y = (e == null ? void 0 : e.locked_by) ?? null;
|
|
557
|
+
if (w(() => R(!1), [Y]), !e) return null;
|
|
558
|
+
const L = e.locked_by_name || "Another user", j = (g == null ? void 0 : g.length) ?? 0;
|
|
559
|
+
return /* @__PURE__ */ x(
|
|
534
560
|
"div",
|
|
535
561
|
{
|
|
536
562
|
className: "mb-4 flex flex-wrap items-center gap-3 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-100",
|
|
537
563
|
"data-lock-banner": !0,
|
|
538
564
|
children: [
|
|
539
|
-
/* @__PURE__ */
|
|
540
|
-
/* @__PURE__ */
|
|
541
|
-
/* @__PURE__ */
|
|
565
|
+
/* @__PURE__ */ v(ue, { className: "h-4 w-4 shrink-0 text-amber-500" }),
|
|
566
|
+
/* @__PURE__ */ x("span", { className: "min-w-0 flex-1", children: [
|
|
567
|
+
/* @__PURE__ */ v("span", { className: "font-medium", children: L }),
|
|
542
568
|
" is editing ",
|
|
543
569
|
c,
|
|
544
570
|
" — ",
|
|
545
|
-
|
|
546
|
-
e.idle_minutes != null && e.idle_minutes >= 2 && /* @__PURE__ */
|
|
571
|
+
y,
|
|
572
|
+
e.idle_minutes != null && e.idle_minutes >= 2 && /* @__PURE__ */ x(
|
|
547
573
|
"span",
|
|
548
574
|
{
|
|
549
575
|
className: "ml-1.5 rounded bg-amber-100 px-1 py-px text-[10px] font-semibold text-amber-700 dark:bg-amber-500/20 dark:text-amber-200",
|
|
@@ -558,19 +584,19 @@ function dt({
|
|
|
558
584
|
),
|
|
559
585
|
" ",
|
|
560
586
|
"until the lock is released.",
|
|
561
|
-
e.note && /* @__PURE__ */
|
|
587
|
+
e.note && /* @__PURE__ */ x("span", { className: "mt-0.5 block text-[12.5px] text-amber-800/90 dark:text-amber-200/90", children: [
|
|
562
588
|
"“",
|
|
563
589
|
e.note,
|
|
564
590
|
"”"
|
|
565
591
|
] }),
|
|
566
|
-
|
|
567
|
-
|
|
592
|
+
j > 0 && $ == null && /* @__PURE__ */ x("span", { className: "mt-0.5 block text-[11.5px] text-amber-700/80 dark:text-amber-300/80", children: [
|
|
593
|
+
j,
|
|
568
594
|
" ",
|
|
569
|
-
|
|
595
|
+
j === 1 ? "person is" : "people are",
|
|
570
596
|
" already waiting."
|
|
571
597
|
] })
|
|
572
598
|
] }),
|
|
573
|
-
|
|
599
|
+
_ && ($ != null ? /* @__PURE__ */ x(
|
|
574
600
|
O,
|
|
575
601
|
{
|
|
576
602
|
size: "sm",
|
|
@@ -580,64 +606,64 @@ function dt({
|
|
|
580
606
|
"data-lock-queue-leave": !0,
|
|
581
607
|
children: [
|
|
582
608
|
"You’re #",
|
|
583
|
-
|
|
609
|
+
$,
|
|
584
610
|
" in line · Leave"
|
|
585
611
|
]
|
|
586
612
|
}
|
|
587
|
-
) : /* @__PURE__ */
|
|
613
|
+
) : /* @__PURE__ */ v(
|
|
588
614
|
O,
|
|
589
615
|
{
|
|
590
616
|
size: "sm",
|
|
591
617
|
variant: "outline",
|
|
592
618
|
className: "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15",
|
|
593
|
-
onClick:
|
|
594
|
-
disabled:
|
|
619
|
+
onClick: _,
|
|
620
|
+
disabled: C,
|
|
595
621
|
"data-lock-queue-join": !0,
|
|
596
|
-
children:
|
|
622
|
+
children: C ? "Joining…" : "Ask to be next"
|
|
597
623
|
}
|
|
598
624
|
)),
|
|
599
|
-
|
|
625
|
+
k && /* @__PURE__ */ v(
|
|
600
626
|
O,
|
|
601
627
|
{
|
|
602
628
|
size: "sm",
|
|
603
629
|
variant: "outline",
|
|
604
630
|
className: "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15",
|
|
605
|
-
onClick:
|
|
606
|
-
disabled:
|
|
607
|
-
children:
|
|
631
|
+
onClick: k,
|
|
632
|
+
disabled: q,
|
|
633
|
+
children: q ? "Asking…" : "Ask them to wrap up"
|
|
608
634
|
}
|
|
609
635
|
),
|
|
610
636
|
// Admins always; other roles only when the server says they may (the
|
|
611
637
|
// takeover-role allowlist, #256) — unknown = offered, and a 403 then
|
|
612
638
|
// hides it. A Take over that can only fail was a dead end.
|
|
613
|
-
(
|
|
639
|
+
(N || e.may_take_over !== !1) && (D ? /* @__PURE__ */ x(
|
|
614
640
|
"span",
|
|
615
641
|
{
|
|
616
642
|
className: "flex basis-full flex-wrap items-center justify-end gap-2 text-[12px] text-amber-800 dark:text-amber-200",
|
|
617
643
|
"data-lock-takeover-confirm": !0,
|
|
618
644
|
children: [
|
|
619
|
-
/* @__PURE__ */
|
|
620
|
-
|
|
645
|
+
/* @__PURE__ */ x("span", { className: "min-w-0 flex-1 text-right", children: [
|
|
646
|
+
L,
|
|
621
647
|
" may have unsaved changes — they can’t save them once you take over."
|
|
622
648
|
] }),
|
|
623
|
-
/* @__PURE__ */
|
|
649
|
+
/* @__PURE__ */ v(
|
|
624
650
|
O,
|
|
625
651
|
{
|
|
626
652
|
size: "sm",
|
|
627
653
|
variant: "outline",
|
|
628
654
|
className: "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15",
|
|
629
|
-
onClick: () =>
|
|
655
|
+
onClick: () => R(!1),
|
|
630
656
|
disabled: s,
|
|
631
657
|
children: "Cancel"
|
|
632
658
|
}
|
|
633
659
|
),
|
|
634
|
-
/* @__PURE__ */
|
|
660
|
+
/* @__PURE__ */ v(
|
|
635
661
|
O,
|
|
636
662
|
{
|
|
637
663
|
size: "sm",
|
|
638
664
|
className: "h-7 shrink-0 bg-amber-600 text-[12px] text-white hover:bg-amber-700",
|
|
639
665
|
onClick: () => {
|
|
640
|
-
|
|
666
|
+
R(!1), t();
|
|
641
667
|
},
|
|
642
668
|
disabled: s,
|
|
643
669
|
"data-lock-takeover-go": !0,
|
|
@@ -646,13 +672,13 @@ function dt({
|
|
|
646
672
|
)
|
|
647
673
|
]
|
|
648
674
|
}
|
|
649
|
-
) : /* @__PURE__ */
|
|
675
|
+
) : /* @__PURE__ */ v(
|
|
650
676
|
O,
|
|
651
677
|
{
|
|
652
678
|
size: "sm",
|
|
653
679
|
variant: "outline",
|
|
654
|
-
className:
|
|
655
|
-
onClick: () =>
|
|
680
|
+
className: N ? "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15" : "h-7 shrink-0 border-amber-200 bg-white/60 text-[12px] text-amber-700/80 hover:bg-amber-100 dark:border-amber-500/30 dark:bg-transparent dark:text-amber-200/80 dark:hover:bg-amber-500/15",
|
|
681
|
+
onClick: () => R(!0),
|
|
656
682
|
disabled: s,
|
|
657
683
|
children: s ? "Taking over…" : "Take over"
|
|
658
684
|
}
|
|
@@ -662,8 +688,9 @@ function dt({
|
|
|
662
688
|
);
|
|
663
689
|
}
|
|
664
690
|
export {
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
691
|
+
gt as ItemLockBanner,
|
|
692
|
+
yt as LockHolderButton,
|
|
693
|
+
tt as TAKEOVER_HOLD_MS,
|
|
694
|
+
Le as takenAwayText,
|
|
695
|
+
vt as useItemLock
|
|
669
696
|
};
|