react-semaphor 0.1.208 → 0.1.210
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/chunks/dashboard-controls-BAOrAMV9.js +42 -0
- package/dist/chunks/{dashboard-controls-yOzrvYwI.js → dashboard-controls-C08300Wi.js} +504 -456
- package/dist/chunks/{dashboard-json-BuLoVNV4.js → dashboard-json-DlEE5-WA.js} +1 -1
- package/dist/chunks/{dashboard-json-DqChvVCF.js → dashboard-json-GjDBGO26.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-tJueBNph.js → dashboard-summary-settings-dialog-QUuhhXU9.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-DmccX33N.js → dashboard-summary-settings-dialog-THx-gjnG.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-CV4JsCTg.js → edit-dashboard-visual-Bsmow1Pa.js} +3422 -3536
- package/dist/chunks/edit-dashboard-visual-PfWJXb2-.js +164 -0
- package/dist/chunks/editor-action-buttons-DNbp_ZWy.js +404 -0
- package/dist/chunks/editor-action-buttons-FPyaC09X.js +21 -0
- package/dist/chunks/{index-CBcPi9pm.js → index-CAVrkf9d.js} +24248 -23818
- package/dist/chunks/index-CXKjmjfB.js +1104 -0
- package/dist/chunks/normalize-dashboard-for-dirty-check-D9x96J2F.js +1 -0
- package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +119 -0
- package/dist/chunks/notification-bell-BqvKQSw9.js +6 -0
- package/dist/chunks/notification-bell-C3a7wC1u.js +871 -0
- package/dist/chunks/resource-management-panel-BVTgbma8.js +913 -0
- package/dist/chunks/resource-management-panel-C5NjrVsA.js +6 -0
- package/dist/chunks/{use-role-aware-display-preferences-DTSpe_ZT.js → use-role-aware-display-preferences-DxCPoCgr.js} +1 -1
- package/dist/chunks/{use-role-aware-display-preferences-B4QJkliF.js → use-role-aware-display-preferences-l7NFLYnn.js} +1 -1
- package/dist/chunks/{use-visual-utils-ChR-Jti8.js → use-visual-utils-B82Q-Ytl.js} +1 -1
- package/dist/chunks/{use-visual-utils-CCT3ABI5.js → use-visual-utils-D9IJz9R0.js} +34 -34
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +44 -40
- package/dist/shared/index.cjs +1 -0
- package/dist/shared/index.js +6 -0
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/dashboard.d.ts +12 -1
- package/dist/types/main.d.ts +52 -2
- package/dist/types/shared.d.ts +1762 -0
- package/dist/types/surfboard.d.ts +12 -1
- package/dist/types/types.d.ts +12 -1
- package/package.json +6 -1
- package/dist/chunks/dashboard-controls-K5zNLdtH.js +0 -42
- package/dist/chunks/edit-dashboard-visual-CKNlwaCO.js +0 -179
- package/dist/chunks/editor-action-buttons-CAjqJiT_.js +0 -340
- package/dist/chunks/editor-action-buttons-DQVh7L5i.js +0 -11
- package/dist/chunks/index-DQOwJyRp.js +0 -1104
- package/dist/chunks/notification-bell-B-OVf20Q.js +0 -862
- package/dist/chunks/notification-bell-DyzIftQU.js +0 -11
- package/dist/chunks/resource-management-panel-D_mSi7Cm.js +0 -914
- package/dist/chunks/resource-management-panel-NqaNfAq3.js +0 -6
|
@@ -0,0 +1,913 @@
|
|
|
1
|
+
import { jsx as e, jsxs as n, Fragment as ge } from "react/jsx-runtime";
|
|
2
|
+
import { bP as _e, u as ie, bA as qe, bL as le, c2 as Ge, c3 as Ke, B as U, c4 as pe, c5 as We, c6 as Ye, c7 as Xe, c8 as Je, c9 as X, H as de, ca as Qe, cb as Ze, cc as $e, cd as ve, ce as De, cf as ke, cg as et, c as re, ch as be, e as ce, ci as ye, cj as Se, ck as tt, ai as Ee, ag as Ve, cl as Le, cm as Ae, cn as Oe, co as Te, cp as Re, cq as Pe, cr as Ue, cs as je, ct as Ie, cu as st, cv as nt, bE as ae, l as at, cw as Me, cx as it, m as rt, n as ot, o as lt, p as dt, q as ct, L as Ce, cy as fe, G as ut, cz as ht, cA as mt, cB as pt, bW as ft, bX as gt, bY as Dt, b_ as xt, cC as Nt, cD as wt } from "./index-CAVrkf9d.js";
|
|
3
|
+
import vt, { useRef as Ct, useEffect as oe, useState as N } from "react";
|
|
4
|
+
import { a as Fe } from "./use-visual-utils-D9IJz9R0.js";
|
|
5
|
+
import { u as bt } from "./use-role-aware-display-preferences-DxCPoCgr.js";
|
|
6
|
+
/**
|
|
7
|
+
* @license lucide-react v0.453.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
const yt = _e("FolderOpen", [
|
|
13
|
+
[
|
|
14
|
+
"path",
|
|
15
|
+
{
|
|
16
|
+
d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
|
|
17
|
+
key: "usdka0"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
]);
|
|
21
|
+
function St(t, g = {}) {
|
|
22
|
+
const { enabled: p = !0, eventType: o = "mousedown" } = g, r = Ct(null);
|
|
23
|
+
return oe(() => {
|
|
24
|
+
const c = (D) => {
|
|
25
|
+
const i = D.target;
|
|
26
|
+
r.current && r.current.contains(i) || i instanceof Element && (i.closest("[data-radix-popper-content-wrapper]") || i.closest("[data-radix-select-content]") || i.closest("[data-radix-popover-content]") || i.closest("[data-radix-dropdown-menu-content]") || i.closest("[data-radix-tooltip-content]") || i.closest('[role="listbox"]') || i.closest('[role="option"]') || i.closest('[role="combobox"]')) || i instanceof Element && i.hasAttribute("data-radix-") || t();
|
|
27
|
+
};
|
|
28
|
+
return p && document.addEventListener(o, c), () => {
|
|
29
|
+
document.removeEventListener(o, c);
|
|
30
|
+
};
|
|
31
|
+
}, [t, p, o]), r;
|
|
32
|
+
}
|
|
33
|
+
function ze() {
|
|
34
|
+
return /* @__PURE__ */ e("div", { className: "space-y-1 px-2 py-2", children: [...Array(5)].map((t, g) => /* @__PURE__ */ n(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
className: "flex animate-pulse items-start gap-3 rounded-md px-2 py-2",
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ e("div", { className: "mt-0.5 h-4 w-4 flex-shrink-0 rounded bg-muted/60" }),
|
|
40
|
+
/* @__PURE__ */ n("div", { className: "flex-1 space-y-1.5", children: [
|
|
41
|
+
/* @__PURE__ */ e("div", { className: "h-4 w-3/5 rounded bg-muted/60" }),
|
|
42
|
+
/* @__PURE__ */ e("div", { className: "h-3 w-4/5 rounded bg-muted/40" })
|
|
43
|
+
] })
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
g
|
|
47
|
+
)) });
|
|
48
|
+
}
|
|
49
|
+
const Et = (t) => {
|
|
50
|
+
const g = ie((r) => r.isVisualEditing), p = ie((r) => r.selectedFrameId), o = qe((r) => r.frame);
|
|
51
|
+
return !!(g && p && (o == null ? void 0 : o.visualId) === t);
|
|
52
|
+
};
|
|
53
|
+
function Vt({
|
|
54
|
+
visual: t,
|
|
55
|
+
isDeleting: g,
|
|
56
|
+
isDuplicating: p,
|
|
57
|
+
onAddVisual: o,
|
|
58
|
+
onOpenVisual: r,
|
|
59
|
+
onEditDetails: c,
|
|
60
|
+
onDeleteClick: D,
|
|
61
|
+
onDuplicateVisual: i,
|
|
62
|
+
// onTogglePrivacy,
|
|
63
|
+
onShareVisual: w,
|
|
64
|
+
formatDate: b
|
|
65
|
+
}) {
|
|
66
|
+
var T, I, v, z;
|
|
67
|
+
const { selectVisual: u } = le(), h = Ge(t.id), d = Et(t.id), A = ie((f) => f.isVisualEditing), { isConsoleMode: O } = Ke(), x = vt.useRef(null), [V, y] = N(!1), [S, F] = N(!1);
|
|
68
|
+
oe(() => {
|
|
69
|
+
p ? (y(!0), F(!0)) : S && (y(!1), F(!1));
|
|
70
|
+
}, [p, S]), oe(() => {
|
|
71
|
+
d && x.current && x.current.scrollIntoView({
|
|
72
|
+
behavior: "smooth",
|
|
73
|
+
block: "center"
|
|
74
|
+
});
|
|
75
|
+
}, [d]);
|
|
76
|
+
const j = () => {
|
|
77
|
+
u(t), r == null || r(t);
|
|
78
|
+
};
|
|
79
|
+
return /* @__PURE__ */ e(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
ref: x,
|
|
83
|
+
className: re(
|
|
84
|
+
"group flex cursor-pointer items-start rounded-md px-2 py-2 transition-colors hover:bg-muted",
|
|
85
|
+
d ? "bg-purple-500/10" : h && "bg-muted/80"
|
|
86
|
+
),
|
|
87
|
+
onClick: j,
|
|
88
|
+
children: /* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ n("div", { className: "flex items-start justify-between gap-2", children: [
|
|
89
|
+
/* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
|
|
90
|
+
/* @__PURE__ */ e(
|
|
91
|
+
"p",
|
|
92
|
+
{
|
|
93
|
+
className: "truncate text-sm font-medium text-foreground",
|
|
94
|
+
title: t.title || "Untitled Visual",
|
|
95
|
+
children: t.title || "Untitled Visual"
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ e(
|
|
99
|
+
"p",
|
|
100
|
+
{
|
|
101
|
+
className: "truncate text-xs text-muted-foreground",
|
|
102
|
+
title: t.description || "No description",
|
|
103
|
+
children: (T = t.description) != null && T.trim() ? t.description : "No description"
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
] }),
|
|
107
|
+
/* @__PURE__ */ e(
|
|
108
|
+
"div",
|
|
109
|
+
{
|
|
110
|
+
className: "flex flex-shrink-0 items-center gap-1",
|
|
111
|
+
onClick: (f) => f.stopPropagation(),
|
|
112
|
+
children: /* @__PURE__ */ n("div", { className: "inline-flex items-center overflow-hidden rounded-md border border-input", children: [
|
|
113
|
+
/* @__PURE__ */ n(
|
|
114
|
+
U,
|
|
115
|
+
{
|
|
116
|
+
size: "sm",
|
|
117
|
+
variant: "outline",
|
|
118
|
+
className: "h-7 gap-1 rounded-none border-0 px-2 text-xs shadow-none",
|
|
119
|
+
disabled: A,
|
|
120
|
+
onClick: (f) => {
|
|
121
|
+
f.stopPropagation(), o(t);
|
|
122
|
+
},
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ e(pe, { className: "h-3.5 w-3.5" }),
|
|
125
|
+
"Add"
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
/* @__PURE__ */ n(
|
|
130
|
+
We,
|
|
131
|
+
{
|
|
132
|
+
modal: !1,
|
|
133
|
+
open: V,
|
|
134
|
+
onOpenChange: y,
|
|
135
|
+
children: [
|
|
136
|
+
/* @__PURE__ */ e(Ye, { asChild: !0, children: /* @__PURE__ */ e(
|
|
137
|
+
U,
|
|
138
|
+
{
|
|
139
|
+
size: "sm",
|
|
140
|
+
variant: "outline",
|
|
141
|
+
className: "h-7 w-7 rounded-none border-0 border-l border-input p-0 shadow-none",
|
|
142
|
+
"aria-label": "Open visual actions",
|
|
143
|
+
children: /* @__PURE__ */ e(Xe, { className: "h-3 w-3" })
|
|
144
|
+
}
|
|
145
|
+
) }),
|
|
146
|
+
/* @__PURE__ */ n(Je, { align: "end", className: "z-[51] w-40", children: [
|
|
147
|
+
/* @__PURE__ */ n(
|
|
148
|
+
X,
|
|
149
|
+
{
|
|
150
|
+
onClick: (f) => {
|
|
151
|
+
f.stopPropagation(), o(t);
|
|
152
|
+
},
|
|
153
|
+
disabled: A,
|
|
154
|
+
children: [
|
|
155
|
+
/* @__PURE__ */ e(pe, { className: "mr-2 h-3 w-3" }),
|
|
156
|
+
"Add"
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
),
|
|
160
|
+
/* @__PURE__ */ n(
|
|
161
|
+
X,
|
|
162
|
+
{
|
|
163
|
+
onClick: (f) => {
|
|
164
|
+
f.stopPropagation(), r == null || r(t);
|
|
165
|
+
},
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ e(yt, { className: "mr-2 h-3 w-3" }),
|
|
168
|
+
"Open"
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
/* @__PURE__ */ n(
|
|
173
|
+
X,
|
|
174
|
+
{
|
|
175
|
+
onClick: (f) => {
|
|
176
|
+
f.preventDefault(), f.stopPropagation(), i(t.id);
|
|
177
|
+
},
|
|
178
|
+
disabled: p,
|
|
179
|
+
children: [
|
|
180
|
+
p ? /* @__PURE__ */ e(de, { className: "mr-2 h-3 w-3 animate-spin" }) : /* @__PURE__ */ e(Qe, { className: "mr-2 h-3 w-3" }),
|
|
181
|
+
p ? "Duplicating..." : "Duplicate"
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
),
|
|
185
|
+
t.ownership.isOwner && /* @__PURE__ */ n(ge, { children: [
|
|
186
|
+
/* @__PURE__ */ n(
|
|
187
|
+
X,
|
|
188
|
+
{
|
|
189
|
+
onClick: (f) => {
|
|
190
|
+
f.stopPropagation(), c == null || c(t);
|
|
191
|
+
},
|
|
192
|
+
children: [
|
|
193
|
+
/* @__PURE__ */ e(Ze, { className: "mr-2 h-3 w-3" }),
|
|
194
|
+
"Edit details"
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
),
|
|
198
|
+
/* @__PURE__ */ n(
|
|
199
|
+
X,
|
|
200
|
+
{
|
|
201
|
+
onClick: (f) => {
|
|
202
|
+
f.stopPropagation(), w(t);
|
|
203
|
+
},
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ e($e, { className: "mr-2 h-3 w-3" }),
|
|
206
|
+
"Share"
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
),
|
|
210
|
+
/* @__PURE__ */ e(ve, {}),
|
|
211
|
+
/* @__PURE__ */ n(
|
|
212
|
+
X,
|
|
213
|
+
{
|
|
214
|
+
onClick: (f) => {
|
|
215
|
+
f.stopPropagation(), D(t);
|
|
216
|
+
},
|
|
217
|
+
className: "text-destructive",
|
|
218
|
+
disabled: g,
|
|
219
|
+
children: [
|
|
220
|
+
/* @__PURE__ */ e(De, { className: "mr-2 h-3 w-3" }),
|
|
221
|
+
g ? "Deleting..." : "Delete"
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
)
|
|
225
|
+
] }),
|
|
226
|
+
/* @__PURE__ */ e(ve, {}),
|
|
227
|
+
/* @__PURE__ */ n("div", { className: "space-y-1 px-2 py-2 text-xs text-slate-500 dark:text-slate-400", children: [
|
|
228
|
+
(((I = t.ownership.createdBy) == null ? void 0 : I.type) === "tenant" || ((v = t.ownership.createdBy) == null ? void 0 : v.type) === "organization" && O) && /* @__PURE__ */ n("div", { className: "flex items-center gap-1", children: [
|
|
229
|
+
/* @__PURE__ */ e(ke, { className: "h-3 w-3" }),
|
|
230
|
+
/* @__PURE__ */ e("span", { children: ((z = t.ownership.createdBy) == null ? void 0 : z.name) || "Unknown" })
|
|
231
|
+
] }),
|
|
232
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-1", children: [
|
|
233
|
+
/* @__PURE__ */ e(et, { className: "h-3 w-3" }),
|
|
234
|
+
/* @__PURE__ */ e("span", { children: b(t.lastModified) })
|
|
235
|
+
] })
|
|
236
|
+
] })
|
|
237
|
+
] })
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
] })
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
] }) })
|
|
245
|
+
},
|
|
246
|
+
t.id
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
function Lt({ searchQuery: t }) {
|
|
250
|
+
const [g, p] = N(!1), [o, r] = N(
|
|
251
|
+
null
|
|
252
|
+
), [c, D] = N(!1), [i, w] = N(null), [b, u] = N(null), [h, d] = N(
|
|
253
|
+
null
|
|
254
|
+
), { selectVisual: A } = le(), { handleEditLibraryVisual: O, handleAddLibraryVisual: x } = Fe(), {
|
|
255
|
+
resources: V,
|
|
256
|
+
isLoading: y,
|
|
257
|
+
isError: S,
|
|
258
|
+
isFetching: F,
|
|
259
|
+
updateResource: j,
|
|
260
|
+
deleteResource: T,
|
|
261
|
+
duplicateResource: I,
|
|
262
|
+
isDeleting: v,
|
|
263
|
+
isDuplicating: z,
|
|
264
|
+
isUpdating: f
|
|
265
|
+
} = be(() => {
|
|
266
|
+
D(!1), w(null);
|
|
267
|
+
});
|
|
268
|
+
ce();
|
|
269
|
+
const J = V.filter(
|
|
270
|
+
(a) => {
|
|
271
|
+
var L, l;
|
|
272
|
+
return ((L = a == null ? void 0 : a.title) == null ? void 0 : L.toLowerCase().includes(t.toLowerCase())) || ((l = a == null ? void 0 : a.description) == null ? void 0 : l.toLowerCase().includes(t.toLowerCase()));
|
|
273
|
+
}
|
|
274
|
+
), G = (a) => new Date(a).toLocaleDateString("en-US", {
|
|
275
|
+
month: "short",
|
|
276
|
+
day: "numeric",
|
|
277
|
+
year: "numeric"
|
|
278
|
+
}), B = (a) => {
|
|
279
|
+
w(a), D(!0);
|
|
280
|
+
}, M = () => {
|
|
281
|
+
i && T(i.id);
|
|
282
|
+
}, {
|
|
283
|
+
startUpdating: ue,
|
|
284
|
+
stopUpdating: E,
|
|
285
|
+
isUpdating: te
|
|
286
|
+
} = ye(), Q = (a, L, l) => {
|
|
287
|
+
var ne;
|
|
288
|
+
const k = Object.fromEntries(
|
|
289
|
+
Object.entries(L).filter(([, P]) => P !== void 0)
|
|
290
|
+
);
|
|
291
|
+
if (Object.keys(k).length === 0) {
|
|
292
|
+
(ne = l == null ? void 0 : l.onSuccess) == null || ne.call(l);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
const se = Object.keys(k), ee = se.length === 1 ? se[0] : void 0;
|
|
296
|
+
ue(a, ee), j(
|
|
297
|
+
{
|
|
298
|
+
resourceId: a,
|
|
299
|
+
data: k
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
onSuccess: () => {
|
|
303
|
+
var P;
|
|
304
|
+
E(a, ee), (P = l == null ? void 0 : l.onSuccess) == null || P.call(l);
|
|
305
|
+
},
|
|
306
|
+
onError: () => {
|
|
307
|
+
var P;
|
|
308
|
+
E(a, ee), (P = l == null ? void 0 : l.onError) == null || P.call(l);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
}, H = (a) => {
|
|
313
|
+
u(a), I(a, {
|
|
314
|
+
onSettled: () => u(null)
|
|
315
|
+
});
|
|
316
|
+
}, _ = (a) => {
|
|
317
|
+
O(a);
|
|
318
|
+
}, Z = (a) => {
|
|
319
|
+
x(a);
|
|
320
|
+
}, K = (a) => {
|
|
321
|
+
const L = V.find((l) => l.id === a);
|
|
322
|
+
L && j({
|
|
323
|
+
resourceId: a,
|
|
324
|
+
data: {
|
|
325
|
+
isPrivate: !L.isPrivate
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}, $ = (a) => {
|
|
329
|
+
r(a), p(!0);
|
|
330
|
+
}, W = (a) => {
|
|
331
|
+
d(a);
|
|
332
|
+
}, Y = () => {
|
|
333
|
+
d(null);
|
|
334
|
+
}, C = ({
|
|
335
|
+
title: a,
|
|
336
|
+
description: L
|
|
337
|
+
}) => {
|
|
338
|
+
if (!h)
|
|
339
|
+
return;
|
|
340
|
+
const l = {};
|
|
341
|
+
a !== h.title && (l.title = a), (h.description || "") !== L && (l.description = L), Q(h.id, l, {
|
|
342
|
+
onSuccess: () => {
|
|
343
|
+
d(null);
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
};
|
|
347
|
+
return y ? /* @__PURE__ */ e(ze, {}) : S ? /* @__PURE__ */ e(Se, { className: "w-full flex-1 pr-2", children: /* @__PURE__ */ n("div", { className: "py-8 text-center text-muted-foreground", children: [
|
|
348
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: "Failed to load visuals" }),
|
|
349
|
+
/* @__PURE__ */ e(
|
|
350
|
+
U,
|
|
351
|
+
{
|
|
352
|
+
variant: "outline",
|
|
353
|
+
size: "sm",
|
|
354
|
+
className: "mt-2",
|
|
355
|
+
onClick: () => window.location.reload(),
|
|
356
|
+
children: "Retry"
|
|
357
|
+
}
|
|
358
|
+
)
|
|
359
|
+
] }) }) : /* @__PURE__ */ n("div", { className: "flex h-full flex-1 flex-col", children: [
|
|
360
|
+
/* @__PURE__ */ e("div", { className: "flex flex-1 basis-0 flex-col gap-3 overflow-y-auto", children: J.length === 0 ? /* @__PURE__ */ n("div", { className: "py-8 text-center", children: [
|
|
361
|
+
/* @__PURE__ */ e("div", { className: "mb-3", children: /* @__PURE__ */ e(tt, { className: "mx-auto h-12 w-12 text-muted-foreground/50" }) }),
|
|
362
|
+
/* @__PURE__ */ e("h3", { className: "mb-1 font-medium text-foreground", children: t ? "No visuals found" : "No visuals yet" }),
|
|
363
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t ? "Try adjusting your search" : 'Click "New" above to add your first visual' })
|
|
364
|
+
] }) : J.map((a) => /* @__PURE__ */ e(
|
|
365
|
+
Vt,
|
|
366
|
+
{
|
|
367
|
+
visual: a,
|
|
368
|
+
onAddVisual: Z,
|
|
369
|
+
onOpenVisual: _,
|
|
370
|
+
onEditDetails: W,
|
|
371
|
+
onDeleteClick: B,
|
|
372
|
+
onDuplicateVisual: H,
|
|
373
|
+
onTogglePrivacy: K,
|
|
374
|
+
onShareVisual: $,
|
|
375
|
+
isDeleting: v,
|
|
376
|
+
isDuplicating: b === a.id,
|
|
377
|
+
formatDate: G
|
|
378
|
+
},
|
|
379
|
+
a.id
|
|
380
|
+
)) }),
|
|
381
|
+
g && o && /* @__PURE__ */ e(
|
|
382
|
+
Ee,
|
|
383
|
+
{
|
|
384
|
+
resource: o,
|
|
385
|
+
resourceType: Ve.VISUAL,
|
|
386
|
+
onClose: () => {
|
|
387
|
+
p(!1), r(null);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
),
|
|
391
|
+
h && /* @__PURE__ */ e(
|
|
392
|
+
Le,
|
|
393
|
+
{
|
|
394
|
+
open: !!h,
|
|
395
|
+
resourceLabel: "Visual",
|
|
396
|
+
initialTitle: h.title || "",
|
|
397
|
+
initialDescription: h.description || "",
|
|
398
|
+
onClose: Y,
|
|
399
|
+
onSave: C,
|
|
400
|
+
isSaving: te(h.id)
|
|
401
|
+
}
|
|
402
|
+
),
|
|
403
|
+
/* @__PURE__ */ e(
|
|
404
|
+
Ae,
|
|
405
|
+
{
|
|
406
|
+
open: c,
|
|
407
|
+
onOpenChange: (a) => {
|
|
408
|
+
!a && v || (D(a), a || w(null));
|
|
409
|
+
},
|
|
410
|
+
children: /* @__PURE__ */ n(Oe, { children: [
|
|
411
|
+
/* @__PURE__ */ n(Te, { children: [
|
|
412
|
+
/* @__PURE__ */ e(Re, { children: "Delete Visual" }),
|
|
413
|
+
/* @__PURE__ */ n(Pe, { children: [
|
|
414
|
+
'Are you sure you want to delete "',
|
|
415
|
+
i == null ? void 0 : i.title,
|
|
416
|
+
'"? This action cannot be undone.'
|
|
417
|
+
] })
|
|
418
|
+
] }),
|
|
419
|
+
/* @__PURE__ */ n(Ue, { children: [
|
|
420
|
+
/* @__PURE__ */ e(je, { disabled: v, children: "Cancel" }),
|
|
421
|
+
/* @__PURE__ */ n(
|
|
422
|
+
Ie,
|
|
423
|
+
{
|
|
424
|
+
onClick: (a) => {
|
|
425
|
+
a.preventDefault(), a.stopPropagation(), M();
|
|
426
|
+
},
|
|
427
|
+
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
428
|
+
disabled: v,
|
|
429
|
+
children: [
|
|
430
|
+
v ? /* @__PURE__ */ e(de, { className: "mr-2 h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(De, { className: "mr-2 h-3.5 w-3.5" }),
|
|
431
|
+
v ? "Deleting..." : "Delete"
|
|
432
|
+
]
|
|
433
|
+
}
|
|
434
|
+
)
|
|
435
|
+
] })
|
|
436
|
+
] })
|
|
437
|
+
}
|
|
438
|
+
)
|
|
439
|
+
] });
|
|
440
|
+
}
|
|
441
|
+
function At({
|
|
442
|
+
dashboard: t,
|
|
443
|
+
isDeleting: g,
|
|
444
|
+
isDuplicating: p,
|
|
445
|
+
onLoadDashboard: o,
|
|
446
|
+
onEditDetails: r,
|
|
447
|
+
onDeleteClick: c,
|
|
448
|
+
onDuplicateDashboard: D,
|
|
449
|
+
onShareDashboard: i,
|
|
450
|
+
formatDate: w,
|
|
451
|
+
onDashboardItemClick: b
|
|
452
|
+
}) {
|
|
453
|
+
var y, S;
|
|
454
|
+
const { selectDashboard: u } = le(), h = st(t.id), { userContext: d, isLoading: A } = ce(), O = ((y = d == null ? void 0 : d.permissions) == null ? void 0 : y.canEdit) ?? !1, x = A || !O, V = () => {
|
|
455
|
+
u(t), o(t.id), b == null || b(t.id);
|
|
456
|
+
};
|
|
457
|
+
return /* @__PURE__ */ e(
|
|
458
|
+
"div",
|
|
459
|
+
{
|
|
460
|
+
className: re(
|
|
461
|
+
"group flex cursor-pointer items-start rounded-md px-2 py-2 transition-colors hover:bg-muted",
|
|
462
|
+
h && "bg-muted/80"
|
|
463
|
+
),
|
|
464
|
+
onClick: V,
|
|
465
|
+
children: /* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ n("div", { className: "flex items-start justify-between gap-2", children: [
|
|
466
|
+
/* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
|
|
467
|
+
/* @__PURE__ */ e(
|
|
468
|
+
"p",
|
|
469
|
+
{
|
|
470
|
+
className: "truncate text-sm font-medium text-foreground",
|
|
471
|
+
title: t.title || "Untitled Dashboard",
|
|
472
|
+
children: t.title || "Untitled Dashboard"
|
|
473
|
+
}
|
|
474
|
+
),
|
|
475
|
+
/* @__PURE__ */ e(
|
|
476
|
+
"p",
|
|
477
|
+
{
|
|
478
|
+
className: "truncate text-xs text-muted-foreground",
|
|
479
|
+
title: t.description || "No description",
|
|
480
|
+
children: (S = t.description) != null && S.trim() ? t.description : "No description"
|
|
481
|
+
}
|
|
482
|
+
)
|
|
483
|
+
] }),
|
|
484
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0 opacity-0 transition-opacity group-hover:opacity-100", children: /* @__PURE__ */ e(
|
|
485
|
+
nt,
|
|
486
|
+
{
|
|
487
|
+
dashboard: t,
|
|
488
|
+
isDeleting: g,
|
|
489
|
+
isDuplicating: p,
|
|
490
|
+
shouldHideActions: x,
|
|
491
|
+
onEditDetails: r,
|
|
492
|
+
onDeleteClick: c,
|
|
493
|
+
onDuplicateDashboard: D,
|
|
494
|
+
onShareDashboard: i,
|
|
495
|
+
formatDate: w
|
|
496
|
+
}
|
|
497
|
+
) })
|
|
498
|
+
] }) })
|
|
499
|
+
},
|
|
500
|
+
t.id
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
function Ot({ onRetry: t }) {
|
|
504
|
+
return /* @__PURE__ */ e(Se, { className: "w-full flex-1 pr-2", children: /* @__PURE__ */ n("div", { className: "py-8 text-center text-muted-foreground", children: [
|
|
505
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: "Failed to load dashboards" }),
|
|
506
|
+
/* @__PURE__ */ e(U, { variant: "outline", size: "sm", className: "mt-2", onClick: t, children: "Retry" })
|
|
507
|
+
] }) });
|
|
508
|
+
}
|
|
509
|
+
function Tt(t) {
|
|
510
|
+
var xe;
|
|
511
|
+
const { searchQuery: g, onLoadDashboard: p, onEditDashboard: o, onDashboardItemClick: r } = t, [c, D] = N(!1), [i, w] = N(
|
|
512
|
+
null
|
|
513
|
+
), [b, u] = N(!1), [h, d] = N(null), [A, O] = N(null), [x, V] = N(null), y = ae(
|
|
514
|
+
(s) => s.lastSelectedDashboard
|
|
515
|
+
), S = ae(
|
|
516
|
+
(s) => s.selectedDashboard
|
|
517
|
+
), F = ae(
|
|
518
|
+
(s) => s.actions.selectDashboard
|
|
519
|
+
), j = ae(
|
|
520
|
+
(s) => s.actions.clearSelectedDashboard
|
|
521
|
+
), { tokenProps: T, id: I } = at();
|
|
522
|
+
bt();
|
|
523
|
+
const {
|
|
524
|
+
resources: v,
|
|
525
|
+
isLoading: z,
|
|
526
|
+
isError: f,
|
|
527
|
+
isFetching: J,
|
|
528
|
+
updateResource: G,
|
|
529
|
+
deleteResource: B,
|
|
530
|
+
duplicateResource: M,
|
|
531
|
+
isUpdating: ue,
|
|
532
|
+
isDeleting: E,
|
|
533
|
+
isDuplicating: te,
|
|
534
|
+
refetch: Q
|
|
535
|
+
} = Me(() => {
|
|
536
|
+
u(!1);
|
|
537
|
+
const s = h == null ? void 0 : h.id;
|
|
538
|
+
d(null), (S == null ? void 0 : S.id) === s && (!(T != null && T.dashboard_id) && !I ? j() : y && y.id !== s && F(y));
|
|
539
|
+
}), { currentUser: H, userContext: _ } = ce(), Z = ((xe = _ == null ? void 0 : _.permissions) == null ? void 0 : xe.canCreateDashboard) ?? !1, K = v.filter(
|
|
540
|
+
(s) => {
|
|
541
|
+
var R, m;
|
|
542
|
+
return ((R = s == null ? void 0 : s.title) == null ? void 0 : R.toLowerCase().includes(g.toLowerCase())) || ((m = s == null ? void 0 : s.description) == null ? void 0 : m.toLowerCase().includes(g.toLowerCase()));
|
|
543
|
+
}
|
|
544
|
+
), $ = (s) => new Date(s).toLocaleDateString("en-US", {
|
|
545
|
+
month: "short",
|
|
546
|
+
day: "numeric",
|
|
547
|
+
year: "numeric"
|
|
548
|
+
}), W = (s) => {
|
|
549
|
+
p == null || p(s);
|
|
550
|
+
}, Y = (s) => {
|
|
551
|
+
d(s), u(!0);
|
|
552
|
+
}, C = () => {
|
|
553
|
+
h && B(h.id);
|
|
554
|
+
}, a = (s) => {
|
|
555
|
+
O(s), M(s, {
|
|
556
|
+
onSettled: () => O(null)
|
|
557
|
+
});
|
|
558
|
+
}, {
|
|
559
|
+
startUpdating: L,
|
|
560
|
+
stopUpdating: l,
|
|
561
|
+
isUpdating: k
|
|
562
|
+
} = ye(), se = (s, R, m) => {
|
|
563
|
+
var we;
|
|
564
|
+
const he = Object.fromEntries(
|
|
565
|
+
Object.entries(R).filter(([, q]) => q !== void 0)
|
|
566
|
+
);
|
|
567
|
+
if (Object.keys(he).length === 0) {
|
|
568
|
+
(we = m == null ? void 0 : m.onSuccess) == null || we.call(m);
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
const Ne = Object.keys(he), me = Ne.length === 1 ? Ne[0] : void 0;
|
|
572
|
+
L(s, me), G(
|
|
573
|
+
{
|
|
574
|
+
resourceId: s,
|
|
575
|
+
data: he
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
onSuccess: () => {
|
|
579
|
+
var q;
|
|
580
|
+
l(s, me), (q = m == null ? void 0 : m.onSuccess) == null || q.call(m);
|
|
581
|
+
},
|
|
582
|
+
onError: () => {
|
|
583
|
+
var q;
|
|
584
|
+
l(s, me), (q = m == null ? void 0 : m.onError) == null || q.call(m);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
);
|
|
588
|
+
}, ee = (s) => {
|
|
589
|
+
const R = v.find(
|
|
590
|
+
(m) => m.id === s
|
|
591
|
+
);
|
|
592
|
+
R && G({
|
|
593
|
+
resourceId: s,
|
|
594
|
+
data: {
|
|
595
|
+
isPrivate: !R.isPrivate
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
}, ne = (s) => {
|
|
599
|
+
w(s), H == null || H.type, D(!0);
|
|
600
|
+
}, P = (s) => {
|
|
601
|
+
o == null || o(s.id), V(s);
|
|
602
|
+
}, Be = () => {
|
|
603
|
+
V(null);
|
|
604
|
+
}, He = ({
|
|
605
|
+
title: s,
|
|
606
|
+
description: R
|
|
607
|
+
}) => {
|
|
608
|
+
if (!x)
|
|
609
|
+
return;
|
|
610
|
+
const m = {};
|
|
611
|
+
s !== x.title && (m.title = s), (x.description || "") !== R && (m.description = R), se(x.id, m, {
|
|
612
|
+
onSuccess: () => {
|
|
613
|
+
V(null);
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
};
|
|
617
|
+
return z ? /* @__PURE__ */ e(ze, {}) : f ? /* @__PURE__ */ e(Ot, { onRetry: () => window.location.reload() }) : /* @__PURE__ */ n("div", { className: "flex h-full flex-1 flex-col", children: [
|
|
618
|
+
/* @__PURE__ */ e("div", { className: "flex flex-1 basis-0 flex-col gap-3 overflow-y-auto", children: K.length === 0 ? /* @__PURE__ */ n("div", { className: "py-8 text-center", children: [
|
|
619
|
+
/* @__PURE__ */ e("div", { className: "mb-3", children: /* @__PURE__ */ e(it, { className: "mx-auto h-12 w-12 text-muted-foreground/50" }) }),
|
|
620
|
+
/* @__PURE__ */ e("h3", { className: "mb-1 font-medium text-foreground", children: g ? "No dashboards found" : "No dashboards yet" }),
|
|
621
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: g ? "Try adjusting your search" : Z ? 'Click "New" above to add your first dashboard' : "No dashboards have been shared with you yet" })
|
|
622
|
+
] }) : K.map((s) => /* @__PURE__ */ e(
|
|
623
|
+
At,
|
|
624
|
+
{
|
|
625
|
+
dashboard: s,
|
|
626
|
+
isDeleting: E,
|
|
627
|
+
isDuplicating: A === s.id,
|
|
628
|
+
onLoadDashboard: W,
|
|
629
|
+
onEditDetails: P,
|
|
630
|
+
onDeleteClick: Y,
|
|
631
|
+
onDuplicateDashboard: a,
|
|
632
|
+
onTogglePrivacy: ee,
|
|
633
|
+
onShareDashboard: ne,
|
|
634
|
+
formatDate: $,
|
|
635
|
+
onDashboardItemClick: r
|
|
636
|
+
},
|
|
637
|
+
s.id
|
|
638
|
+
)) }),
|
|
639
|
+
c && i && /* @__PURE__ */ e(
|
|
640
|
+
Ee,
|
|
641
|
+
{
|
|
642
|
+
resource: i,
|
|
643
|
+
resourceType: Ve.DASHBOARD,
|
|
644
|
+
onClose: () => {
|
|
645
|
+
D(!1), w(null);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
),
|
|
649
|
+
/* @__PURE__ */ e(
|
|
650
|
+
Ae,
|
|
651
|
+
{
|
|
652
|
+
open: b,
|
|
653
|
+
onOpenChange: (s) => {
|
|
654
|
+
!s && E || (u(s), s || d(null));
|
|
655
|
+
},
|
|
656
|
+
children: /* @__PURE__ */ n(Oe, { children: [
|
|
657
|
+
/* @__PURE__ */ n(Te, { children: [
|
|
658
|
+
/* @__PURE__ */ e(Re, { children: "Delete Dashboard" }),
|
|
659
|
+
/* @__PURE__ */ n(Pe, { children: [
|
|
660
|
+
'Are you sure you want to delete "',
|
|
661
|
+
h == null ? void 0 : h.title,
|
|
662
|
+
'"? This action cannot be undone.'
|
|
663
|
+
] })
|
|
664
|
+
] }),
|
|
665
|
+
/* @__PURE__ */ n(Ue, { children: [
|
|
666
|
+
/* @__PURE__ */ e(je, { disabled: E, children: "Cancel" }),
|
|
667
|
+
/* @__PURE__ */ n(
|
|
668
|
+
Ie,
|
|
669
|
+
{
|
|
670
|
+
onClick: (s) => {
|
|
671
|
+
s.preventDefault(), s.stopPropagation(), C();
|
|
672
|
+
},
|
|
673
|
+
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
674
|
+
disabled: E,
|
|
675
|
+
children: [
|
|
676
|
+
E ? /* @__PURE__ */ e(de, { className: "mr-2 h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(De, { className: "mr-2 h-3.5 w-3.5" }),
|
|
677
|
+
E ? "Deleting..." : "Delete"
|
|
678
|
+
]
|
|
679
|
+
}
|
|
680
|
+
)
|
|
681
|
+
] })
|
|
682
|
+
] })
|
|
683
|
+
}
|
|
684
|
+
),
|
|
685
|
+
x && /* @__PURE__ */ e(
|
|
686
|
+
Le,
|
|
687
|
+
{
|
|
688
|
+
open: !!x,
|
|
689
|
+
resourceLabel: "Dashboard",
|
|
690
|
+
initialTitle: x.title || "",
|
|
691
|
+
initialDescription: x.description || "",
|
|
692
|
+
onClose: Be,
|
|
693
|
+
onSave: He,
|
|
694
|
+
isSaving: k(x.id)
|
|
695
|
+
}
|
|
696
|
+
)
|
|
697
|
+
] });
|
|
698
|
+
}
|
|
699
|
+
function Rt({
|
|
700
|
+
open: t,
|
|
701
|
+
onOpenChange: g,
|
|
702
|
+
onSubmit: p,
|
|
703
|
+
isCreating: o
|
|
704
|
+
}) {
|
|
705
|
+
const [r, c] = N(""), [D, i] = N("");
|
|
706
|
+
oe(() => {
|
|
707
|
+
t || (c(""), i(""));
|
|
708
|
+
}, [t]);
|
|
709
|
+
const w = () => {
|
|
710
|
+
r.trim() && p({ title: r, description: D });
|
|
711
|
+
}, b = (u) => {
|
|
712
|
+
g(u);
|
|
713
|
+
};
|
|
714
|
+
return /* @__PURE__ */ e(rt, { open: t, onOpenChange: b, children: /* @__PURE__ */ n(ot, { children: [
|
|
715
|
+
/* @__PURE__ */ n(lt, { children: [
|
|
716
|
+
/* @__PURE__ */ e(dt, { children: "Create New Visual" }),
|
|
717
|
+
/* @__PURE__ */ e(ct, { children: "Add a new visual to your library. You can configure it after creation." })
|
|
718
|
+
] }),
|
|
719
|
+
/* @__PURE__ */ n("div", { className: "space-y-4 py-4", children: [
|
|
720
|
+
/* @__PURE__ */ n("div", { className: "space-y-2", children: [
|
|
721
|
+
/* @__PURE__ */ e(Ce, { htmlFor: "title", children: "Visual Title" }),
|
|
722
|
+
/* @__PURE__ */ e(
|
|
723
|
+
fe,
|
|
724
|
+
{
|
|
725
|
+
id: "title",
|
|
726
|
+
placeholder: "Enter visual title...",
|
|
727
|
+
value: r,
|
|
728
|
+
onChange: (u) => c(u.target.value),
|
|
729
|
+
disabled: o,
|
|
730
|
+
onKeyDown: (u) => {
|
|
731
|
+
u.key === "Enter" && !u.shiftKey && (u.preventDefault(), w());
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
)
|
|
735
|
+
] }),
|
|
736
|
+
/* @__PURE__ */ n("div", { className: "space-y-2", children: [
|
|
737
|
+
/* @__PURE__ */ e(Ce, { htmlFor: "description", children: "Description (optional)" }),
|
|
738
|
+
/* @__PURE__ */ e(
|
|
739
|
+
fe,
|
|
740
|
+
{
|
|
741
|
+
id: "description",
|
|
742
|
+
placeholder: "Enter visual description...",
|
|
743
|
+
value: D,
|
|
744
|
+
onChange: (u) => i(u.target.value),
|
|
745
|
+
disabled: o
|
|
746
|
+
}
|
|
747
|
+
)
|
|
748
|
+
] })
|
|
749
|
+
] }),
|
|
750
|
+
/* @__PURE__ */ n(ut, { children: [
|
|
751
|
+
/* @__PURE__ */ e(
|
|
752
|
+
U,
|
|
753
|
+
{
|
|
754
|
+
variant: "outline",
|
|
755
|
+
onClick: () => b(!1),
|
|
756
|
+
disabled: o,
|
|
757
|
+
children: "Cancel"
|
|
758
|
+
}
|
|
759
|
+
),
|
|
760
|
+
/* @__PURE__ */ e(
|
|
761
|
+
U,
|
|
762
|
+
{
|
|
763
|
+
onClick: w,
|
|
764
|
+
disabled: !r.trim() || o,
|
|
765
|
+
children: o ? /* @__PURE__ */ n(ge, { children: [
|
|
766
|
+
/* @__PURE__ */ e(de, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
767
|
+
"Creating..."
|
|
768
|
+
] }) : "Create Visual"
|
|
769
|
+
}
|
|
770
|
+
)
|
|
771
|
+
] })
|
|
772
|
+
] }) });
|
|
773
|
+
}
|
|
774
|
+
function Ft({
|
|
775
|
+
isOpen: t,
|
|
776
|
+
onClose: g,
|
|
777
|
+
className: p,
|
|
778
|
+
onDashboardItemClick: o,
|
|
779
|
+
variant: r = "inline"
|
|
780
|
+
}) {
|
|
781
|
+
var W, Y;
|
|
782
|
+
const c = ie(
|
|
783
|
+
(C) => C.isDashboardEditing
|
|
784
|
+
), [D, i] = N(!1), [w, b] = N(""), [u, h] = N(!1), { currentUser: d, userContext: A } = ce(), O = ((W = A == null ? void 0 : A.permissions) == null ? void 0 : W.canCreateDashboard) ?? !1, { onCreateSuccess: x } = ht({
|
|
785
|
+
onDashboardSelect: o
|
|
786
|
+
}), { selectVisual: V } = le(), { handleEditLibraryVisual: y } = Fe(), {
|
|
787
|
+
createResource: S,
|
|
788
|
+
isCreating: F,
|
|
789
|
+
refetch: j
|
|
790
|
+
} = Me(), { createResource: T, isCreating: I } = be(
|
|
791
|
+
void 0,
|
|
792
|
+
// onDeleteSuccess (not needed here)
|
|
793
|
+
(C) => {
|
|
794
|
+
i(!1), C && (V(C), y(C));
|
|
795
|
+
}
|
|
796
|
+
), v = r === "overlay", z = c ? "New Visual" : "New", f = c ? "New Visual" : "New Dashboard", J = c ? "Search visuals..." : "Search dashboards...", G = c ? "Collapse visuals panel" : "Collapse dashboard panel", B = ((d == null ? void 0 : d.name) ?? "").trim(), M = ((d == null ? void 0 : d.email) ?? "").trim(), E = B && B.toLowerCase() !== "undefined" ? B : M || "Current user", te = ((Y = E.charAt(0)) == null ? void 0 : Y.toUpperCase()) || "?", Q = M && M.toLowerCase() !== "undefined" ? M : "", H = St(g, {
|
|
797
|
+
enabled: t && v
|
|
798
|
+
}), _ = re(
|
|
799
|
+
"flex h-full flex-col border-r bg-background",
|
|
800
|
+
v ? re(
|
|
801
|
+
"absolute inset-y-0 left-0 z-[51] w-60 shadow-lg transition-transform duration-300 ease-in-out",
|
|
802
|
+
t ? "translate-x-0" : "pointer-events-none -translate-x-full"
|
|
803
|
+
) : "w-full max-w-[17rem] min-w-[11rem] overflow-hidden shadow-sm",
|
|
804
|
+
p
|
|
805
|
+
), Z = (C) => {
|
|
806
|
+
}, K = (C) => {
|
|
807
|
+
console.log("Editing dashboard:", C);
|
|
808
|
+
}, $ = (C) => {
|
|
809
|
+
S(C, {
|
|
810
|
+
onSuccess: (a) => {
|
|
811
|
+
i(!1), x(a, j);
|
|
812
|
+
}
|
|
813
|
+
});
|
|
814
|
+
};
|
|
815
|
+
return /* @__PURE__ */ e(ge, { children: (!v || t) && /* @__PURE__ */ n("div", { ref: H, className: _, children: [
|
|
816
|
+
/* @__PURE__ */ n("div", { className: "border-b border-border", children: [
|
|
817
|
+
/* @__PURE__ */ n("div", { className: "flex items-center justify-between px-4 py-1.5", children: [
|
|
818
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e("h2", { className: "whitespace-nowrap text-sm font-semibold", children: c ? "Visuals" : "Dashboards" }) }),
|
|
819
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-1", children: [
|
|
820
|
+
/* @__PURE__ */ e(
|
|
821
|
+
U,
|
|
822
|
+
{
|
|
823
|
+
size: "sm",
|
|
824
|
+
variant: "ghost",
|
|
825
|
+
onClick: () => h(!u),
|
|
826
|
+
className: "h-8 w-8 p-0",
|
|
827
|
+
"aria-label": u ? "Hide search" : "Show search",
|
|
828
|
+
children: /* @__PURE__ */ e(mt, { className: "h-3.5 w-3.5" })
|
|
829
|
+
}
|
|
830
|
+
),
|
|
831
|
+
(c || O) && /* @__PURE__ */ n(
|
|
832
|
+
U,
|
|
833
|
+
{
|
|
834
|
+
size: "sm",
|
|
835
|
+
variant: "ghost",
|
|
836
|
+
className: "h-8 gap-1.5 whitespace-nowrap px-2 text-xs",
|
|
837
|
+
onClick: () => i(!0),
|
|
838
|
+
"aria-label": f,
|
|
839
|
+
children: [
|
|
840
|
+
/* @__PURE__ */ e(pe, { className: "h-3.5 w-3.5" }),
|
|
841
|
+
z
|
|
842
|
+
]
|
|
843
|
+
}
|
|
844
|
+
),
|
|
845
|
+
/* @__PURE__ */ e(
|
|
846
|
+
U,
|
|
847
|
+
{
|
|
848
|
+
size: "sm",
|
|
849
|
+
variant: "secondary",
|
|
850
|
+
className: "h-7 w-7 p-0.5",
|
|
851
|
+
onClick: g,
|
|
852
|
+
"aria-label": G,
|
|
853
|
+
children: /* @__PURE__ */ e(pt, { className: "h-3.5 w-3.5" })
|
|
854
|
+
}
|
|
855
|
+
)
|
|
856
|
+
] })
|
|
857
|
+
] }),
|
|
858
|
+
u && /* @__PURE__ */ e("div", { className: "bg-muted/30 px-4 pb-3", children: /* @__PURE__ */ e(
|
|
859
|
+
fe,
|
|
860
|
+
{
|
|
861
|
+
placeholder: J,
|
|
862
|
+
value: w,
|
|
863
|
+
onChange: (C) => b(C.target.value),
|
|
864
|
+
className: "h-8 border-muted-foreground/20 bg-background text-sm focus-visible:border-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0",
|
|
865
|
+
autoFocus: !0
|
|
866
|
+
}
|
|
867
|
+
) })
|
|
868
|
+
] }),
|
|
869
|
+
/* @__PURE__ */ e("div", { className: "flex flex-1 flex-col overflow-auto px-2 py-2", children: c ? /* @__PURE__ */ e(Lt, { searchQuery: w }) : /* @__PURE__ */ e(
|
|
870
|
+
Tt,
|
|
871
|
+
{
|
|
872
|
+
searchQuery: w,
|
|
873
|
+
onLoadDashboard: Z,
|
|
874
|
+
onEditDashboard: K,
|
|
875
|
+
onDashboardItemClick: o
|
|
876
|
+
}
|
|
877
|
+
) }),
|
|
878
|
+
d && /* @__PURE__ */ e(ft, { children: /* @__PURE__ */ e("div", { className: "border-t border-border px-4 py-2", children: /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
879
|
+
/* @__PURE__ */ n(gt, { children: [
|
|
880
|
+
/* @__PURE__ */ e(Dt, { asChild: !0, children: /* @__PURE__ */ e("div", { className: "flex h-6 w-6 cursor-default items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ e("span", { className: "text-xs font-medium text-primary", children: te }) }) }),
|
|
881
|
+
/* @__PURE__ */ e(xt, { side: "top", className: "max-w-xs", children: /* @__PURE__ */ n("div", { className: "space-y-1", children: [
|
|
882
|
+
/* @__PURE__ */ e("div", { className: "font-medium", children: E }),
|
|
883
|
+
Q && /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground", children: Q }),
|
|
884
|
+
d.role && /* @__PURE__ */ n("div", { className: "text-xs text-muted-foreground", children: [
|
|
885
|
+
"Role: ",
|
|
886
|
+
Nt(d.role.replace(/_/g, " "))
|
|
887
|
+
] })
|
|
888
|
+
] }) })
|
|
889
|
+
] }),
|
|
890
|
+
/* @__PURE__ */ e("span", { className: "truncate text-xs text-muted-foreground", children: E })
|
|
891
|
+
] }) }) }),
|
|
892
|
+
c ? /* @__PURE__ */ e(
|
|
893
|
+
Rt,
|
|
894
|
+
{
|
|
895
|
+
open: D,
|
|
896
|
+
onOpenChange: i,
|
|
897
|
+
onSubmit: T,
|
|
898
|
+
isCreating: I
|
|
899
|
+
}
|
|
900
|
+
) : /* @__PURE__ */ e(
|
|
901
|
+
wt,
|
|
902
|
+
{
|
|
903
|
+
open: D,
|
|
904
|
+
onOpenChange: i,
|
|
905
|
+
onSubmit: $,
|
|
906
|
+
isCreating: F
|
|
907
|
+
}
|
|
908
|
+
)
|
|
909
|
+
] }) });
|
|
910
|
+
}
|
|
911
|
+
export {
|
|
912
|
+
Ft as ResourceManagementPanel
|
|
913
|
+
};
|