@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
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { jsx as e, jsxs as d, Fragment as E } from "react/jsx-runtime";
|
|
2
|
+
import { useSensors as R, useSensor as _, PointerSensor as I, KeyboardSensor as V, DndContext as j, closestCenter as M } from "@dnd-kit/core";
|
|
3
|
+
import { sortableKeyboardCoordinates as O, SortableContext as U, verticalListSortingStrategy as K, useSortable as q } from "@dnd-kit/sortable";
|
|
4
|
+
import { CSS as B } from "@dnd-kit/utilities";
|
|
5
|
+
import { useQuery as z } from "@tanstack/react-query";
|
|
6
|
+
import { Trash2 as G, GripVertical as H, ArrowUp as Q, ArrowDown as W } from "lucide-react";
|
|
7
|
+
import { useMemo as f, useState as w, useId as J, useEffect as X } from "react";
|
|
8
|
+
import { useNivaroClient as Y } from "../../context.js";
|
|
9
|
+
import { get as Z } from "../../lib/commands.js";
|
|
10
|
+
import { SimpleSelect as D } from "../ui/SimpleSelect.js";
|
|
11
|
+
import { Sheet as ee, SheetContent as te, SheetHeader as ae, SheetTitle as re, SheetDescription as oe } from "../ui/sheet.js";
|
|
12
|
+
import { Switch as ne } from "../ui/switch.js";
|
|
13
|
+
import { useSaveCcPrefs as S, DEFAULT_PREFS as ce, useCcRoleDefaults as le, useSaveRoleDefault as ie } from "./board-prefs.js";
|
|
14
|
+
import { KioskLinks as se } from "./KioskLinks.js";
|
|
15
|
+
import { effectiveLayout as de, resolvePanels as L, setPanelVisible as me, movePanel as ue, layoutToSave as P, movePanelTo as he } from "./layout.js";
|
|
16
|
+
import { CC_PANELS as T } from "./panels/registry.js";
|
|
17
|
+
import { useCc as k } from "./state.js";
|
|
18
|
+
import { MUTED as x, BUTTON as g, FOCUS as v, ccVars as pe, FAINT as $ } from "./theme.js";
|
|
19
|
+
const y = "space-y-2 border-t border-[var(--cc-border)] pt-4 first:border-t-0 first:pt-0", N = "text-[13px] font-semibold text-[var(--cc-strong)]", be = "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)]";
|
|
20
|
+
function A(t) {
|
|
21
|
+
return f(() => T.filter((n) => !n.adminOnly || t), [t]);
|
|
22
|
+
}
|
|
23
|
+
function ve({
|
|
24
|
+
panel: t,
|
|
25
|
+
index: n,
|
|
26
|
+
count: c,
|
|
27
|
+
onMove: i,
|
|
28
|
+
onVisible: b
|
|
29
|
+
}) {
|
|
30
|
+
const { attributes: a, listeners: s, setNodeRef: l, transform: o, transition: u, isDragging: r } = q({
|
|
31
|
+
id: t.key
|
|
32
|
+
});
|
|
33
|
+
return /* @__PURE__ */ d(
|
|
34
|
+
"li",
|
|
35
|
+
{
|
|
36
|
+
ref: l,
|
|
37
|
+
style: { transform: B.Transform.toString(o), transition: u },
|
|
38
|
+
className: `flex items-center gap-2 px-2 py-2 ${r ? "relative z-10 bg-[var(--cc-raised)] shadow-sm" : ""}`,
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ e(
|
|
41
|
+
"button",
|
|
42
|
+
{
|
|
43
|
+
type: "button",
|
|
44
|
+
...a,
|
|
45
|
+
...s,
|
|
46
|
+
"aria-label": `Drag ${t.label} to reorder`,
|
|
47
|
+
"data-tip": "Drag to reorder",
|
|
48
|
+
className: `cursor-grab rounded p-1 text-[var(--cc-faint)] hover:bg-[var(--cc-chip)] active:cursor-grabbing ${v}`,
|
|
49
|
+
children: /* @__PURE__ */ e(H, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
|
|
53
|
+
/* @__PURE__ */ e(
|
|
54
|
+
"p",
|
|
55
|
+
{
|
|
56
|
+
className: `truncate text-[12.5px] font-medium ${t.visible ? "text-[var(--cc-text)]" : "text-[var(--cc-faint)]"}`,
|
|
57
|
+
children: t.label
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
t.hint && /* @__PURE__ */ e("p", { className: `truncate text-[11.5px] ${$}`, children: t.hint })
|
|
61
|
+
] }),
|
|
62
|
+
/* @__PURE__ */ e(
|
|
63
|
+
"button",
|
|
64
|
+
{
|
|
65
|
+
type: "button",
|
|
66
|
+
disabled: n === 0,
|
|
67
|
+
onClick: () => i(-1),
|
|
68
|
+
"aria-label": `Move ${t.label} up`,
|
|
69
|
+
className: `rounded p-1 text-[var(--cc-muted)] hover:bg-[var(--cc-chip)] disabled:opacity-30 ${v}`,
|
|
70
|
+
children: /* @__PURE__ */ e(Q, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ e(
|
|
74
|
+
"button",
|
|
75
|
+
{
|
|
76
|
+
type: "button",
|
|
77
|
+
disabled: n === c - 1,
|
|
78
|
+
onClick: () => i(1),
|
|
79
|
+
"aria-label": `Move ${t.label} down`,
|
|
80
|
+
className: `rounded p-1 text-[var(--cc-muted)] hover:bg-[var(--cc-chip)] disabled:opacity-30 ${v}`,
|
|
81
|
+
children: /* @__PURE__ */ e(W, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
/* @__PURE__ */ e(
|
|
85
|
+
ne,
|
|
86
|
+
{
|
|
87
|
+
checked: t.visible,
|
|
88
|
+
onCheckedChange: b,
|
|
89
|
+
"aria-label": `Show ${t.label}`,
|
|
90
|
+
className: "data-[state=checked]:bg-nvr-cyan data-[state=unchecked]:bg-[var(--cc-chip-hover)]"
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
function F({
|
|
98
|
+
panels: t,
|
|
99
|
+
onChange: n
|
|
100
|
+
}) {
|
|
101
|
+
const c = R(
|
|
102
|
+
_(I, { activationConstraint: { distance: 4 } }),
|
|
103
|
+
_(V, { coordinateGetter: O })
|
|
104
|
+
), i = f(() => new Map(T.map((a) => [a.key, a])), []);
|
|
105
|
+
return /* @__PURE__ */ e(j, { sensors: c, collisionDetection: M, onDragEnd: (a) => {
|
|
106
|
+
a.over && a.active.id !== a.over.id && n(he(t, String(a.active.id), String(a.over.id)));
|
|
107
|
+
}, children: /* @__PURE__ */ e(U, { items: t.map((a) => a.key), strategy: K, children: /* @__PURE__ */ e("ol", { className: "divide-y divide-[var(--cc-border)] rounded-md border border-[var(--cc-border)]", children: t.map((a, s) => {
|
|
108
|
+
var l, o;
|
|
109
|
+
return /* @__PURE__ */ e(
|
|
110
|
+
ve,
|
|
111
|
+
{
|
|
112
|
+
panel: { ...a, label: ((l = i.get(a.key)) == null ? void 0 : l.label) ?? a.key, hint: (o = i.get(a.key)) == null ? void 0 : o.hint },
|
|
113
|
+
index: s,
|
|
114
|
+
count: t.length,
|
|
115
|
+
onMove: (u) => n(ue(t, a.key, u)),
|
|
116
|
+
onVisible: (u) => n(me(t, a.key, u))
|
|
117
|
+
},
|
|
118
|
+
a.key
|
|
119
|
+
);
|
|
120
|
+
}) }) }) });
|
|
121
|
+
}
|
|
122
|
+
function fe() {
|
|
123
|
+
var u;
|
|
124
|
+
const t = k(), n = S(), c = ((u = t.prefs) == null ? void 0 : u.saved_views) ?? [], [i, b] = w(""), a = J(), s = (r) => {
|
|
125
|
+
var m, p;
|
|
126
|
+
return r ? ((p = (m = t.config) == null ? void 0 : m.regions.find((h) => h.id === r)) == null ? void 0 : p.label) ?? "A region" : "Everywhere";
|
|
127
|
+
}, l = (r) => {
|
|
128
|
+
var m, p;
|
|
129
|
+
return r ? ((p = (m = t.config) == null ? void 0 : m.geo_collections.find((h) => h.key === r)) == null ? void 0 : p.label) || r.replace(/_/g, " ") : null;
|
|
130
|
+
}, o = () => {
|
|
131
|
+
const r = i.trim();
|
|
132
|
+
if (!r) return;
|
|
133
|
+
const m = {
|
|
134
|
+
id: `v${Date.now().toString(36)}`,
|
|
135
|
+
name: r.slice(0, 60),
|
|
136
|
+
region: t.region,
|
|
137
|
+
map_collection: t.mapCollection,
|
|
138
|
+
filters: t.filters
|
|
139
|
+
};
|
|
140
|
+
n.mutate({ saved_views: [...c.filter((p) => p.name !== m.name), m].slice(-20) }), b("");
|
|
141
|
+
};
|
|
142
|
+
return /* @__PURE__ */ d("section", { className: y, "aria-labelledby": `${a}-h`, children: [
|
|
143
|
+
/* @__PURE__ */ e("h3", { id: `${a}-h`, className: N, children: "Saved views" }),
|
|
144
|
+
/* @__PURE__ */ e("p", { className: `text-[12px] ${x}`, children: "A view keeps the region, the map and its filters, so you can come back to them in one click." }),
|
|
145
|
+
c.length > 0 && /* @__PURE__ */ e("ul", { className: "divide-y divide-[var(--cc-border)] rounded-md border border-[var(--cc-border)]", children: c.map((r) => /* @__PURE__ */ d("li", { className: "flex items-center gap-2 px-2.5 py-2", children: [
|
|
146
|
+
/* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
|
|
147
|
+
/* @__PURE__ */ e("p", { className: "truncate text-[12.5px] font-medium text-[var(--cc-text)]", children: r.name }),
|
|
148
|
+
/* @__PURE__ */ e("p", { className: `truncate text-[11.5px] ${$}`, children: [s(r.region), l(r.map_collection)].filter(Boolean).join(" · ") })
|
|
149
|
+
] }),
|
|
150
|
+
/* @__PURE__ */ e(
|
|
151
|
+
"button",
|
|
152
|
+
{
|
|
153
|
+
type: "button",
|
|
154
|
+
className: `${g} ${v}`,
|
|
155
|
+
onClick: () => xe(t, r),
|
|
156
|
+
children: "Open"
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
/* @__PURE__ */ e(
|
|
160
|
+
"button",
|
|
161
|
+
{
|
|
162
|
+
type: "button",
|
|
163
|
+
"aria-label": `Delete the view ${r.name}`,
|
|
164
|
+
"data-tip": "Delete",
|
|
165
|
+
className: `rounded p-1.5 text-[var(--cc-muted)] hover:bg-[var(--cc-chip)] hover:text-[var(--cc-bad-text)] ${v}`,
|
|
166
|
+
onClick: () => n.mutate({ saved_views: c.filter((m) => m.id !== r.id) }),
|
|
167
|
+
children: /* @__PURE__ */ e(G, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
] }, r.id)) }),
|
|
171
|
+
/* @__PURE__ */ d(
|
|
172
|
+
"form",
|
|
173
|
+
{
|
|
174
|
+
className: "flex items-center gap-2",
|
|
175
|
+
onSubmit: (r) => {
|
|
176
|
+
r.preventDefault(), o();
|
|
177
|
+
},
|
|
178
|
+
children: [
|
|
179
|
+
/* @__PURE__ */ e("label", { htmlFor: a, className: "sr-only", children: "Name for the current view" }),
|
|
180
|
+
/* @__PURE__ */ e(
|
|
181
|
+
"input",
|
|
182
|
+
{
|
|
183
|
+
id: a,
|
|
184
|
+
value: i,
|
|
185
|
+
onChange: (r) => b(r.target.value),
|
|
186
|
+
placeholder: `Name this view (${s(t.region)})`,
|
|
187
|
+
maxLength: 60,
|
|
188
|
+
className: `${be} ${v}`
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
/* @__PURE__ */ e("button", { type: "submit", disabled: !i.trim(), className: `${g} shrink-0 ${v}`, children: "Save view" })
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
] });
|
|
196
|
+
}
|
|
197
|
+
function xe(t, n) {
|
|
198
|
+
t.setRegion(n.region), n.map_collection && t.setMapCollection(n.map_collection), t.setFilters(n.filters);
|
|
199
|
+
}
|
|
200
|
+
function ge() {
|
|
201
|
+
var a, s, l;
|
|
202
|
+
const t = k(), n = S(), c = ((a = t.prefs) == null ? void 0 : a.theme) ?? "app", i = String(((s = t.prefs) == null ? void 0 : s.tv_cycle_seconds) ?? ce.tv_cycle_seconds);
|
|
203
|
+
return /* @__PURE__ */ d("section", { className: y, "aria-labelledby": "cc-appearance-h", children: [
|
|
204
|
+
/* @__PURE__ */ e("h3", { id: "cc-appearance-h", className: N, children: "Appearance" }),
|
|
205
|
+
/* @__PURE__ */ e("div", { role: "radiogroup", "aria-labelledby": "cc-appearance-h", className: "grid grid-cols-2 gap-2", children: [
|
|
206
|
+
{ value: "app", label: "Follow the app", hint: "Light or dark, like the rest of Nivaro" },
|
|
207
|
+
{ value: "dark", label: "Always dark", hint: "For wall screens and dim rooms" }
|
|
208
|
+
].map((o) => (
|
|
209
|
+
// biome-ignore lint/a11y/useSemanticElements: a two-card radio group, not a form input
|
|
210
|
+
/* @__PURE__ */ d(
|
|
211
|
+
"button",
|
|
212
|
+
{
|
|
213
|
+
type: "button",
|
|
214
|
+
role: "radio",
|
|
215
|
+
"aria-checked": c === o.value,
|
|
216
|
+
onClick: () => n.mutate({ theme: o.value }),
|
|
217
|
+
className: `rounded-md border px-2.5 py-2 text-left ${v} ${c === o.value ? "border-nvr-cyan bg-[var(--cc-chip)]" : "border-[var(--cc-border)] hover:bg-[var(--cc-chip)]"}`,
|
|
218
|
+
children: [
|
|
219
|
+
/* @__PURE__ */ e("span", { className: "block text-[12.5px] font-medium text-[var(--cc-text)]", children: o.label }),
|
|
220
|
+
/* @__PURE__ */ e("span", { className: `block text-[11.5px] ${$}`, children: o.hint })
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
o.value
|
|
224
|
+
)
|
|
225
|
+
)) }),
|
|
226
|
+
(((l = t.config) == null ? void 0 : l.regions.length) ?? 0) > 1 && /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-3 pt-1", children: [
|
|
227
|
+
/* @__PURE__ */ e("span", { className: "text-[12.5px] text-[var(--cc-text)]", children: "In TV mode, move to the next region every" }),
|
|
228
|
+
/* @__PURE__ */ e(
|
|
229
|
+
D,
|
|
230
|
+
{
|
|
231
|
+
ariaLabel: "Seconds between regions in TV mode",
|
|
232
|
+
value: i,
|
|
233
|
+
onChange: (o) => n.mutate({ tv_cycle_seconds: Number(o) }),
|
|
234
|
+
className: "h-8 w-[120px] text-[12.5px]",
|
|
235
|
+
options: [15, 30, 60, 120, 300].map((o) => ({
|
|
236
|
+
value: String(o),
|
|
237
|
+
label: o < 60 ? `${o} seconds` : `${o / 60} minute${o > 60 ? "s" : ""}`
|
|
238
|
+
}))
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
] })
|
|
242
|
+
] });
|
|
243
|
+
}
|
|
244
|
+
function ye() {
|
|
245
|
+
var p;
|
|
246
|
+
const t = Y(), c = A(!0), i = f(() => c.map((h) => h.key), [c]), b = z({
|
|
247
|
+
queryKey: ["command-center", "roles-list"],
|
|
248
|
+
queryFn: () => t.request(Z("/roles")).then((h) => h.data),
|
|
249
|
+
staleTime: 6e4
|
|
250
|
+
}), a = le(!0), s = ie(), [l, o] = w(""), u = l ? ((p = a.data) == null ? void 0 : p[l.toLowerCase()]) ?? null : null, [r, m] = w(null);
|
|
251
|
+
return X(() => {
|
|
252
|
+
m(l ? L(i, u) : null);
|
|
253
|
+
}, [l, u, i]), /* @__PURE__ */ d("section", { className: y, "aria-labelledby": "cc-roles-h", children: [
|
|
254
|
+
/* @__PURE__ */ e("h3", { id: "cc-roles-h", className: N, children: "Starting layout for a role" }),
|
|
255
|
+
/* @__PURE__ */ e("p", { className: `text-[12px] ${x}`, children: "What a role’s people see until they customise their own board." }),
|
|
256
|
+
/* @__PURE__ */ e(
|
|
257
|
+
D,
|
|
258
|
+
{
|
|
259
|
+
ariaLabel: "Role",
|
|
260
|
+
value: l,
|
|
261
|
+
onChange: o,
|
|
262
|
+
className: "h-8 text-[12.5px]",
|
|
263
|
+
options: [
|
|
264
|
+
{ value: "", label: b.isLoading ? "Loading roles…" : "Choose a role" },
|
|
265
|
+
...(b.data ?? []).map((h) => {
|
|
266
|
+
var C;
|
|
267
|
+
return {
|
|
268
|
+
value: String(h.id),
|
|
269
|
+
label: `${h.name}${(C = a.data) != null && C[String(h.id).toLowerCase()] ? " (set)" : ""}`
|
|
270
|
+
};
|
|
271
|
+
})
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
),
|
|
275
|
+
r && /* @__PURE__ */ d(E, { children: [
|
|
276
|
+
/* @__PURE__ */ e(F, { panels: r, onChange: m }),
|
|
277
|
+
/* @__PURE__ */ d("div", { className: "flex flex-wrap justify-end gap-2", children: [
|
|
278
|
+
/* @__PURE__ */ e(
|
|
279
|
+
"button",
|
|
280
|
+
{
|
|
281
|
+
type: "button",
|
|
282
|
+
className: `${g} ${v}`,
|
|
283
|
+
disabled: !u || s.isPending,
|
|
284
|
+
onClick: () => s.mutate({ role_id: l, layout: null }),
|
|
285
|
+
children: "Back to the built-in layout"
|
|
286
|
+
}
|
|
287
|
+
),
|
|
288
|
+
/* @__PURE__ */ e(
|
|
289
|
+
"button",
|
|
290
|
+
{
|
|
291
|
+
type: "button",
|
|
292
|
+
className: `rounded-md bg-nvr-cyan px-2.5 py-1 text-[11.5px] font-medium text-white disabled:opacity-50 ${v}`,
|
|
293
|
+
disabled: s.isPending,
|
|
294
|
+
onClick: () => s.mutate({ role_id: l, layout: P(r, u, i) }),
|
|
295
|
+
children: "Save for this role"
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
] }),
|
|
299
|
+
s.isError && /* @__PURE__ */ e("p", { role: "alert", className: "text-[12px] text-[var(--cc-bad-text)]", children: "Couldn’t save the role’s layout. Try again." })
|
|
300
|
+
] })
|
|
301
|
+
] });
|
|
302
|
+
}
|
|
303
|
+
function Me({
|
|
304
|
+
open: t,
|
|
305
|
+
onOpenChange: n
|
|
306
|
+
}) {
|
|
307
|
+
var r, m, p;
|
|
308
|
+
const c = k(), i = S(), b = A(c.isAdmin), a = f(() => b.map((h) => h.key), [b]), s = ((r = c.prefs) == null ? void 0 : r.layout) ?? null, l = de(s, (m = c.prefs) == null ? void 0 : m.role_default), o = f(() => L(a, l), [a, l]), u = (h) => i.mutate({ layout: P(h, s ?? l, a) });
|
|
309
|
+
return /* @__PURE__ */ e(ee, { open: t, onOpenChange: n, children: /* @__PURE__ */ d(
|
|
310
|
+
te,
|
|
311
|
+
{
|
|
312
|
+
side: "right",
|
|
313
|
+
style: pe(c.mode),
|
|
314
|
+
className: "flex w-full flex-col gap-0 border-[var(--cc-border)] bg-[var(--cc-panel)] p-0 text-[var(--cc-text)] sm:max-w-md",
|
|
315
|
+
children: [
|
|
316
|
+
/* @__PURE__ */ d(ae, { className: "border-b border-[var(--cc-border)] px-4 py-3 text-left", children: [
|
|
317
|
+
/* @__PURE__ */ e(re, { className: "text-[15px] text-[var(--cc-strong)]", children: "Customise the board" }),
|
|
318
|
+
/* @__PURE__ */ e(oe, { className: `text-[12px] ${x}`, children: "Changes save as you make them and only change your own board." })
|
|
319
|
+
] }),
|
|
320
|
+
/* @__PURE__ */ d("div", { className: "flex-1 space-y-4 overflow-y-auto px-4 py-4", children: [
|
|
321
|
+
/* @__PURE__ */ d("section", { className: y, "aria-labelledby": "cc-panels-h", children: [
|
|
322
|
+
/* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2", children: [
|
|
323
|
+
/* @__PURE__ */ e("h3", { id: "cc-panels-h", className: N, children: "Panels" }),
|
|
324
|
+
/* @__PURE__ */ e(
|
|
325
|
+
"button",
|
|
326
|
+
{
|
|
327
|
+
type: "button",
|
|
328
|
+
className: `${g} ${v}`,
|
|
329
|
+
disabled: !s || i.isPending,
|
|
330
|
+
onClick: () => i.mutate({ layout: null }),
|
|
331
|
+
children: (p = c.prefs) != null && p.role_default ? "Reset to my role’s layout" : "Reset"
|
|
332
|
+
}
|
|
333
|
+
)
|
|
334
|
+
] }),
|
|
335
|
+
/* @__PURE__ */ e("p", { className: `text-[12px] ${x}`, children: "Drag or use the arrows to change the order; switch a panel off to hide it." }),
|
|
336
|
+
/* @__PURE__ */ e(F, { panels: o, onChange: u })
|
|
337
|
+
] }),
|
|
338
|
+
/* @__PURE__ */ e(fe, {}),
|
|
339
|
+
/* @__PURE__ */ e(ge, {}),
|
|
340
|
+
c.isAdmin && /* @__PURE__ */ e(ye, {}),
|
|
341
|
+
c.isAdmin && /* @__PURE__ */ e(se, {}),
|
|
342
|
+
i.isError && /* @__PURE__ */ e("p", { role: "alert", className: "text-[12px] text-[var(--cc-bad-text)]", children: "Couldn’t save that change. Check your connection and try again." })
|
|
343
|
+
] })
|
|
344
|
+
]
|
|
345
|
+
}
|
|
346
|
+
) });
|
|
347
|
+
}
|
|
348
|
+
export {
|
|
349
|
+
Me as CustomizeSheet,
|
|
350
|
+
F as PanelOrderEditor,
|
|
351
|
+
xe as applySavedView,
|
|
352
|
+
A as usePanelsFor
|
|
353
|
+
};
|