@nivaro/react 0.3.87 → 0.3.88
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 +18 -0
- package/dist/index.js +518 -516
- package/dist/shared/components/ops-report/CompareTab.js +110 -0
- package/dist/shared/components/ops-report/DigestSections.js +1134 -0
- package/dist/shared/components/ops-report/OpsReportView.js +88 -0
- package/dist/shared/components/ops-report/ReportTab.js +527 -0
- package/dist/shared/components/ops-report/SettingsPanel.js +247 -0
- package/dist/shared/components/ops-report/TrendsTab.js +191 -0
- package/dist/shared/components/ops-report/chip.js +17 -0
- package/dist/shared/components/ops-report/drill.js +328 -0
- package/dist/shared/components/ops-report/format.js +163 -0
- package/dist/shared/components/ops-report/ui.js +208 -0
- package/dist/shared/lib/ops-report-types.js +141 -0
- package/package.json +1 -1
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { jsxs as m, jsx as t, Fragment as E } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as T, useQuery as j, useMutation as O } from "@tanstack/react-query";
|
|
3
|
+
import { Settings2 as W } from "lucide-react";
|
|
4
|
+
import { useState as w, useEffect as q } from "react";
|
|
5
|
+
import { useNivaroClient as P } from "../../context.js";
|
|
6
|
+
import { get as M, patch as B } from "../../lib/commands.js";
|
|
7
|
+
import { toastError as z } from "../../lib/error-toast.js";
|
|
8
|
+
import { cn as v } from "../../lib/utils.js";
|
|
9
|
+
import { ErrorNotice as C } from "../ErrorNotice.js";
|
|
10
|
+
import { Button as k } from "../ui/button.js";
|
|
11
|
+
import { Input as N } from "../ui/input.js";
|
|
12
|
+
import { Popover as D, PopoverTrigger as I, PopoverContent as L } from "../ui/popover.js";
|
|
13
|
+
import { Switch as F } from "../ui/switch.js";
|
|
14
|
+
const S = [
|
|
15
|
+
"enabled",
|
|
16
|
+
"window_start_hour",
|
|
17
|
+
"window_end_hour",
|
|
18
|
+
"email",
|
|
19
|
+
"notify",
|
|
20
|
+
"model",
|
|
21
|
+
"token_cap"
|
|
22
|
+
];
|
|
23
|
+
function Q(d) {
|
|
24
|
+
var x, g, o, b, y, p;
|
|
25
|
+
const r = d, l = ((x = r == null ? void 0 : r.response) == null ? void 0 : x.fields) ?? ((g = r == null ? void 0 : r.body) == null ? void 0 : g.fields);
|
|
26
|
+
if (l && typeof l == "object") {
|
|
27
|
+
const a = {}, n = [];
|
|
28
|
+
for (const [e, c] of Object.entries(l))
|
|
29
|
+
S.includes(e) ? a[e] = String(c) : n.push(String(c));
|
|
30
|
+
return { byField: a, rest: n };
|
|
31
|
+
}
|
|
32
|
+
const i = [
|
|
33
|
+
(o = r == null ? void 0 : r.response) == null ? void 0 : o.message,
|
|
34
|
+
(b = r == null ? void 0 : r.body) == null ? void 0 : b.message,
|
|
35
|
+
(y = r == null ? void 0 : r.response) == null ? void 0 : y.error,
|
|
36
|
+
(p = r == null ? void 0 : r.body) == null ? void 0 : p.error,
|
|
37
|
+
r == null ? void 0 : r.message
|
|
38
|
+
].find((a) => typeof a == "string" && a.includes(" ")) ?? "", s = {}, f = [];
|
|
39
|
+
for (const a of i.split(";").map((n) => n.trim()).filter(Boolean)) {
|
|
40
|
+
const n = S.find((e) => a.startsWith(e) || a.includes(`${e} `));
|
|
41
|
+
n ? s[n] = a.replace(n, R(n)) : /window/.test(a) ? s.window_end_hour = a : f.push(a);
|
|
42
|
+
}
|
|
43
|
+
return { byField: s, rest: f };
|
|
44
|
+
}
|
|
45
|
+
function R(d) {
|
|
46
|
+
return {
|
|
47
|
+
enabled: "The nightly report",
|
|
48
|
+
window_start_hour: "Window start",
|
|
49
|
+
window_end_hour: "Window end",
|
|
50
|
+
email: "Email",
|
|
51
|
+
notify: "Notification",
|
|
52
|
+
model: "Model",
|
|
53
|
+
token_cap: "Token cap"
|
|
54
|
+
}[d];
|
|
55
|
+
}
|
|
56
|
+
function h({
|
|
57
|
+
label: d,
|
|
58
|
+
hint: r,
|
|
59
|
+
error: l,
|
|
60
|
+
children: u
|
|
61
|
+
}) {
|
|
62
|
+
return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
|
|
63
|
+
/* @__PURE__ */ m("div", { className: "flex items-center justify-between gap-3", children: [
|
|
64
|
+
/* @__PURE__ */ m("div", { className: "min-w-0", children: [
|
|
65
|
+
/* @__PURE__ */ t("div", { className: "text-[12.5px] font-medium text-slate-800 dark:text-foreground", children: d }),
|
|
66
|
+
r && /* @__PURE__ */ t("div", { className: "text-[11px] text-slate-500 dark:text-muted-foreground", children: r })
|
|
67
|
+
] }),
|
|
68
|
+
u
|
|
69
|
+
] }),
|
|
70
|
+
l && /* @__PURE__ */ t("p", { role: "alert", className: "text-[11.5px] text-red-600 dark:text-red-400", children: l })
|
|
71
|
+
] });
|
|
72
|
+
}
|
|
73
|
+
function re() {
|
|
74
|
+
const d = P(), r = T(), [l, u] = w(!1), i = j({
|
|
75
|
+
queryKey: ["ops-report-settings"],
|
|
76
|
+
enabled: l,
|
|
77
|
+
queryFn: () => d.request(M("/ops-reports/settings")).then((e) => e.data)
|
|
78
|
+
}), [s, f] = w(null), [x, g] = w(""), [o, b] = w({ byField: {}, rest: [] }), [y, p] = w(null);
|
|
79
|
+
q(() => {
|
|
80
|
+
i.data && (f(i.data), g(String(i.data.token_cap)));
|
|
81
|
+
}, [i.data]);
|
|
82
|
+
const a = O({
|
|
83
|
+
mutationFn: (e) => d.request(B("/ops-reports/settings", e)),
|
|
84
|
+
onSuccess: (e) => {
|
|
85
|
+
b({ byField: {}, rest: [] }), p(null), r.setQueryData(["ops-report-settings"], e.data), u(!1);
|
|
86
|
+
},
|
|
87
|
+
onError: (e) => {
|
|
88
|
+
const c = Q(e);
|
|
89
|
+
b(c), e.status === 400 && (Object.keys(c.byField).length || c.rest.length) ? p(null) : (p(e), z(e, "Could not save the settings"));
|
|
90
|
+
}
|
|
91
|
+
}), n = (e, c) => f((_) => _ && { ..._, [e]: c });
|
|
92
|
+
return /* @__PURE__ */ m(D, { open: l, onOpenChange: u, children: [
|
|
93
|
+
/* @__PURE__ */ t(I, { asChild: !0, children: /* @__PURE__ */ m(
|
|
94
|
+
k,
|
|
95
|
+
{
|
|
96
|
+
variant: "outline",
|
|
97
|
+
size: "sm",
|
|
98
|
+
className: "h-8 gap-1.5 text-[12.5px]",
|
|
99
|
+
"data-ops-settings": "",
|
|
100
|
+
"aria-label": "Daily report settings",
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ t(W, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
103
|
+
"Settings"
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
) }),
|
|
107
|
+
/* @__PURE__ */ t(L, { align: "end", className: "w-[340px] space-y-3 p-4", children: i.isLoading || !s ? i.error ? /* @__PURE__ */ t(C, { error: i.error, what: "the settings", onRetry: () => void i.refetch() }) : /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-500", children: "Loading…" }) : /* @__PURE__ */ m(E, { children: [
|
|
108
|
+
/* @__PURE__ */ t(h, { label: "Nightly report", hint: "Run now always works.", error: o.byField.enabled, children: /* @__PURE__ */ t(
|
|
109
|
+
F,
|
|
110
|
+
{
|
|
111
|
+
checked: s.enabled,
|
|
112
|
+
onCheckedChange: (e) => n("enabled", e),
|
|
113
|
+
"aria-label": "Nightly report"
|
|
114
|
+
}
|
|
115
|
+
) }),
|
|
116
|
+
/* @__PURE__ */ t(
|
|
117
|
+
h,
|
|
118
|
+
{
|
|
119
|
+
label: "Window starts (hour)",
|
|
120
|
+
hint: "0 to 23, instance time",
|
|
121
|
+
error: o.byField.window_start_hour,
|
|
122
|
+
children: /* @__PURE__ */ t(
|
|
123
|
+
N,
|
|
124
|
+
{
|
|
125
|
+
type: "number",
|
|
126
|
+
min: 0,
|
|
127
|
+
max: 23,
|
|
128
|
+
value: s.window_start_hour,
|
|
129
|
+
onChange: (e) => n("window_start_hour", Number(e.target.value)),
|
|
130
|
+
"aria-label": "Window start hour",
|
|
131
|
+
className: v(
|
|
132
|
+
"h-8 w-16 text-[12.5px]",
|
|
133
|
+
o.byField.window_start_hour && "border-red-400"
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
/* @__PURE__ */ t(
|
|
140
|
+
h,
|
|
141
|
+
{
|
|
142
|
+
label: "Window ends (hour)",
|
|
143
|
+
hint: "1 to 24, after the start",
|
|
144
|
+
error: o.byField.window_end_hour,
|
|
145
|
+
children: /* @__PURE__ */ t(
|
|
146
|
+
N,
|
|
147
|
+
{
|
|
148
|
+
type: "number",
|
|
149
|
+
min: 1,
|
|
150
|
+
max: 24,
|
|
151
|
+
value: s.window_end_hour,
|
|
152
|
+
onChange: (e) => n("window_end_hour", Number(e.target.value)),
|
|
153
|
+
"aria-label": "Window end hour",
|
|
154
|
+
className: v(
|
|
155
|
+
"h-8 w-16 text-[12.5px]",
|
|
156
|
+
o.byField.window_end_hour && "border-red-400"
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
/* @__PURE__ */ t(h, { label: "Email administrators", error: o.byField.email, children: /* @__PURE__ */ t(
|
|
163
|
+
F,
|
|
164
|
+
{
|
|
165
|
+
checked: s.email,
|
|
166
|
+
onCheckedChange: (e) => n("email", e),
|
|
167
|
+
"aria-label": "Email administrators"
|
|
168
|
+
}
|
|
169
|
+
) }),
|
|
170
|
+
/* @__PURE__ */ t(
|
|
171
|
+
h,
|
|
172
|
+
{
|
|
173
|
+
label: "Notify administrators",
|
|
174
|
+
hint: "Off = this page only",
|
|
175
|
+
error: o.byField.notify,
|
|
176
|
+
children: /* @__PURE__ */ t(
|
|
177
|
+
F,
|
|
178
|
+
{
|
|
179
|
+
checked: s.notify,
|
|
180
|
+
onCheckedChange: (e) => n("notify", e),
|
|
181
|
+
"aria-label": "Notify administrators"
|
|
182
|
+
}
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
),
|
|
186
|
+
/* @__PURE__ */ t(
|
|
187
|
+
h,
|
|
188
|
+
{
|
|
189
|
+
label: "Model",
|
|
190
|
+
hint: "Blank = the AI settings’ chat model",
|
|
191
|
+
error: o.byField.model,
|
|
192
|
+
children: /* @__PURE__ */ t(
|
|
193
|
+
N,
|
|
194
|
+
{
|
|
195
|
+
value: s.model ?? "",
|
|
196
|
+
onChange: (e) => n("model", e.target.value || null),
|
|
197
|
+
"aria-label": "Model",
|
|
198
|
+
placeholder: "default",
|
|
199
|
+
className: v("h-8 w-36 text-[12.5px]", o.byField.model && "border-red-400")
|
|
200
|
+
}
|
|
201
|
+
)
|
|
202
|
+
}
|
|
203
|
+
),
|
|
204
|
+
/* @__PURE__ */ t(
|
|
205
|
+
h,
|
|
206
|
+
{
|
|
207
|
+
label: "Token cap",
|
|
208
|
+
hint: "20,000 to 5,000,000 per run",
|
|
209
|
+
error: o.byField.token_cap,
|
|
210
|
+
children: /* @__PURE__ */ t(
|
|
211
|
+
N,
|
|
212
|
+
{
|
|
213
|
+
inputMode: "numeric",
|
|
214
|
+
value: x,
|
|
215
|
+
onChange: (e) => {
|
|
216
|
+
g(e.target.value), n("token_cap", Number(e.target.value.replace(/[^\d]/g, "")));
|
|
217
|
+
},
|
|
218
|
+
"aria-label": "Token cap",
|
|
219
|
+
className: v(
|
|
220
|
+
"h-8 w-28 text-right text-[12.5px]",
|
|
221
|
+
o.byField.token_cap && "border-red-400"
|
|
222
|
+
)
|
|
223
|
+
}
|
|
224
|
+
)
|
|
225
|
+
}
|
|
226
|
+
),
|
|
227
|
+
o.rest.length > 0 && /* @__PURE__ */ t("ul", { role: "alert", className: "space-y-0.5 text-[11.5px] text-red-600 dark:text-red-400", children: o.rest.map((e) => /* @__PURE__ */ t("li", { children: e }, e)) }),
|
|
228
|
+
y != null && /* @__PURE__ */ t(C, { error: y, fallback: "Could not save" }),
|
|
229
|
+
/* @__PURE__ */ m("div", { className: "flex justify-end gap-2 pt-1", children: [
|
|
230
|
+
/* @__PURE__ */ t(k, { variant: "ghost", size: "sm", className: "h-8", onClick: () => u(!1), children: "Cancel" }),
|
|
231
|
+
/* @__PURE__ */ t(
|
|
232
|
+
k,
|
|
233
|
+
{
|
|
234
|
+
size: "sm",
|
|
235
|
+
className: "h-8",
|
|
236
|
+
disabled: a.isPending,
|
|
237
|
+
onClick: () => a.mutate(s),
|
|
238
|
+
children: a.isPending ? "Saving…" : "Save"
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
] })
|
|
242
|
+
] }) })
|
|
243
|
+
] });
|
|
244
|
+
}
|
|
245
|
+
export {
|
|
246
|
+
re as OpsSettingsPopover
|
|
247
|
+
};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { jsx as t, jsxs as s, Fragment as T } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as R } from "@tanstack/react-query";
|
|
3
|
+
import { useState as j, useMemo as S } from "react";
|
|
4
|
+
import { useNivaroClient as E } from "../../context.js";
|
|
5
|
+
import { get as D } from "../../lib/commands.js";
|
|
6
|
+
import { OPS_KPI_META as _ } from "../../lib/ops-report-types.js";
|
|
7
|
+
import { cn as I } from "../../lib/utils.js";
|
|
8
|
+
import { RechartsGate as O } from "../charts/RechartsGate.js";
|
|
9
|
+
import { QueryErrorState as $ } from "../QueryErrorState.js";
|
|
10
|
+
import { Skeleton as v } from "../ui/skeleton.js";
|
|
11
|
+
import { kpiMeta as N, VERDICT as C, NO_VERDICT_DOT as q, shortDay as u, formatKpi as w } from "./format.js";
|
|
12
|
+
import { Pick as A } from "./ui.js";
|
|
13
|
+
const G = [
|
|
14
|
+
{ key: "people", title: "People" },
|
|
15
|
+
{ key: "traffic", title: "Traffic and deploys" },
|
|
16
|
+
{ key: "speed", title: "Speed" },
|
|
17
|
+
{ key: "errors", title: "Errors and bugs" },
|
|
18
|
+
{ key: "integrations", title: "Partners and mail" },
|
|
19
|
+
{ key: "work", title: "Work" },
|
|
20
|
+
{ key: "security", title: "Security" },
|
|
21
|
+
{ key: "business", title: "Business" }
|
|
22
|
+
], K = [
|
|
23
|
+
{ value: "30", label: "Last 30 days" },
|
|
24
|
+
{ value: "90", label: "Last 90 days" }
|
|
25
|
+
];
|
|
26
|
+
function P({
|
|
27
|
+
points: c,
|
|
28
|
+
k: f,
|
|
29
|
+
onPick: p
|
|
30
|
+
}) {
|
|
31
|
+
const k = N(f), d = c.map((a) => {
|
|
32
|
+
var m;
|
|
33
|
+
return { i: a.id, day: u(a.day), v: ((m = a.kpis) == null ? void 0 : m[f]) ?? null };
|
|
34
|
+
});
|
|
35
|
+
return /* @__PURE__ */ t(O, { fallback: /* @__PURE__ */ t(v, { className: "h-12 w-full", "aria-busy": "true" }), children: ({ Line: a, LineChart: m, ResponsiveContainer: h, Tooltip: y, YAxis: b }) => /* @__PURE__ */ t(h, { width: "100%", height: "100%", children: /* @__PURE__ */ s(
|
|
36
|
+
m,
|
|
37
|
+
{
|
|
38
|
+
data: d,
|
|
39
|
+
margin: { top: 4, right: 4, left: 4, bottom: 2 },
|
|
40
|
+
onClick: (l) => {
|
|
41
|
+
const e = Number(l == null ? void 0 : l.activeTooltipIndex), o = Number.isInteger(e) ? c[e] : void 0;
|
|
42
|
+
o && p(o);
|
|
43
|
+
},
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ t(b, { hide: !0, domain: ["auto", "auto"] }),
|
|
46
|
+
/* @__PURE__ */ t(
|
|
47
|
+
y,
|
|
48
|
+
{
|
|
49
|
+
contentStyle: {
|
|
50
|
+
fontSize: 11,
|
|
51
|
+
padding: "4px 8px",
|
|
52
|
+
backgroundColor: "#0f172a",
|
|
53
|
+
border: "1px solid #334155",
|
|
54
|
+
borderRadius: 6,
|
|
55
|
+
color: "#f1f5f9"
|
|
56
|
+
},
|
|
57
|
+
labelStyle: { color: "#f1f5f9" },
|
|
58
|
+
itemStyle: { color: "#e2e8f0" },
|
|
59
|
+
labelFormatter: (l, e) => {
|
|
60
|
+
var o, i;
|
|
61
|
+
return ((i = (o = e == null ? void 0 : e[0]) == null ? void 0 : o.payload) == null ? void 0 : i.day) ?? "";
|
|
62
|
+
},
|
|
63
|
+
formatter: (l) => [w(l, k.unit), ""]
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
/* @__PURE__ */ t(
|
|
67
|
+
a,
|
|
68
|
+
{
|
|
69
|
+
type: "monotone",
|
|
70
|
+
dataKey: "v",
|
|
71
|
+
stroke: "#4f7cac",
|
|
72
|
+
strokeWidth: 1.75,
|
|
73
|
+
dot: !1,
|
|
74
|
+
activeDot: { r: 3 },
|
|
75
|
+
connectNulls: !0,
|
|
76
|
+
isAnimationActive: !1
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
) }) });
|
|
82
|
+
}
|
|
83
|
+
function Y({ onOpenDay: c }) {
|
|
84
|
+
var h, y, b, l;
|
|
85
|
+
const f = E(), [p, k] = j("30"), d = R({
|
|
86
|
+
queryKey: ["ops-trends", p],
|
|
87
|
+
queryFn: () => f.request(D("/ops-reports/trends", { days: Number(p) })).then((e) => e.data)
|
|
88
|
+
}), a = S(() => d.data ?? [], [d.data]), m = S(() => {
|
|
89
|
+
const e = /* @__PURE__ */ new Set();
|
|
90
|
+
for (const r of a)
|
|
91
|
+
for (const [n, g] of Object.entries(r.kpis ?? {})) g != null && e.add(n);
|
|
92
|
+
const o = new Set(_.map((r) => r.key)), i = /* @__PURE__ */ new Map(), x = (r, n) => i.set(r, [...i.get(r) ?? [], n]);
|
|
93
|
+
for (const r of _)
|
|
94
|
+
e.has(r.key) && r.key !== "health_score" && x(r.group, r.key);
|
|
95
|
+
for (const r of [...e].filter((n) => !o.has(n) && n.includes(".")))
|
|
96
|
+
x(N(r).group, r);
|
|
97
|
+
return G.map((r) => ({ ...r, keys: i.get(r.key) ?? [] })).filter(
|
|
98
|
+
(r) => r.keys.length
|
|
99
|
+
);
|
|
100
|
+
}, [a]);
|
|
101
|
+
return /* @__PURE__ */ t(
|
|
102
|
+
"div",
|
|
103
|
+
{
|
|
104
|
+
className: "min-h-0 flex-1 overflow-y-auto bg-slate-50 p-4 dark:bg-background",
|
|
105
|
+
"data-ops-trends": "",
|
|
106
|
+
children: /* @__PURE__ */ s("div", { className: "mx-auto max-w-[1200px] space-y-4", children: [
|
|
107
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
|
|
108
|
+
/* @__PURE__ */ t(
|
|
109
|
+
A,
|
|
110
|
+
{
|
|
111
|
+
ariaLabel: "Days to show",
|
|
112
|
+
value: p,
|
|
113
|
+
onChange: k,
|
|
114
|
+
options: K,
|
|
115
|
+
className: "w-[150px]"
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
/* @__PURE__ */ t("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "One line per day. Click a day or a point to open that report." })
|
|
119
|
+
] }),
|
|
120
|
+
d.isLoading ? /* @__PURE__ */ s("div", { className: "space-y-3", "aria-busy": "true", children: [
|
|
121
|
+
/* @__PURE__ */ t(v, { className: "h-14 w-full" }),
|
|
122
|
+
/* @__PURE__ */ t(v, { className: "h-40 w-full" })
|
|
123
|
+
] }) : d.error ? /* @__PURE__ */ t($, { error: d.error, what: "the trends", onRetry: () => void d.refetch() }) : a.length === 0 ? /* @__PURE__ */ t("p", { className: "py-10 text-center text-[12.5px] text-slate-500 dark:text-muted-foreground", children: "No reports in this range yet." }) : /* @__PURE__ */ s(T, { children: [
|
|
124
|
+
/* @__PURE__ */ s("section", { className: "rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card", children: [
|
|
125
|
+
/* @__PURE__ */ t("h3", { className: "mb-2 text-[12.5px] font-semibold text-slate-800 dark:text-foreground", children: "How each day went" }),
|
|
126
|
+
/* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", "data-ops-verdict-strip": "", children: a.map((e) => /* @__PURE__ */ t(
|
|
127
|
+
"button",
|
|
128
|
+
{
|
|
129
|
+
type: "button",
|
|
130
|
+
onClick: () => c(e.id),
|
|
131
|
+
"data-tip": `${u(e.day)} · ${e.verdict ? C[e.verdict].label : "no verdict"}${e.score != null ? ` · ${e.score}` : ""}`,
|
|
132
|
+
"aria-label": `Open ${u(e.day)}`,
|
|
133
|
+
className: I(
|
|
134
|
+
"h-7 w-3.5 rounded-sm transition-opacity hover:opacity-75 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60",
|
|
135
|
+
e.verdict ? C[e.verdict].dot : q
|
|
136
|
+
)
|
|
137
|
+
},
|
|
138
|
+
e.id
|
|
139
|
+
)) }),
|
|
140
|
+
/* @__PURE__ */ s("div", { className: "mt-1.5 flex justify-between text-[10.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
141
|
+
/* @__PURE__ */ t("span", { children: u(((h = a[0]) == null ? void 0 : h.day) ?? "") }),
|
|
142
|
+
/* @__PURE__ */ t("span", { children: u(((y = a[a.length - 1]) == null ? void 0 : y.day) ?? "") })
|
|
143
|
+
] })
|
|
144
|
+
] }),
|
|
145
|
+
a.some((e) => {
|
|
146
|
+
var o;
|
|
147
|
+
return ((o = e.kpis) == null ? void 0 : o.health_score) != null;
|
|
148
|
+
}) && /* @__PURE__ */ s(
|
|
149
|
+
"section",
|
|
150
|
+
{
|
|
151
|
+
"data-ops-trend-group": "score",
|
|
152
|
+
className: "rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card",
|
|
153
|
+
children: [
|
|
154
|
+
/* @__PURE__ */ s("div", { className: "flex items-baseline justify-between", children: [
|
|
155
|
+
/* @__PURE__ */ t("h3", { className: "text-[12.5px] font-semibold text-slate-800 dark:text-foreground", children: "Health score" }),
|
|
156
|
+
/* @__PURE__ */ t("span", { className: "text-[12px] font-semibold tabular-nums", children: w((l = (b = a[a.length - 1]) == null ? void 0 : b.kpis) == null ? void 0 : l.health_score, "count") })
|
|
157
|
+
] }),
|
|
158
|
+
/* @__PURE__ */ t("div", { className: "h-24", "data-ops-trend": "health_score", children: /* @__PURE__ */ t(P, { points: a, k: "health_score", onPick: (e) => c(e.id) }) })
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
m.map((e) => /* @__PURE__ */ s(
|
|
163
|
+
"section",
|
|
164
|
+
{
|
|
165
|
+
"data-ops-trend-group": e.key,
|
|
166
|
+
className: "rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card",
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ t("h3", { className: "mb-2 text-[12.5px] font-semibold text-slate-800 dark:text-foreground", children: e.title }),
|
|
169
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-[repeat(auto-fill,minmax(210px,1fr))] gap-x-4 gap-y-3", children: e.keys.map((o) => {
|
|
170
|
+
var r, n;
|
|
171
|
+
const i = N(o), x = (n = (r = a[a.length - 1]) == null ? void 0 : r.kpis) == null ? void 0 : n[o];
|
|
172
|
+
return /* @__PURE__ */ s("div", { "data-ops-trend": o, children: [
|
|
173
|
+
/* @__PURE__ */ s("div", { className: "flex items-baseline justify-between gap-2", children: [
|
|
174
|
+
/* @__PURE__ */ t("span", { className: "truncate text-[11.5px] text-slate-600 dark:text-muted-foreground", children: i.label }),
|
|
175
|
+
/* @__PURE__ */ t("span", { className: "text-[12px] font-semibold tabular-nums text-slate-900 dark:text-foreground", children: w(x, i.unit) })
|
|
176
|
+
] }),
|
|
177
|
+
/* @__PURE__ */ t("div", { className: "h-12", children: /* @__PURE__ */ t(P, { points: a, k: o, onPick: (g) => c(g.id) }) })
|
|
178
|
+
] }, o);
|
|
179
|
+
}) })
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
e.key
|
|
183
|
+
))
|
|
184
|
+
] })
|
|
185
|
+
] })
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
export {
|
|
190
|
+
Y as TrendsTab
|
|
191
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { cn as t } from "../../lib/utils.js";
|
|
3
|
+
function i({ children: e, className: r }) {
|
|
4
|
+
return /* @__PURE__ */ n(
|
|
5
|
+
"span",
|
|
6
|
+
{
|
|
7
|
+
className: t(
|
|
8
|
+
"inline-flex items-center rounded-full border px-2 py-px text-[10.5px] font-medium",
|
|
9
|
+
r
|
|
10
|
+
),
|
|
11
|
+
children: e
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
i as Chip
|
|
17
|
+
};
|