@nivaro/react 0.3.117 → 0.3.119
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 +136 -14
- package/dist/index.js +488 -485
- package/dist/shared/components/ActivityEntry.js +130 -125
- package/dist/shared/components/AgentPresenceChip.js +36 -26
- package/dist/shared/components/CellCopyLayer.js +50 -45
- package/dist/shared/components/CollectionBrowserView.js +3757 -3695
- package/dist/shared/components/FilePreviewLightbox.js +96 -58
- package/dist/shared/components/InStep.js +18 -17
- package/dist/shared/components/ItemEditForm.js +4451 -4385
- package/dist/shared/components/JobsTray.js +8 -8
- package/dist/shared/components/LiveNewMatchesPill.js +21 -14
- package/dist/shared/components/LiveOffNote.js +3 -2
- package/dist/shared/components/LiveRowMark.js +53 -23
- package/dist/shared/components/LiveTraceView.js +162 -123
- package/dist/shared/components/MyWorkView.js +320 -299
- package/dist/shared/components/NotificationBell.js +14 -14
- package/dist/shared/components/OverflowRail.js +1 -1
- package/dist/shared/components/PageRenderer.js +120 -116
- package/dist/shared/components/ProfileView.js +203 -202
- package/dist/shared/components/RealtimeStatusBanner.js +31 -29
- package/dist/shared/components/RecordDrilldownSheet.js +7 -7
- package/dist/shared/components/RecordHoverCard.js +102 -84
- package/dist/shared/components/RecordReadView.js +146 -146
- package/dist/shared/components/ScreenRefreshButton.js +34 -32
- package/dist/shared/components/TipLayer.js +65 -58
- package/dist/shared/components/WidgetImageMenu.js +83 -43
- package/dist/shared/components/activity/RecordActivityStream.js +175 -173
- package/dist/shared/components/bulk/BulkSelectionNotices.js +142 -119
- package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +158 -143
- package/dist/shared/components/change-proposals/ProposeChangeButton.js +17 -11
- package/dist/shared/components/change-proposals/ProposeChangeDialog.js +201 -173
- package/dist/shared/components/chat/ChatAnalyticsView.js +27 -27
- package/dist/shared/components/chat/HuddleAnalyticsTab.js +17 -17
- package/dist/shared/components/collections-directory/CollectionsToolbar.js +39 -41
- package/dist/shared/components/collections-directory/page-model.js +72 -67
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +48 -56
- package/dist/shared/components/integrations/SendStatus.js +65 -59
- package/dist/shared/components/integrations/console/ReadyToSendView.js +275 -209
- package/dist/shared/components/integrations/console/SignalCard.js +237 -230
- package/dist/shared/components/item-edit/CatalogPickerField.js +227 -205
- package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +135 -94
- package/dist/shared/components/item-edit/CloneDialog.js +191 -161
- package/dist/shared/components/item-edit/DerivedCauseNote.js +44 -30
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +153 -134
- package/dist/shared/components/item-edit/FieldComments.js +88 -85
- package/dist/shared/components/item-edit/FieldPointer.js +82 -67
- package/dist/shared/components/item-edit/FieldRow.js +106 -100
- package/dist/shared/components/item-edit/FieldSourceBadge.js +58 -56
- package/dist/shared/components/item-edit/FilePickerField.js +452 -387
- package/dist/shared/components/item-edit/HeaderSummaryChip.js +78 -56
- package/dist/shared/components/item-edit/HeaderTools.js +245 -141
- package/dist/shared/components/item-edit/InlineTableField.js +1242 -1218
- package/dist/shared/components/item-edit/ListNeighborNav.js +47 -50
- package/dist/shared/components/item-edit/LiveTraceSheet.js +15 -10
- package/dist/shared/components/item-edit/MembershipSetField.js +285 -254
- package/dist/shared/components/item-edit/OutboxReviewTray.js +155 -144
- package/dist/shared/components/item-edit/QueueReturnChip.js +15 -36
- package/dist/shared/components/item-edit/RecalcValue.js +57 -32
- package/dist/shared/components/item-edit/RecordHelpChip.js +15 -16
- package/dist/shared/components/item-edit/RecordLiveSync.js +283 -231
- package/dist/shared/components/item-edit/RelationCombobox.js +439 -393
- package/dist/shared/components/item-edit/RemoteChangeUi.js +292 -224
- package/dist/shared/components/item-edit/RemoteUploads.js +26 -20
- package/dist/shared/components/item-edit/RemovedLineNote.js +77 -67
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +184 -179
- package/dist/shared/components/item-edit/ScheduledChangeChip.js +168 -134
- package/dist/shared/components/item-edit/SectionPresence.js +18 -10
- package/dist/shared/components/item-edit/SplitLinesButton.js +163 -139
- package/dist/shared/components/item-edit/UserChip.js +1 -1
- package/dist/shared/components/item-edit/addendum-view.js +6 -0
- package/dist/shared/components/item-edit/file-live.js +69 -54
- package/dist/shared/components/item-edit/layout-switch.js +98 -89
- package/dist/shared/components/item-edit/partner-needs.js +12 -12
- package/dist/shared/components/item-edit/removed-line.js +31 -25
- package/dist/shared/components/layout-editor/pickers/field-picker.js +151 -130
- package/dist/shared/components/list/ListViewers.js +46 -35
- package/dist/shared/components/notifications/NotificationCenterView.js +479 -437
- package/dist/shared/components/panels/AccessDeniedPanel.js +176 -101
- package/dist/shared/components/panels/AlertBanners.js +82 -72
- package/dist/shared/components/panels/BranchLanes.js +22 -22
- package/dist/shared/components/panels/CommentImages.js +123 -102
- package/dist/shared/components/panels/CommentPanel.js +186 -185
- package/dist/shared/components/panels/ExternalRequestsChip.js +111 -119
- package/dist/shared/components/panels/OwnerOpenedLine.js +31 -24
- package/dist/shared/components/panels/PipelinePanel.js +2037 -1885
- package/dist/shared/components/panels/ResubmissionDiff.js +163 -142
- package/dist/shared/components/pipeline/OwnerMatrixSheet.js +400 -288
- package/dist/shared/components/pipeline/PipelineEditorView.js +7 -2
- package/dist/shared/components/profile/AgentNameField.js +107 -81
- package/dist/shared/components/profile/AgentsPanel.js +184 -184
- package/dist/shared/components/profile/PersonAccess.js +599 -495
- package/dist/shared/components/profile/SignInTroubleshooter.js +160 -127
- package/dist/shared/components/profile/SignedInDevices.js +17 -17
- package/dist/shared/components/profile/primitives.js +1 -1
- package/dist/shared/components/queue/OwnerAvatars.js +91 -54
- package/dist/shared/components/queue/QueueTeamStrip.js +56 -46
- package/dist/shared/components/queue/QueueWorklist.js +1002 -983
- package/dist/shared/components/support/AssignRules.js +1733 -0
- package/dist/shared/components/support/PersonPick.js +88 -0
- package/dist/shared/components/support/RequestList.js +790 -0
- package/dist/shared/components/support/ScreenShare.js +158 -152
- package/dist/shared/components/support/SupportRequestDialog.js +50 -48
- package/dist/shared/components/support/SupportView.js +140 -246
- package/dist/shared/components/support/TicketDetailSheet.js +82 -75
- package/dist/shared/components/support/TicketSlowScreens.js +9 -9
- package/dist/shared/components/support/assign-rules-text.js +171 -0
- package/dist/shared/components/support/support-list.js +125 -0
- package/dist/shared/components/ui/SimpleSelect.js +28 -20
- package/dist/shared/components/ui/checkbox.js +6 -6
- package/dist/shared/components/ui/select.js +43 -39
- package/dist/shared/components/ui/sheet.js +9 -9
- package/dist/shared/components/ui/switch.js +12 -11
- package/dist/shared/components/watch-list/WatchDock.js +532 -459
- package/dist/shared/components/watch-list/WatchExtras.js +332 -286
- package/dist/shared/components/watch-list/WatchRows.js +164 -140
- package/dist/shared/lib/activity-sentence.js +103 -91
- package/dist/shared/lib/agent-presence.js +27 -21
- package/dist/shared/lib/approval-progress.js +2 -2
- package/dist/shared/lib/copy-rules.js +31 -24
- package/dist/shared/lib/derived-causes.js +113 -78
- package/dist/shared/lib/grid-cursors.js +26 -26
- package/dist/shared/lib/label-flash.js +27 -0
- package/dist/shared/lib/list-return.js +137 -125
- package/dist/shared/lib/live-deltas.js +40 -34
- package/dist/shared/lib/live-groups.js +56 -52
- package/dist/shared/lib/live-preference.js +64 -59
- package/dist/shared/lib/live-screen.js +223 -192
- package/dist/shared/lib/partner-failure.js +11 -11
- package/dist/shared/lib/rollup-recalc.js +68 -64
- package/dist/shared/lib/screen-refresh.js +74 -68
- package/dist/shared/lib/screen-share.js +108 -104
- package/dist/shared/lib/send-status.js +77 -61
- package/dist/shared/lib/text-diff-window.js +29 -0
- package/dist/shared/lib/watch-list.js +210 -209
- package/dist/shared/lib/widget-image-render.js +72 -49
- package/package.json +1 -1
|
@@ -1,244 +1,278 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { CalendarCheck as
|
|
4
|
-
import { useMemo as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
1
|
+
import { jsxs as l, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as F, useQuery as L, useMutation as S } from "@tanstack/react-query";
|
|
3
|
+
import { CalendarCheck as B, CalendarX as H, Loader2 as K, CalendarClock as Q, AlertCircle as V } from "lucide-react";
|
|
4
|
+
import { useMemo as P, useState as O, useId as j } from "react";
|
|
5
|
+
import { useNivaroClient as M } from "../../context.js";
|
|
6
|
+
import { get as W, del as G, patch as X, post as Y } from "../../lib/commands.js";
|
|
7
7
|
import { useDeadlineNow as z } from "../../lib/deadline-ticker.js";
|
|
8
|
-
import { toastError as
|
|
9
|
-
import { useLiveRecord as
|
|
10
|
-
import { readableRecent as
|
|
11
|
-
import { cn as
|
|
12
|
-
import { ConfirmButton as
|
|
13
|
-
import { Input as
|
|
14
|
-
import { Popover as
|
|
15
|
-
import { formatDisplayValue as
|
|
16
|
-
function
|
|
8
|
+
import { toastError as T } from "../../lib/error-toast.js";
|
|
9
|
+
import { useLiveRecord as J, batchTouches as Z, LIVE_ASPECTS as ee } from "../../lib/live.js";
|
|
10
|
+
import { readableRecent as te, chipOf as ae, whenText as b, countdownPart as _, fullSentence as ne, changeSentence as re, isDue as de } from "../../lib/scheduled-countdown.js";
|
|
11
|
+
import { cn as R, titleCase as se } from "../../lib/utils.js";
|
|
12
|
+
import { ConfirmButton as I } from "../profile/primitives.js";
|
|
13
|
+
import { Input as ie } from "../ui/input.js";
|
|
14
|
+
import { Popover as le, PopoverTrigger as oe, PopoverContent as ce } from "../ui/popover.js";
|
|
15
|
+
import { formatDisplayValue as ue } from "./GroupSection.js";
|
|
16
|
+
function me(e, t) {
|
|
17
17
|
return ["scheduled-changes", e, t, "recent"];
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function A(e) {
|
|
20
20
|
const t = new Date(e);
|
|
21
21
|
if (Number.isNaN(t.getTime())) return "";
|
|
22
|
-
const
|
|
23
|
-
return `${t.getFullYear()}-${
|
|
22
|
+
const r = (i) => String(i).padStart(2, "0");
|
|
23
|
+
return `${t.getFullYear()}-${r(t.getMonth() + 1)}-${r(t.getDate())}T${r(t.getHours())}:${r(t.getMinutes())}`;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
function pe() {
|
|
26
|
+
const e = new Date(Date.now() + 18e5);
|
|
27
|
+
return e.setMinutes(0, 0, 0), e.setHours(e.getHours() + 1), e.toISOString();
|
|
28
|
+
}
|
|
29
|
+
const he = {
|
|
26
30
|
pending: "border-slate-200 bg-slate-50 text-slate-600 hover:bg-slate-100 dark:border-border dark:bg-muted dark:text-slate-300 dark:hover:bg-muted/70",
|
|
27
31
|
applying: "border-sky-200 bg-sky-50 text-sky-800 hover:bg-sky-100 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-300 dark:hover:bg-sky-500/15",
|
|
28
32
|
"waiting-admin": "border-amber-200 bg-amber-50 text-amber-800 hover:bg-amber-100 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300 dark:hover:bg-amber-500/15",
|
|
29
33
|
applied: "border-emerald-200 bg-emerald-50 text-emerald-700 hover:bg-emerald-100 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-400 dark:hover:bg-emerald-500/15",
|
|
30
34
|
failed: "border-red-200 bg-red-50 text-red-700 hover:bg-red-100 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-400 dark:hover:bg-red-500/15"
|
|
31
35
|
};
|
|
32
|
-
function
|
|
36
|
+
function Ae({
|
|
33
37
|
collection: e,
|
|
34
38
|
itemId: t,
|
|
35
|
-
fields:
|
|
36
|
-
relations:
|
|
39
|
+
fields: r,
|
|
40
|
+
relations: i
|
|
37
41
|
}) {
|
|
38
|
-
const
|
|
39
|
-
queryKey:
|
|
40
|
-
queryFn: () =>
|
|
41
|
-
|
|
42
|
+
const m = M(), g = F(), k = me(e, t), { data: x } = L({
|
|
43
|
+
queryKey: k,
|
|
44
|
+
queryFn: () => m.request(
|
|
45
|
+
W(`/scheduled-changes/${e}/${encodeURIComponent(t)}`, {
|
|
42
46
|
status: "recent"
|
|
43
47
|
})
|
|
44
48
|
).then((a) => a.data ?? []).catch(() => []),
|
|
45
49
|
staleTime: 6e4
|
|
46
50
|
});
|
|
47
|
-
|
|
51
|
+
J(
|
|
48
52
|
e,
|
|
49
53
|
t,
|
|
50
54
|
(a) => {
|
|
51
|
-
|
|
55
|
+
Z(a, ee.scheduled) && g.invalidateQueries({ queryKey: k });
|
|
52
56
|
},
|
|
53
57
|
{ includeOwn: !0, debounceMs: 300 }
|
|
54
58
|
);
|
|
55
|
-
const
|
|
56
|
-
(
|
|
57
|
-
),
|
|
58
|
-
var
|
|
59
|
-
return ((
|
|
60
|
-
},
|
|
61
|
-
if (!
|
|
62
|
-
const { kind: s, row:
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
const u = P(() => te(x, r), [x, r]), p = z(u.length > 0), [c, f] = O(!1), y = P(() => new Map((r ?? []).map((a) => [a.field, a])), [r]), v = (a) => (i ?? []).some(
|
|
60
|
+
(h) => h.many_collection === e && h.many_field === a && !h.junction_field
|
|
61
|
+
), C = (a) => {
|
|
62
|
+
var h;
|
|
63
|
+
return ((h = y.get(a)) == null ? void 0 : h.label) || se(a.replace(/_/g, " "));
|
|
64
|
+
}, $ = (a, h) => v(a) ? "a new value" : ue(h, y.get(a)), d = (a) => re(a.changes ?? {}, C, $), w = ae(u, p);
|
|
65
|
+
if (!w) return null;
|
|
66
|
+
const { kind: s, row: o } = w, U = u.filter((a) => a.status === "pending" || a.status === "applying").length, D = s === "pending" || s === "applying" ? U - 1 : 0, q = s === "applied" ? B : s === "failed" ? H : s === "applying" ? K : Q, E = s === "pending" ? `${d(o)} · Applies at ${b(o.scheduled_at, p)} (${_(o.scheduled_at, p)})` : s === "applying" ? `${d(o)} · Applying now…` : s === "waiting-admin" ? `${d(o)} · ${_(o.scheduled_at, p)}, waiting for an administrator` : s === "applied" ? `Applied: ${d(o)}` : (
|
|
67
|
+
// One word for this state in the chip and the popover: "Not applied".
|
|
68
|
+
`Not applied: ${d(o)}`
|
|
69
|
+
);
|
|
70
|
+
return /* @__PURE__ */ l(le, { open: c, onOpenChange: f, children: [
|
|
71
|
+
/* @__PURE__ */ n(oe, { asChild: !0, children: /* @__PURE__ */ l(
|
|
65
72
|
"button",
|
|
66
73
|
{
|
|
67
74
|
type: "button",
|
|
68
75
|
"data-scheduled-chip": !0,
|
|
69
76
|
"data-kind": s,
|
|
70
77
|
"aria-live": "polite",
|
|
71
|
-
"data-tip": s === "pending" ?
|
|
72
|
-
className:
|
|
73
|
-
"inline-flex max-w-
|
|
74
|
-
|
|
78
|
+
"data-tip": s === "pending" ? ne(d(o), b(o.scheduled_at, p), o.created_by_name) : s === "failed" ? `${d(o)} — not applied: ${o.error_message ?? ""}` : void 0,
|
|
79
|
+
className: R(
|
|
80
|
+
"inline-flex max-w-full items-start gap-1 rounded-[9px] border px-1.5 py-px text-left text-[9.5px] font-medium leading-[14px] transition-colors duration-300 sm:max-w-[420px]",
|
|
81
|
+
he[s]
|
|
75
82
|
),
|
|
76
83
|
children: [
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
|
|
84
|
+
/* @__PURE__ */ n(
|
|
85
|
+
q,
|
|
79
86
|
{
|
|
80
87
|
"aria-hidden": !0,
|
|
81
|
-
className:
|
|
82
|
-
"h-2.5 w-2.5 shrink-0",
|
|
88
|
+
className: R(
|
|
89
|
+
"mt-[2px] h-2.5 w-2.5 shrink-0",
|
|
83
90
|
s === "pending" && "text-nvr-cyan",
|
|
84
91
|
s === "applying" && "motion-safe:animate-spin"
|
|
85
92
|
)
|
|
86
93
|
}
|
|
87
94
|
),
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
|
|
95
|
+
/* @__PURE__ */ n("span", { className: "min-w-0 tabular-nums [overflow-wrap:anywhere]", children: E }),
|
|
96
|
+
D > 0 && /* @__PURE__ */ l("span", { className: "shrink-0 opacity-70", children: [
|
|
90
97
|
"+",
|
|
91
|
-
|
|
98
|
+
D
|
|
92
99
|
] })
|
|
93
100
|
]
|
|
94
101
|
}
|
|
95
102
|
) }),
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
/* @__PURE__ */ l(
|
|
104
|
+
ce,
|
|
105
|
+
{
|
|
106
|
+
align: "start",
|
|
107
|
+
collisionPadding: 16,
|
|
108
|
+
className: "w-[min(340px,calc(100vw-2rem))] p-0",
|
|
109
|
+
"data-scheduled-panel": !0,
|
|
110
|
+
children: [
|
|
111
|
+
/* @__PURE__ */ n("div", { className: "border-b border-slate-100 px-3 py-2 dark:border-border", children: /* @__PURE__ */ n("p", { className: "text-[12.5px] font-semibold text-slate-800 dark:text-slate-100", children: u.length === 1 ? "Scheduled change" : `${u.length} scheduled changes` }) }),
|
|
112
|
+
/* @__PURE__ */ n("ul", { className: "max-h-[320px] divide-y divide-slate-100 overflow-y-auto dark:divide-border", children: u.map((a) => /* @__PURE__ */ n(
|
|
113
|
+
fe,
|
|
114
|
+
{
|
|
115
|
+
row: a,
|
|
116
|
+
now: p,
|
|
117
|
+
sentence: d(a),
|
|
118
|
+
onChanged: () => void g.invalidateQueries({ queryKey: k })
|
|
119
|
+
},
|
|
120
|
+
a.id
|
|
121
|
+
)) })
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
)
|
|
109
125
|
] });
|
|
110
126
|
}
|
|
111
|
-
function
|
|
112
|
-
const
|
|
113
|
-
if (
|
|
114
|
-
const
|
|
115
|
-
return /* @__PURE__ */
|
|
127
|
+
function ge({ row: e, now: t }) {
|
|
128
|
+
const r = e.status ?? "pending", i = e.executed_at ? b(e.executed_at, t) : null;
|
|
129
|
+
if (r === "pending" || r === "applying") {
|
|
130
|
+
const m = de(e.scheduled_at, t), g = r === "applying" || m && e.auto_apply !== !1 ? `${b(e.scheduled_at, t)} · applying now…` : m ? `${b(e.scheduled_at, t)} · ${_(e.scheduled_at, t)} — waiting for an administrator` : `Applies at ${b(e.scheduled_at, t)} · ${_(e.scheduled_at, t)}`;
|
|
131
|
+
return /* @__PURE__ */ n(
|
|
116
132
|
"p",
|
|
117
133
|
{
|
|
118
|
-
className:
|
|
134
|
+
className: R(
|
|
119
135
|
"mt-0.5 text-[11.5px] tabular-nums",
|
|
120
|
-
|
|
136
|
+
m && e.auto_apply === !1 ? "text-amber-700 dark:text-amber-300" : "text-slate-500 dark:text-slate-400"
|
|
121
137
|
),
|
|
122
|
-
children:
|
|
138
|
+
children: g
|
|
123
139
|
}
|
|
124
140
|
);
|
|
125
141
|
}
|
|
126
|
-
return
|
|
142
|
+
return r === "executed" ? /* @__PURE__ */ l("p", { className: "mt-0.5 text-[11.5px] tabular-nums text-emerald-700 dark:text-emerald-400", children: [
|
|
127
143
|
"Applied",
|
|
128
|
-
|
|
144
|
+
i ? ` at ${i}` : "",
|
|
129
145
|
e.applied_on_time === !1 ? " by an administrator" : ""
|
|
130
|
-
] }) :
|
|
131
|
-
"
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
146
|
+
] }) : r === "failed" ? /* @__PURE__ */ l("div", { className: "mt-1 flex items-start gap-1.5 text-[11.5px] leading-snug", children: [
|
|
147
|
+
/* @__PURE__ */ n(V, { "aria-hidden": !0, className: "mt-px h-3.5 w-3.5 shrink-0 text-red-500" }),
|
|
148
|
+
/* @__PURE__ */ l("p", { className: "text-slate-600 dark:text-slate-300", children: [
|
|
149
|
+
/* @__PURE__ */ n("span", { className: "font-medium text-red-700 dark:text-red-400", children: "Not applied" }),
|
|
150
|
+
i ? ` (${i})` : "",
|
|
151
|
+
" — ",
|
|
152
|
+
e.error_message || "it was refused",
|
|
153
|
+
". Nothing on the record was changed."
|
|
154
|
+
] })
|
|
155
|
+
] }) : /* @__PURE__ */ l("p", { className: "mt-0.5 text-[11.5px] tabular-nums text-slate-500 dark:text-slate-400", children: [
|
|
137
156
|
"Undone",
|
|
138
|
-
|
|
157
|
+
i ? ` at ${i}` : ""
|
|
139
158
|
] });
|
|
140
159
|
}
|
|
141
|
-
const
|
|
142
|
-
function
|
|
160
|
+
const N = "inline-flex h-7 items-center rounded-md border border-slate-200 bg-white px-2.5 text-[11.5px] font-medium text-slate-700 transition-colors hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:opacity-50 dark:border-border dark:bg-transparent dark:text-slate-200 dark:hover:bg-muted", be = "inline-flex h-7 items-center rounded-md border border-red-200 bg-white px-2.5 text-[11.5px] font-medium text-red-700 transition-colors hover:bg-red-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-400 disabled:opacity-50 dark:border-red-500/40 dark:bg-transparent dark:text-red-400 dark:hover:bg-red-500/10", xe = "inline-flex h-7 items-center rounded-md border border-red-600 bg-red-600 px-2.5 text-[11.5px] font-medium text-white transition-colors hover:bg-red-700 dark:border-red-500 dark:bg-red-500/90";
|
|
161
|
+
function fe({
|
|
143
162
|
row: e,
|
|
144
163
|
now: t,
|
|
145
|
-
sentence:
|
|
146
|
-
onChanged:
|
|
164
|
+
sentence: r,
|
|
165
|
+
onChanged: i
|
|
147
166
|
}) {
|
|
148
|
-
const
|
|
149
|
-
mutationFn: () =>
|
|
150
|
-
onSuccess:
|
|
151
|
-
onError: (
|
|
152
|
-
}), y =
|
|
153
|
-
mutationFn: () =>
|
|
167
|
+
const m = M(), g = j(), [k, x] = O(!1), [u, p] = O(() => A(e.scheduled_at)), c = e.status ?? "pending", f = S({
|
|
168
|
+
mutationFn: () => m.request(G(`/scheduled-changes/${encodeURIComponent(e.id)}`)),
|
|
169
|
+
onSuccess: i,
|
|
170
|
+
onError: (d) => T(d, c === "failed" ? "Could not dismiss it" : "Could not cancel the change")
|
|
171
|
+
}), y = S({
|
|
172
|
+
mutationFn: () => m.request(
|
|
154
173
|
X(`/scheduled-changes/${encodeURIComponent(e.id)}`, {
|
|
155
174
|
// datetime-local is the viewer's local time; the API stores UTC.
|
|
156
|
-
scheduled_at: new Date(
|
|
175
|
+
scheduled_at: new Date(u).toISOString()
|
|
157
176
|
})
|
|
158
177
|
),
|
|
159
178
|
onSuccess: () => {
|
|
160
|
-
x(!1),
|
|
179
|
+
x(!1), i();
|
|
161
180
|
},
|
|
162
|
-
onError: (
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
181
|
+
onError: (d) => T(
|
|
182
|
+
d,
|
|
183
|
+
c === "failed" ? "Could not schedule it again" : "Could not move the change"
|
|
184
|
+
)
|
|
185
|
+
}), v = S({
|
|
186
|
+
mutationFn: () => m.request(Y(`/scheduled-changes/${encodeURIComponent(e.id)}/undo`, {})),
|
|
187
|
+
onSuccess: i,
|
|
188
|
+
onError: (d) => T(d, "Could not undo the change")
|
|
189
|
+
}), C = u !== "" && !Number.isNaN(new Date(u).getTime()), $ = c === "executed" && e.can_undo === !0 && !!e.undo_until && new Date(e.undo_until).getTime() > t;
|
|
190
|
+
return /* @__PURE__ */ l("li", { className: "px-3 py-2.5", "data-scheduled-row": e.id, "data-status": c, children: [
|
|
191
|
+
/* @__PURE__ */ n("p", { className: "text-[12.5px] font-medium leading-snug text-slate-800 dark:text-slate-100", children: r }),
|
|
192
|
+
/* @__PURE__ */ n(ge, { row: e, now: t }),
|
|
193
|
+
e.created_by_name && /* @__PURE__ */ l("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: [
|
|
172
194
|
"Scheduled by ",
|
|
173
195
|
e.created_by_name
|
|
174
196
|
] }),
|
|
175
|
-
e.can_manage &&
|
|
176
|
-
/* @__PURE__ */
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
|
|
197
|
+
e.can_manage && (c === "pending" || c === "failed") && (k ? /* @__PURE__ */ l("div", { className: "mt-2 flex items-center gap-1.5", children: [
|
|
198
|
+
/* @__PURE__ */ n("label", { htmlFor: g, className: "sr-only", children: c === "failed" ? "Try again at" : "New time" }),
|
|
199
|
+
/* @__PURE__ */ n(
|
|
200
|
+
ie,
|
|
179
201
|
{
|
|
180
|
-
id:
|
|
202
|
+
id: g,
|
|
181
203
|
type: "datetime-local",
|
|
182
|
-
value:
|
|
183
|
-
onChange: (
|
|
204
|
+
value: u,
|
|
205
|
+
onChange: (d) => p(d.target.value),
|
|
184
206
|
className: "h-7 flex-1 text-[12px]"
|
|
185
207
|
}
|
|
186
208
|
),
|
|
187
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ n(
|
|
188
210
|
"button",
|
|
189
211
|
{
|
|
190
212
|
type: "button",
|
|
191
|
-
disabled: !
|
|
213
|
+
disabled: !C || y.isPending,
|
|
192
214
|
onClick: () => y.mutate(),
|
|
193
215
|
className: "h-7 rounded-md bg-nvr-cyan px-2.5 text-[11.5px] font-medium text-white disabled:opacity-50",
|
|
194
216
|
children: "Save"
|
|
195
217
|
}
|
|
196
218
|
),
|
|
197
|
-
/* @__PURE__ */
|
|
219
|
+
/* @__PURE__ */ n("button", { type: "button", onClick: () => x(!1), className: N, children: "Back" })
|
|
220
|
+
] }) : /* @__PURE__ */ l("div", { className: "mt-2 flex flex-wrap items-center gap-1.5", children: [
|
|
221
|
+
/* @__PURE__ */ n(
|
|
198
222
|
"button",
|
|
199
223
|
{
|
|
200
224
|
type: "button",
|
|
201
|
-
onClick: () =>
|
|
202
|
-
|
|
203
|
-
|
|
225
|
+
onClick: () => {
|
|
226
|
+
c === "failed" && p(A(pe())), x(!0);
|
|
227
|
+
},
|
|
228
|
+
className: N,
|
|
229
|
+
children: c === "failed" ? "Reschedule…" : "Move…"
|
|
204
230
|
}
|
|
205
|
-
)
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
231
|
+
),
|
|
232
|
+
c === "failed" ? /* @__PURE__ */ n(
|
|
233
|
+
"button",
|
|
234
|
+
{
|
|
235
|
+
type: "button",
|
|
236
|
+
onClick: () => f.mutate(),
|
|
237
|
+
disabled: f.isPending,
|
|
238
|
+
"data-tip": "Take this off the record header. Nothing on the record changes.",
|
|
239
|
+
className: N,
|
|
240
|
+
children: "Dismiss"
|
|
241
|
+
}
|
|
242
|
+
) : /* @__PURE__ */ n(
|
|
243
|
+
I,
|
|
210
244
|
{
|
|
211
|
-
onConfirm: () =>
|
|
212
|
-
disabled:
|
|
245
|
+
onConfirm: () => f.mutate(),
|
|
246
|
+
disabled: f.isPending,
|
|
213
247
|
title: "Cancel this change",
|
|
214
248
|
confirmLabel: "Cancel it?",
|
|
215
|
-
className:
|
|
216
|
-
armedClassName:
|
|
249
|
+
className: be,
|
|
250
|
+
armedClassName: xe,
|
|
217
251
|
children: "Cancel change"
|
|
218
252
|
}
|
|
219
253
|
)
|
|
220
254
|
] })),
|
|
221
|
-
|
|
222
|
-
/* @__PURE__ */
|
|
223
|
-
|
|
255
|
+
$ && /* @__PURE__ */ l("div", { className: "mt-2 flex flex-wrap items-center gap-2", children: [
|
|
256
|
+
/* @__PURE__ */ n(
|
|
257
|
+
I,
|
|
224
258
|
{
|
|
225
259
|
onConfirm: () => v.mutate(),
|
|
226
260
|
disabled: v.isPending,
|
|
227
261
|
title: "Put back the values this change replaced",
|
|
228
262
|
confirmLabel: "Undo it?",
|
|
229
|
-
className:
|
|
230
|
-
armedClassName: "rounded
|
|
263
|
+
className: N,
|
|
264
|
+
armedClassName: "inline-flex h-7 items-center rounded-md border border-amber-300 bg-amber-50 px-2.5 text-[11.5px] font-medium text-amber-900 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-200",
|
|
231
265
|
children: "Undo"
|
|
232
266
|
}
|
|
233
267
|
),
|
|
234
|
-
/* @__PURE__ */
|
|
235
|
-
"until ",
|
|
236
|
-
|
|
268
|
+
/* @__PURE__ */ l("span", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: [
|
|
269
|
+
"Possible until ",
|
|
270
|
+
b(e.undo_until, t)
|
|
237
271
|
] })
|
|
238
272
|
] })
|
|
239
273
|
] });
|
|
240
274
|
}
|
|
241
275
|
export {
|
|
242
|
-
|
|
243
|
-
|
|
276
|
+
Ae as ScheduledChangeChip,
|
|
277
|
+
me as scheduledChangesKey
|
|
244
278
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as a, jsxs as c } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { useFieldEditors as
|
|
2
|
+
import { useMemo as x } from "react";
|
|
3
|
+
import { useFieldEditors as g, sectionPresence as u, sectionPresenceText as b } from "../../lib/co-edit.js";
|
|
4
4
|
import { cursorColor as k } from "../../lib/grid-cursors.js";
|
|
5
5
|
function w(t) {
|
|
6
6
|
return t.split(/\s+/).filter(Boolean).map((i) => i[0]).join("").slice(0, 2).toUpperCase() || "?";
|
|
@@ -28,7 +28,7 @@ function v({
|
|
|
28
28
|
relations: h,
|
|
29
29
|
label: f
|
|
30
30
|
}) {
|
|
31
|
-
const o =
|
|
31
|
+
const o = g(t, i), p = Object.keys(o).length > 0, e = x(() => {
|
|
32
32
|
if (!p) return [];
|
|
33
33
|
const r = new Set(m.map((n) => n.field)), s = new Set(
|
|
34
34
|
h.filter(
|
|
@@ -50,21 +50,29 @@ function v({
|
|
|
50
50
|
children: [
|
|
51
51
|
/* @__PURE__ */ c("span", { className: "flex items-center pl-1", "aria-hidden": !0, children: [
|
|
52
52
|
l.map((r, s) => (
|
|
53
|
-
//
|
|
53
|
+
// Each later face sits ON TOP of the one before, overlapping only 4 px of its 20 —
|
|
54
|
+
// the 2 px surface-coloured ring cuts it out, so every pair of initials stays whole.
|
|
54
55
|
/* @__PURE__ */ a(
|
|
55
56
|
"span",
|
|
56
57
|
{
|
|
57
|
-
className: s > 0 ? "-ml-1
|
|
58
|
-
style: { zIndex:
|
|
58
|
+
className: s > 0 ? "-ml-1 flex" : "flex",
|
|
59
|
+
style: { zIndex: s + 1, position: "relative" },
|
|
59
60
|
children: /* @__PURE__ */ a(y, { person: r, size: 20 })
|
|
60
61
|
},
|
|
61
62
|
r.id
|
|
62
63
|
)
|
|
63
64
|
)),
|
|
64
|
-
e.length > l.length && /* @__PURE__ */ c(
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
e.length > l.length && /* @__PURE__ */ c(
|
|
66
|
+
"span",
|
|
67
|
+
{
|
|
68
|
+
style: { zIndex: l.length + 1 },
|
|
69
|
+
className: "relative -ml-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-slate-100 px-1 text-[9px] font-semibold text-slate-600 ring-2 ring-white dark:bg-slate-700 dark:text-slate-200 dark:ring-card",
|
|
70
|
+
children: [
|
|
71
|
+
"+",
|
|
72
|
+
e.length - l.length
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
)
|
|
68
76
|
] }),
|
|
69
77
|
/* @__PURE__ */ a("span", { "aria-hidden": !0, className: "hidden text-[11px] text-slate-500 sm:inline dark:text-slate-400", children: e.length === 1 ? `${e[0].name} is here` : e.length === 2 ? `${e[0].name.split(" ")[0]} and ${e[1].name.split(" ")[0]} are here` : `${e.length} people here` })
|
|
70
78
|
]
|