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