@nivaro/react 0.3.45 → 0.3.47
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 +290 -23
- package/dist/index.js +679 -659
- package/dist/shared/components/BaseMap.js +149 -103
- package/dist/shared/components/CollectionBrowserView.js +813 -826
- package/dist/shared/components/ErrorNotice.js +169 -0
- package/dist/shared/components/ErrorSurface.js +23 -17
- package/dist/shared/components/ListLoadError.js +8 -29
- package/dist/shared/components/LoadErrorNote.js +38 -21
- package/dist/shared/components/QueryErrorState.js +8 -11
- package/dist/shared/components/ReportView.js +1320 -1291
- package/dist/shared/components/chat/ChannelArchive.js +60 -60
- package/dist/shared/components/chat/ChannelExtras.js +74 -74
- package/dist/shared/components/chat/ChatPanel.js +368 -367
- package/dist/shared/components/command-center/CommandCenterView.js +313 -69
- package/dist/shared/components/command-center/Customize.js +353 -0
- package/dist/shared/components/command-center/Header.js +279 -53
- package/dist/shared/components/command-center/KioskLinks.js +198 -0
- package/dist/shared/components/command-center/PeekPanel.js +144 -3
- package/dist/shared/components/command-center/announce.js +13 -0
- package/dist/shared/components/command-center/board-prefs.js +99 -0
- package/dist/shared/components/command-center/freshness.js +29 -0
- package/dist/shared/components/command-center/layout.js +56 -0
- package/dist/shared/components/command-center/panels/AttentionPanel.js +132 -3
- package/dist/shared/components/command-center/panels/Banner.js +75 -0
- package/dist/shared/components/command-center/panels/BoardSettings.js +224 -0
- package/dist/shared/components/command-center/panels/FeedPanel.js +145 -29
- package/dist/shared/components/command-center/panels/FlowPanel.js +154 -56
- package/dist/shared/components/command-center/panels/ForecastPanel.js +244 -3
- package/dist/shared/components/command-center/panels/MapLegend.js +266 -0
- package/dist/shared/components/command-center/panels/MapPanel.js +216 -66
- package/dist/shared/components/command-center/panels/PartnersPanel.js +49 -3
- package/dist/shared/components/command-center/panels/PeoplePanel.js +258 -40
- package/dist/shared/components/command-center/panels/RegionPicker.js +88 -3
- package/dist/shared/components/command-center/panels/SystemPanel.js +158 -38
- package/dist/shared/components/command-center/panels/ThroughputPanel.js +307 -3
- package/dist/shared/components/command-center/panels/TimeBar.js +227 -6
- package/dist/shared/components/command-center/panels/TrafficPanel.js +12 -8
- package/dist/shared/components/command-center/panels/WorkloadPanel.js +82 -3
- package/dist/shared/components/command-center/panels/attention-actions.js +267 -0
- package/dist/shared/components/command-center/panels/map-shared.js +95 -0
- package/dist/shared/components/command-center/panels/registry.js +87 -19
- package/dist/shared/components/command-center/shell-hooks.js +118 -0
- package/dist/shared/components/command-center/shortcuts.js +37 -0
- package/dist/shared/components/command-center/theme.js +39 -21
- package/dist/shared/components/command-center/time.js +52 -0
- package/dist/shared/components/command-center/url-state.js +54 -0
- package/dist/shared/components/command-center/work-links.js +32 -0
- package/dist/shared/components/help-videos/editor/ClipsPanel.js +49 -48
- package/dist/shared/components/help-videos/editor/PublishButton.js +37 -36
- package/dist/shared/components/help-videos/editor/StatsTab.js +45 -44
- package/dist/shared/components/help-videos/editor/VersionsTab.js +29 -28
- package/dist/shared/components/help-videos/library/AuthorRolesButton.js +19 -18
- package/dist/shared/components/help-videos/library/HelpVideoLibrary.js +132 -129
- package/dist/shared/components/help-videos/library/LearningPathsPanel.js +42 -41
- package/dist/shared/components/help-videos/settings/HouseStyleButton.js +21 -20
- package/dist/shared/components/help-videos/settings/RenderSettingsButton.js +22 -21
- package/dist/shared/components/import/DocumentAutofillButton.js +24 -20
- package/dist/shared/components/import/ImportFromFileButton.js +61 -60
- package/dist/shared/components/imports/ImportStalenessControl.js +20 -21
- package/dist/shared/components/imports/NewImportDialog.js +29 -28
- package/dist/shared/components/imports/RunDetailSheet.js +63 -63
- package/dist/shared/components/item-edit/FieldRow.js +329 -329
- package/dist/shared/components/item-edit/InlineTableField.js +898 -898
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +57 -56
- package/dist/shared/components/item-edit/PlanGrid.js +220 -221
- package/dist/shared/components/item-edit/RecordGrantTools.js +49 -48
- package/dist/shared/components/item-edit/placement-behaviour.js +68 -67
- package/dist/shared/components/layout-editor/inspector/ColumnFit.js +24 -23
- package/dist/shared/components/layout-editor/inspector/PickerPreview.js +17 -16
- package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +41 -41
- package/dist/shared/components/layout-editor/outputs/output-api.js +33 -31
- package/dist/shared/components/layout-editor/overview/overview-api.js +84 -83
- package/dist/shared/components/layout-editor/useLayoutDraft.js +47 -42
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +10 -9
- package/dist/shared/components/monitoring/TrafficMiniMap.js +111 -70
- package/dist/shared/components/panels/SlaClock.js +35 -36
- package/dist/shared/components/pipeline/PipelineEditorView.js +311 -312
- package/dist/shared/components/pipeline/TeamSuggestions.js +31 -30
- package/dist/shared/components/profile/AgentsPanel.js +73 -72
- package/dist/shared/components/profile/MailSuppressedPill.js +22 -21
- package/dist/shared/components/support/SupportRequestDialog.js +85 -81
- package/dist/shared/components/support/SupportView.js +94 -87
- package/dist/shared/lib/autofill-poll.js +21 -18
- package/dist/shared/lib/error-actions.js +85 -0
- package/dist/shared/lib/error-message.js +223 -82
- package/dist/shared/lib/error-toast.js +71 -13
- package/dist/shared/lib/safe-error.js +136 -38
- package/package.json +1 -1
|
@@ -1,70 +1,296 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { jsxs as r, jsx as e, Fragment as x } from "react/jsx-runtime";
|
|
2
|
+
import { Tv as g, Minimize2 as w, Maximize2 as N, SlidersHorizontal as y, RefreshCw as C, AlertOctagon as k, Clock as T, Bookmark as _, Check as S, Link2 as $, Keyboard as L } from "lucide-react";
|
|
3
|
+
import { useState as F } from "react";
|
|
4
|
+
import { DropdownMenu as M, DropdownMenuTrigger as V, DropdownMenuContent as A, DropdownMenuItem as b } from "../ui/dropdown-menu.js";
|
|
5
|
+
import { Popover as B, PopoverTrigger as O, PopoverContent as R } from "../ui/popover.js";
|
|
6
|
+
import { applySavedView as z } from "./Customize.js";
|
|
7
|
+
import { freshness as D } from "./freshness.js";
|
|
8
|
+
import { RegionPicker as K } from "./panels/RegionPicker.js";
|
|
9
|
+
import { SystemPill as P } from "./panels/SystemPanel.js";
|
|
10
|
+
import { TimeBar as I, BriefButton as U } from "./panels/TimeBar.js";
|
|
11
|
+
import { useNow as H } from "./shell-hooks.js";
|
|
12
|
+
import { SHORTCUTS as j } from "./shortcuts.js";
|
|
13
|
+
import { useCc as m } from "./state.js";
|
|
14
|
+
import { FAINT as h, SKELETON as p, FOCUS as u, ICON_BUTTON as o, ccVars as v } from "./theme.js";
|
|
15
|
+
import { currentViewUrl as E } from "./url-state.js";
|
|
16
|
+
function me({
|
|
17
|
+
helpOpen: t,
|
|
18
|
+
onHelpOpenChange: s,
|
|
19
|
+
kioskLabel: n
|
|
20
|
+
}) {
|
|
21
|
+
const a = m(), i = a.snapshot, l = i == null ? void 0 : i.throughput, c = l ? l.transitions_today - l.transitions_yesterday_same_time : 0, d = !!a.kiosk;
|
|
22
|
+
return /* @__PURE__ */ r("header", { className: "flex shrink-0 flex-wrap items-center gap-x-4 gap-y-2", children: [
|
|
23
|
+
/* @__PURE__ */ r("h1", { className: "text-[16px] font-semibold tracking-[-0.01em] text-[var(--cc-strong)]", children: [
|
|
24
|
+
"Command Center",
|
|
25
|
+
n && /* @__PURE__ */ e("span", { className: "ml-2 text-[13px] font-normal text-[var(--cc-muted)]", children: n })
|
|
22
26
|
] }),
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
27
|
+
/* @__PURE__ */ e(K, {}),
|
|
28
|
+
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-1 text-[12.5px] text-[var(--cc-text)]", children: [
|
|
29
|
+
i ? /* @__PURE__ */ r("span", { className: "flex items-center gap-1.5", children: [
|
|
30
|
+
/* @__PURE__ */ e("span", { className: "h-2 w-2 rounded-full bg-[var(--cc-people)]", "aria-hidden": !0 }),
|
|
31
|
+
/* @__PURE__ */ e("b", { className: "font-semibold tabular-nums", children: i.people.online_count }),
|
|
32
|
+
" online",
|
|
33
|
+
i.people.idle_count > 0 && /* @__PURE__ */ r("span", { className: h, children: [
|
|
34
|
+
"· ",
|
|
35
|
+
i.people.idle_count,
|
|
36
|
+
" idle"
|
|
37
|
+
] })
|
|
38
|
+
] }) : a.snapshotLoading ? /* @__PURE__ */ e("span", { className: `${p} h-4 w-20`, "aria-hidden": !0 }) : null,
|
|
39
|
+
l ? /* @__PURE__ */ r("span", { children: [
|
|
40
|
+
/* @__PURE__ */ e("b", { className: "font-semibold tabular-nums", children: l.transitions_today }),
|
|
41
|
+
" moves today",
|
|
42
|
+
" ",
|
|
43
|
+
/* @__PURE__ */ e(
|
|
44
|
+
"span",
|
|
45
|
+
{
|
|
46
|
+
className: c === 0 ? "text-[var(--cc-muted)]" : c > 0 ? "text-[var(--cc-good-text)]" : "text-[var(--cc-warn-text)]",
|
|
47
|
+
children: c === 0 ? "(same as yesterday by now)" : `(${c > 0 ? "+" : "−"}${Math.abs(c)} vs yesterday by now)`
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] }) : a.snapshotLoading ? /* @__PURE__ */ e("span", { className: `${p} h-4 w-40`, "aria-hidden": !0 }) : null,
|
|
51
|
+
i && /* @__PURE__ */ e(q, { risk: i.risk }),
|
|
52
|
+
i && (i.risk.open_issues ?? 0) > 0 && /* @__PURE__ */ r(
|
|
53
|
+
"button",
|
|
29
54
|
{
|
|
30
|
-
|
|
55
|
+
type: "button",
|
|
56
|
+
disabled: d,
|
|
57
|
+
onClick: () => a.navigate("/issues"),
|
|
58
|
+
className: `rounded-full bg-[var(--cc-bad-bg)] px-2.5 py-0.5 text-[12px] font-medium text-[var(--cc-bad-text)] enabled:hover:brightness-95 disabled:cursor-default ${u}`,
|
|
31
59
|
children: [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
" vs yesterday)"
|
|
60
|
+
i.risk.open_issues,
|
|
61
|
+
" open ",
|
|
62
|
+
i.risk.open_issues === 1 ? "issue" : "issues"
|
|
36
63
|
]
|
|
37
64
|
}
|
|
38
|
-
)
|
|
65
|
+
),
|
|
66
|
+
/* @__PURE__ */ e(P, {})
|
|
39
67
|
] }),
|
|
40
|
-
|
|
68
|
+
/* @__PURE__ */ r("div", { className: "ml-auto flex flex-wrap items-center gap-x-3 gap-y-2", children: [
|
|
69
|
+
/* @__PURE__ */ e(I, {}),
|
|
70
|
+
/* @__PURE__ */ e(U, {}),
|
|
71
|
+
/* @__PURE__ */ e(G, {}),
|
|
72
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-0.5", role: "toolbar", "aria-label": "Board controls", children: [
|
|
73
|
+
!d && /* @__PURE__ */ e(Q, {}),
|
|
74
|
+
!d && /* @__PURE__ */ e(J, {}),
|
|
75
|
+
/* @__PURE__ */ e(
|
|
76
|
+
"button",
|
|
77
|
+
{
|
|
78
|
+
type: "button",
|
|
79
|
+
className: o,
|
|
80
|
+
"aria-pressed": a.tv,
|
|
81
|
+
"aria-label": a.tv ? "Leave TV mode" : "TV mode",
|
|
82
|
+
"data-tip": a.tv ? "Leave TV mode (T)" : "TV mode — larger type, cycles regions (T)",
|
|
83
|
+
onClick: () => a.setTv(!a.tv),
|
|
84
|
+
children: /* @__PURE__ */ e(g, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ e(
|
|
88
|
+
"button",
|
|
89
|
+
{
|
|
90
|
+
type: "button",
|
|
91
|
+
className: o,
|
|
92
|
+
"aria-pressed": a.fullscreen,
|
|
93
|
+
"aria-label": a.fullscreen ? "Leave full screen" : "Full screen",
|
|
94
|
+
"data-tip": a.fullscreen ? "Leave full screen (F)" : "Full screen (F)",
|
|
95
|
+
onClick: a.toggleFullscreen,
|
|
96
|
+
children: a.fullscreen ? /* @__PURE__ */ e(w, { className: "h-4 w-4", "aria-hidden": !0 }) : /* @__PURE__ */ e(N, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
!d && /* @__PURE__ */ e(
|
|
100
|
+
"button",
|
|
101
|
+
{
|
|
102
|
+
type: "button",
|
|
103
|
+
className: o,
|
|
104
|
+
"aria-label": "Customise the board",
|
|
105
|
+
"data-tip": "Customise",
|
|
106
|
+
onClick: a.openCustomize,
|
|
107
|
+
children: /* @__PURE__ */ e(y, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ e(W, { open: t, onOpenChange: s }),
|
|
111
|
+
/* @__PURE__ */ e(
|
|
112
|
+
"button",
|
|
113
|
+
{
|
|
114
|
+
type: "button",
|
|
115
|
+
className: o,
|
|
116
|
+
"aria-label": "Refresh now",
|
|
117
|
+
"data-tip": "Refresh now (R)",
|
|
118
|
+
onClick: a.refresh,
|
|
119
|
+
children: /* @__PURE__ */ e(C, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] })
|
|
123
|
+
] })
|
|
124
|
+
] });
|
|
125
|
+
}
|
|
126
|
+
function f() {
|
|
127
|
+
var n;
|
|
128
|
+
const t = document.querySelector(
|
|
129
|
+
"[data-cc-panel='attention'], [data-cc-slot='attention']"
|
|
130
|
+
);
|
|
131
|
+
if (!t) return;
|
|
132
|
+
const s = (n = window.matchMedia) == null ? void 0 : n.call(window, "(prefers-reduced-motion: reduce)").matches;
|
|
133
|
+
t.scrollIntoView({ block: "start", behavior: s ? "auto" : "smooth" }), t.hasAttribute("tabindex") || t.setAttribute("tabindex", "-1"), t.focus({ preventScroll: !0 });
|
|
134
|
+
}
|
|
135
|
+
function q({ risk: t }) {
|
|
136
|
+
const s = "inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-[12px] font-medium enabled:hover:brightness-95";
|
|
137
|
+
return /* @__PURE__ */ r(x, { children: [
|
|
138
|
+
t.sla_breached !== void 0 && t.sla_breached > 0 && /* @__PURE__ */ r(
|
|
41
139
|
"button",
|
|
42
140
|
{
|
|
43
141
|
type: "button",
|
|
44
|
-
onClick:
|
|
45
|
-
className:
|
|
142
|
+
onClick: f,
|
|
143
|
+
className: `${s} bg-[var(--cc-bad-bg)] text-[var(--cc-bad-text)] ${u}`,
|
|
46
144
|
children: [
|
|
47
|
-
e.
|
|
48
|
-
"
|
|
145
|
+
/* @__PURE__ */ e(k, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
146
|
+
/* @__PURE__ */ e("span", { className: "tabular-nums", children: t.sla_breached }),
|
|
147
|
+
" past deadline"
|
|
49
148
|
]
|
|
50
149
|
}
|
|
51
150
|
),
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
151
|
+
t.sla_warning !== void 0 && t.sla_warning > 0 && /* @__PURE__ */ r(
|
|
152
|
+
"button",
|
|
153
|
+
{
|
|
154
|
+
type: "button",
|
|
155
|
+
onClick: f,
|
|
156
|
+
className: `${s} bg-[var(--cc-warn-bg)] text-[var(--cc-warn-text)] ${u}`,
|
|
157
|
+
children: [
|
|
158
|
+
/* @__PURE__ */ e(T, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
159
|
+
/* @__PURE__ */ e("span", { className: "tabular-nums", children: t.sla_warning }),
|
|
160
|
+
" near deadline"
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
] });
|
|
165
|
+
}
|
|
166
|
+
function G() {
|
|
167
|
+
const t = m(), s = H(1e3, !!t.updatedAt), n = D({ updatedAt: t.updatedAt, failures: t.snapshotFailures, now: s });
|
|
168
|
+
return n.kind === "loading" ? /* @__PURE__ */ e("span", { className: `${p} h-4 w-24`, "aria-hidden": !0 }) : n.kind === "fresh" ? /* @__PURE__ */ e("span", { className: `text-[12px] tabular-nums ${h}`, children: n.label }) : /* @__PURE__ */ r(
|
|
169
|
+
"span",
|
|
170
|
+
{
|
|
171
|
+
role: "status",
|
|
172
|
+
className: "inline-flex items-center gap-1.5 rounded-full bg-[var(--cc-warn-bg)] px-2.5 py-0.5 text-[12px] text-[var(--cc-warn-text)]",
|
|
173
|
+
children: [
|
|
174
|
+
n.kind === "stale" ? `Couldn’t refresh — showing data from ${n.since}` : "Couldn’t load the board",
|
|
175
|
+
/* @__PURE__ */ e("span", { "aria-hidden": !0, children: "·" }),
|
|
176
|
+
/* @__PURE__ */ e(
|
|
177
|
+
"button",
|
|
178
|
+
{
|
|
179
|
+
type: "button",
|
|
180
|
+
onClick: t.refresh,
|
|
181
|
+
className: `font-medium underline underline-offset-2 hover:no-underline ${u}`,
|
|
182
|
+
children: "Try again"
|
|
183
|
+
}
|
|
184
|
+
)
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
function J() {
|
|
190
|
+
const [t, s] = F(!1);
|
|
191
|
+
return /* @__PURE__ */ r(x, { children: [
|
|
192
|
+
/* @__PURE__ */ e(
|
|
193
|
+
"button",
|
|
194
|
+
{
|
|
195
|
+
type: "button",
|
|
196
|
+
className: o,
|
|
197
|
+
"aria-label": t ? "Link copied" : "Copy a link to this view",
|
|
198
|
+
"data-tip": t ? "Copied" : "Copy a link to this view",
|
|
199
|
+
onClick: () => {
|
|
200
|
+
var a;
|
|
201
|
+
const n = E();
|
|
202
|
+
(a = navigator.clipboard) == null || a.writeText(n).then(
|
|
203
|
+
() => {
|
|
204
|
+
s(!0), setTimeout(() => s(!1), 2e3);
|
|
205
|
+
},
|
|
206
|
+
() => s(!1)
|
|
207
|
+
);
|
|
208
|
+
},
|
|
209
|
+
children: t ? /* @__PURE__ */ e(S, { className: "h-4 w-4", "aria-hidden": !0 }) : /* @__PURE__ */ e($, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
/* @__PURE__ */ e("span", { className: "sr-only", "aria-live": "polite", children: t ? "Link to this view copied" : "" })
|
|
213
|
+
] });
|
|
214
|
+
}
|
|
215
|
+
function Q() {
|
|
216
|
+
var n;
|
|
217
|
+
const t = m(), s = ((n = t.prefs) == null ? void 0 : n.saved_views) ?? [];
|
|
218
|
+
return s.length === 0 ? null : /* @__PURE__ */ r(M, { children: [
|
|
219
|
+
/* @__PURE__ */ e(V, { asChild: !0, children: /* @__PURE__ */ e(
|
|
220
|
+
"button",
|
|
221
|
+
{
|
|
222
|
+
type: "button",
|
|
223
|
+
className: o,
|
|
224
|
+
"aria-label": "Saved views",
|
|
225
|
+
"data-tip": "Saved views",
|
|
226
|
+
children: /* @__PURE__ */ e(_, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
227
|
+
}
|
|
228
|
+
) }),
|
|
229
|
+
/* @__PURE__ */ r(
|
|
230
|
+
A,
|
|
231
|
+
{
|
|
232
|
+
align: "end",
|
|
233
|
+
style: v(t.mode),
|
|
234
|
+
className: "min-w-[200px] border-[var(--cc-border)] bg-[var(--cc-panel)] text-[var(--cc-text)]",
|
|
235
|
+
children: [
|
|
236
|
+
s.map((a) => /* @__PURE__ */ e(
|
|
237
|
+
b,
|
|
238
|
+
{
|
|
239
|
+
className: "text-[12.5px] focus:bg-[var(--cc-chip-hover)] focus:text-[var(--cc-strong)]",
|
|
240
|
+
onSelect: () => z(t, a),
|
|
241
|
+
children: a.name
|
|
242
|
+
},
|
|
243
|
+
a.id
|
|
244
|
+
)),
|
|
245
|
+
/* @__PURE__ */ e(
|
|
246
|
+
b,
|
|
247
|
+
{
|
|
248
|
+
className: "text-[12px] text-[var(--cc-muted)] focus:bg-[var(--cc-chip-hover)]",
|
|
249
|
+
onSelect: t.openCustomize,
|
|
250
|
+
children: "Manage views…"
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
]
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
] });
|
|
257
|
+
}
|
|
258
|
+
function W({
|
|
259
|
+
open: t,
|
|
260
|
+
onOpenChange: s
|
|
261
|
+
}) {
|
|
262
|
+
const n = m();
|
|
263
|
+
return /* @__PURE__ */ r(B, { open: t, onOpenChange: s, children: [
|
|
264
|
+
/* @__PURE__ */ e(O, { asChild: !0, children: /* @__PURE__ */ e(
|
|
265
|
+
"button",
|
|
266
|
+
{
|
|
267
|
+
type: "button",
|
|
268
|
+
className: o,
|
|
269
|
+
"aria-label": "Keyboard shortcuts",
|
|
270
|
+
"data-tip": "Keyboard shortcuts (?)",
|
|
271
|
+
children: /* @__PURE__ */ e(L, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
272
|
+
}
|
|
273
|
+
) }),
|
|
274
|
+
/* @__PURE__ */ r(
|
|
275
|
+
R,
|
|
276
|
+
{
|
|
277
|
+
align: "end",
|
|
278
|
+
style: v(n.mode),
|
|
279
|
+
className: "w-72 border-[var(--cc-border)] bg-[var(--cc-panel)] p-3 text-[var(--cc-text)]",
|
|
280
|
+
children: [
|
|
281
|
+
/* @__PURE__ */ e("h2", { className: "mb-2 text-[13px] font-semibold text-[var(--cc-strong)]", children: "Keyboard shortcuts" }),
|
|
282
|
+
/* @__PURE__ */ e("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1.5 text-[12.5px]", children: j.map((a) => /* @__PURE__ */ r("div", { className: "contents", children: [
|
|
283
|
+
/* @__PURE__ */ e("dt", { children: /* @__PURE__ */ e("kbd", { className: "inline-block min-w-[1.75rem] rounded border border-[var(--cc-border)] bg-[var(--cc-raised)] px-1.5 text-center font-mono text-[11.5px] text-[var(--cc-strong)]", children: a.keys }) }),
|
|
284
|
+
/* @__PURE__ */ e("dd", { className: "text-[var(--cc-muted)]", children: a.label })
|
|
285
|
+
] }, a.keys)) }),
|
|
286
|
+
/* @__PURE__ */ e("p", { className: `mt-2 text-[11.5px] ${h}`, children: "Shortcuts pause while you type in a field." })
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
)
|
|
66
290
|
] });
|
|
67
291
|
}
|
|
68
292
|
export {
|
|
69
|
-
|
|
293
|
+
q as DeadlineChips,
|
|
294
|
+
me as Header,
|
|
295
|
+
f as goToAttention
|
|
70
296
|
};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { jsxs as i, jsx as t, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { Check as W, Copy as K } from "lucide-react";
|
|
3
|
+
import { useState as l, useId as w } from "react";
|
|
4
|
+
import { SimpleSelect as k } from "../ui/SimpleSelect.js";
|
|
5
|
+
import { useKioskLinks as M, useCreateKioskLink as j, useRevokeKioskLink as A } from "./board-prefs.js";
|
|
6
|
+
import { formatAge as I } from "./freshness.js";
|
|
7
|
+
import { useCc as P } from "./state.js";
|
|
8
|
+
import { MUTED as U, FOCUS as s, FAINT as N, BUTTON as p } from "./theme.js";
|
|
9
|
+
const O = "text-[13px] font-semibold text-[var(--cc-strong)]", $ = "h-8 w-full rounded-md border border-[var(--cc-border)] bg-[var(--cc-panel)] px-2.5 text-[12.5px] text-[var(--cc-text)] placeholder:text-[var(--cc-faint)]";
|
|
10
|
+
function R(a, o) {
|
|
11
|
+
if (a.expired || !a.expires_at) return "Expired";
|
|
12
|
+
const n = Math.ceil((new Date(a.expires_at).getTime() - o) / 864e5);
|
|
13
|
+
return n <= 1 ? "Expires today" : `Expires in ${n} days`;
|
|
14
|
+
}
|
|
15
|
+
function B({ url: a }) {
|
|
16
|
+
const [o, n] = l(!1), c = w();
|
|
17
|
+
return /* @__PURE__ */ i("div", { className: "space-y-1.5 rounded-md border border-nvr-cyan/40 bg-[var(--cc-chip)] p-2.5", children: [
|
|
18
|
+
/* @__PURE__ */ t("label", { htmlFor: c, className: "block text-[12px] font-medium text-[var(--cc-text)]", children: "Copy this address now — it won’t be shown again" }),
|
|
19
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
20
|
+
/* @__PURE__ */ t(
|
|
21
|
+
"input",
|
|
22
|
+
{
|
|
23
|
+
id: c,
|
|
24
|
+
readOnly: !0,
|
|
25
|
+
value: a,
|
|
26
|
+
onFocus: (r) => r.currentTarget.select(),
|
|
27
|
+
className: `${$} font-mono text-[11.5px] ${s}`
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
/* @__PURE__ */ i(
|
|
31
|
+
"button",
|
|
32
|
+
{
|
|
33
|
+
type: "button",
|
|
34
|
+
className: `${p} inline-flex shrink-0 items-center gap-1 ${s}`,
|
|
35
|
+
onClick: () => {
|
|
36
|
+
var r;
|
|
37
|
+
(r = navigator.clipboard) == null || r.writeText(a).then(
|
|
38
|
+
() => n(!0),
|
|
39
|
+
() => n(!1)
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
children: [
|
|
43
|
+
o ? /* @__PURE__ */ t(W, { className: "h-3.5 w-3.5", "aria-hidden": !0 }) : /* @__PURE__ */ t(K, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
44
|
+
o ? "Copied" : "Copy"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
] })
|
|
49
|
+
] });
|
|
50
|
+
}
|
|
51
|
+
function Y() {
|
|
52
|
+
var v;
|
|
53
|
+
const a = P(), o = M(a.isAdmin), n = j(), c = A(), [r, u] = l(""), [h, C] = l("30"), [b, T] = l(""), [x, _] = l(null), [L, m] = l(null), d = w(), f = Date.now(), g = ((v = a.config) == null ? void 0 : v.regions) ?? [], E = (e) => {
|
|
54
|
+
var y;
|
|
55
|
+
return e ? ((y = g.find((D) => D.id === e)) == null ? void 0 : y.label) ?? "A region" : "Everywhere";
|
|
56
|
+
}, S = () => {
|
|
57
|
+
r.trim() && n.mutate(
|
|
58
|
+
{
|
|
59
|
+
label: r.trim(),
|
|
60
|
+
expires_in_days: Number(h),
|
|
61
|
+
region: b || null,
|
|
62
|
+
map_collection: a.mapCollection
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
onSuccess: (e) => {
|
|
66
|
+
_(`${window.location.origin}${e.url}`), u("");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
return /* @__PURE__ */ i(
|
|
72
|
+
"section",
|
|
73
|
+
{
|
|
74
|
+
className: "space-y-2 border-t border-[var(--cc-border)] pt-4",
|
|
75
|
+
"aria-labelledby": `${d}-h`,
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ t("h3", { id: `${d}-h`, className: O, children: "Wallboard links" }),
|
|
78
|
+
/* @__PURE__ */ t("p", { className: `text-[12px] ${U}`, children: "Show this board on a screen without signing in. The screen sees what you can see, read only, in TV mode." }),
|
|
79
|
+
/* @__PURE__ */ i(
|
|
80
|
+
"form",
|
|
81
|
+
{
|
|
82
|
+
className: "space-y-2",
|
|
83
|
+
onSubmit: (e) => {
|
|
84
|
+
e.preventDefault(), S();
|
|
85
|
+
},
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ t("label", { htmlFor: d, className: "sr-only", children: "Which screen is this link for" }),
|
|
88
|
+
/* @__PURE__ */ t(
|
|
89
|
+
"input",
|
|
90
|
+
{
|
|
91
|
+
id: d,
|
|
92
|
+
value: r,
|
|
93
|
+
onChange: (e) => u(e.target.value),
|
|
94
|
+
placeholder: "Which screen? e.g. Dispatch wall",
|
|
95
|
+
maxLength: 80,
|
|
96
|
+
className: `${$} ${s}`
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ i("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
100
|
+
/* @__PURE__ */ t(
|
|
101
|
+
k,
|
|
102
|
+
{
|
|
103
|
+
ariaLabel: "How long the link works",
|
|
104
|
+
value: h,
|
|
105
|
+
onChange: C,
|
|
106
|
+
className: "h-8 text-[12.5px]",
|
|
107
|
+
options: [
|
|
108
|
+
{ value: "1", label: "Works for 1 day" },
|
|
109
|
+
{ value: "7", label: "Works for 7 days" },
|
|
110
|
+
{ value: "30", label: "Works for 30 days" },
|
|
111
|
+
{ value: "90", label: "Works for 90 days" }
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ t(
|
|
116
|
+
k,
|
|
117
|
+
{
|
|
118
|
+
ariaLabel: "Region the screen shows",
|
|
119
|
+
value: b,
|
|
120
|
+
onChange: T,
|
|
121
|
+
className: "h-8 text-[12.5px]",
|
|
122
|
+
options: [
|
|
123
|
+
{ value: "", label: "Everywhere" },
|
|
124
|
+
...g.map((e) => ({ value: e.id, label: e.label }))
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
] }),
|
|
129
|
+
/* @__PURE__ */ t("div", { className: "flex justify-end", children: /* @__PURE__ */ t(
|
|
130
|
+
"button",
|
|
131
|
+
{
|
|
132
|
+
type: "submit",
|
|
133
|
+
disabled: !r.trim() || n.isPending,
|
|
134
|
+
className: `rounded-md bg-nvr-cyan px-2.5 py-1 text-[11.5px] font-medium text-white disabled:opacity-50 ${s}`,
|
|
135
|
+
children: n.isPending ? "Making the link…" : "Make a link"
|
|
136
|
+
}
|
|
137
|
+
) }),
|
|
138
|
+
n.isError && /* @__PURE__ */ t("p", { role: "alert", className: "text-[12px] text-[var(--cc-bad-text)]", children: "Couldn’t make the link. Try again." })
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
x && /* @__PURE__ */ t(B, { url: x }),
|
|
143
|
+
(o.data ?? []).length > 0 && /* @__PURE__ */ t("ul", { className: "divide-y divide-[var(--cc-border)] rounded-md border border-[var(--cc-border)]", children: (o.data ?? []).map((e) => /* @__PURE__ */ i("li", { className: "flex items-center gap-2 px-2.5 py-2", children: [
|
|
144
|
+
/* @__PURE__ */ i("div", { className: "min-w-0 flex-1", children: [
|
|
145
|
+
/* @__PURE__ */ t("p", { className: "truncate text-[12.5px] font-medium text-[var(--cc-text)]", children: e.label }),
|
|
146
|
+
/* @__PURE__ */ t(
|
|
147
|
+
"p",
|
|
148
|
+
{
|
|
149
|
+
className: `truncate text-[11.5px] ${e.expired ? "text-[var(--cc-warn-text)]" : N}`,
|
|
150
|
+
children: [
|
|
151
|
+
E(e.region),
|
|
152
|
+
R(e, f),
|
|
153
|
+
e.created_by_name ? `made by ${e.created_by_name}` : null,
|
|
154
|
+
// A screen showing the link checks in every few minutes.
|
|
155
|
+
e.last_viewed_at ? `last on screen ${I(f - new Date(e.last_viewed_at).getTime())}` : "not opened yet"
|
|
156
|
+
].filter(Boolean).join(" · ")
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
] }),
|
|
160
|
+
L === e.id ? /* @__PURE__ */ i(F, { children: [
|
|
161
|
+
/* @__PURE__ */ t(
|
|
162
|
+
"button",
|
|
163
|
+
{
|
|
164
|
+
type: "button",
|
|
165
|
+
className: `${p} ${s}`,
|
|
166
|
+
onClick: () => m(null),
|
|
167
|
+
children: "Keep"
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
/* @__PURE__ */ t(
|
|
171
|
+
"button",
|
|
172
|
+
{
|
|
173
|
+
type: "button",
|
|
174
|
+
className: `rounded-md bg-[var(--cc-bad-bg)] px-2.5 py-1 text-[11.5px] font-medium text-[var(--cc-bad-text)] ${s}`,
|
|
175
|
+
disabled: c.isPending,
|
|
176
|
+
onClick: () => c.mutate(e.id, { onSettled: () => m(null) }),
|
|
177
|
+
children: "Turn off"
|
|
178
|
+
}
|
|
179
|
+
)
|
|
180
|
+
] }) : /* @__PURE__ */ t(
|
|
181
|
+
"button",
|
|
182
|
+
{
|
|
183
|
+
type: "button",
|
|
184
|
+
className: `${p} ${s}`,
|
|
185
|
+
"aria-label": `Turn off the link for ${e.label}`,
|
|
186
|
+
onClick: () => m(e.id),
|
|
187
|
+
children: "Turn off"
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
] }, e.id)) }),
|
|
191
|
+
o.isError && /* @__PURE__ */ t("p", { className: `text-[12px] ${N}`, children: "Couldn’t load the wallboard links." })
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
export {
|
|
197
|
+
Y as KioskLinks
|
|
198
|
+
};
|