@mdxui/tremor 6.0.0
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/README.md +255 -0
- package/dist/dashboard/components/index.d.ts +355 -0
- package/dist/dashboard/components/index.js +549 -0
- package/dist/dashboard/components/index.js.map +1 -0
- package/dist/dashboard/index.d.ts +275 -0
- package/dist/dashboard/index.js +1062 -0
- package/dist/dashboard/index.js.map +1 -0
- package/dist/database/index.d.ts +334 -0
- package/dist/database/index.js +474 -0
- package/dist/database/index.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1089 -0
- package/dist/index.js.map +1 -0
- package/dist/insights/components/index.d.ts +362 -0
- package/dist/insights/components/index.js +1397 -0
- package/dist/insights/components/index.js.map +1 -0
- package/dist/insights/index.d.ts +360 -0
- package/dist/insights/index.js +1815 -0
- package/dist/insights/index.js.map +1 -0
- package/dist/overview/components/index.d.ts +86 -0
- package/dist/overview/components/index.js +775 -0
- package/dist/overview/components/index.js.map +1 -0
- package/dist/overview/index.d.ts +301 -0
- package/dist/overview/index.js +1077 -0
- package/dist/overview/index.js.map +1 -0
- package/dist/shared/index.d.ts +296 -0
- package/dist/shared/index.js +395 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/solar/components/index.d.ts +341 -0
- package/dist/solar/components/index.js +831 -0
- package/dist/solar/components/index.js.map +1 -0
- package/dist/solar/index.d.ts +301 -0
- package/dist/solar/index.js +1130 -0
- package/dist/solar/index.js.map +1 -0
- package/package.json +135 -0
|
@@ -0,0 +1,775 @@
|
|
|
1
|
+
// src/overview/components/sections/AgentsSection.tsx
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
function ProgressCircle({
|
|
6
|
+
value,
|
|
7
|
+
radius = 14,
|
|
8
|
+
strokeWidth = 3,
|
|
9
|
+
variant = "default",
|
|
10
|
+
children
|
|
11
|
+
}) {
|
|
12
|
+
const normalizedRadius = radius - strokeWidth / 2;
|
|
13
|
+
const circumference = 2 * Math.PI * normalizedRadius;
|
|
14
|
+
const strokeDashoffset = circumference - value / 100 * circumference;
|
|
15
|
+
const variantColors = {
|
|
16
|
+
default: "stroke-blue-500",
|
|
17
|
+
warning: "stroke-amber-500",
|
|
18
|
+
error: "stroke-red-500",
|
|
19
|
+
success: "stroke-emerald-500"
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative inline-flex items-center justify-center", children: [
|
|
22
|
+
/* @__PURE__ */ jsxs("svg", { height: radius * 2, width: radius * 2, className: "rotate-[-90deg]", "aria-hidden": "true", children: [
|
|
23
|
+
/* @__PURE__ */ jsx(
|
|
24
|
+
"circle",
|
|
25
|
+
{
|
|
26
|
+
className: "stroke-gray-200 dark:stroke-gray-800",
|
|
27
|
+
fill: "transparent",
|
|
28
|
+
strokeWidth,
|
|
29
|
+
r: normalizedRadius,
|
|
30
|
+
cx: radius,
|
|
31
|
+
cy: radius
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
"circle",
|
|
36
|
+
{
|
|
37
|
+
className: variantColors[variant],
|
|
38
|
+
fill: "transparent",
|
|
39
|
+
strokeWidth,
|
|
40
|
+
strokeDasharray: circumference,
|
|
41
|
+
strokeDashoffset,
|
|
42
|
+
strokeLinecap: "round",
|
|
43
|
+
r: normalizedRadius,
|
|
44
|
+
cx: radius,
|
|
45
|
+
cy: radius
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
] }),
|
|
49
|
+
children && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center", children })
|
|
50
|
+
] });
|
|
51
|
+
}
|
|
52
|
+
function Badge({
|
|
53
|
+
children,
|
|
54
|
+
variant = "default",
|
|
55
|
+
className = ""
|
|
56
|
+
}) {
|
|
57
|
+
const variantClasses = {
|
|
58
|
+
default: "bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300",
|
|
59
|
+
success: "bg-emerald-50 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400",
|
|
60
|
+
warning: "bg-amber-50 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",
|
|
61
|
+
error: "bg-red-50 text-red-700 dark:bg-red-900/30 dark:text-red-400"
|
|
62
|
+
};
|
|
63
|
+
return /* @__PURE__ */ jsx("span", { className: twMerge("inline-flex items-center rounded-md px-2 py-0.5 text-xs font-medium", variantClasses[variant], className), children });
|
|
64
|
+
}
|
|
65
|
+
function ShieldCheckIcon({ className }) {
|
|
66
|
+
return /* @__PURE__ */ jsx("svg", { className, fill: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M12 2L4 5v6.09c0 5.05 3.41 9.76 8 10.91 4.59-1.15 8-5.86 8-10.91V5l-8-3zm-1.06 13.54L7.4 12l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41-5.64 5.66z" }) });
|
|
67
|
+
}
|
|
68
|
+
function TicketGenerationButton({ initialState }) {
|
|
69
|
+
const [enabled, setEnabled] = React.useState(initialState);
|
|
70
|
+
return /* @__PURE__ */ jsx(
|
|
71
|
+
"button",
|
|
72
|
+
{
|
|
73
|
+
type: "button",
|
|
74
|
+
role: "switch",
|
|
75
|
+
"aria-checked": enabled,
|
|
76
|
+
className: twMerge(
|
|
77
|
+
"relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",
|
|
78
|
+
enabled ? "bg-blue-600" : "bg-gray-200 dark:bg-gray-700"
|
|
79
|
+
),
|
|
80
|
+
onClick: () => setEnabled(!enabled),
|
|
81
|
+
children: /* @__PURE__ */ jsx(
|
|
82
|
+
"span",
|
|
83
|
+
{
|
|
84
|
+
className: twMerge(
|
|
85
|
+
"pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out",
|
|
86
|
+
enabled ? "translate-x-4" : "translate-x-0"
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
function Divider() {
|
|
94
|
+
return /* @__PURE__ */ jsx("div", { className: "my-6 h-px w-full bg-gray-200 dark:bg-gray-800" });
|
|
95
|
+
}
|
|
96
|
+
function FilterBar({
|
|
97
|
+
globalFilter,
|
|
98
|
+
setGlobalFilter,
|
|
99
|
+
registeredOnly,
|
|
100
|
+
setRegisteredOnly
|
|
101
|
+
}) {
|
|
102
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center justify-between gap-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
103
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
104
|
+
/* @__PURE__ */ jsx(
|
|
105
|
+
"svg",
|
|
106
|
+
{
|
|
107
|
+
className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400",
|
|
108
|
+
fill: "none",
|
|
109
|
+
stroke: "currentColor",
|
|
110
|
+
viewBox: "0 0 24 24",
|
|
111
|
+
"aria-hidden": "true",
|
|
112
|
+
children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" })
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ jsx(
|
|
116
|
+
"input",
|
|
117
|
+
{
|
|
118
|
+
type: "text",
|
|
119
|
+
placeholder: "Search agents...",
|
|
120
|
+
value: globalFilter,
|
|
121
|
+
onChange: (e) => setGlobalFilter(e.target.value),
|
|
122
|
+
className: "w-64 rounded-md border border-gray-300 bg-white py-2 pl-10 pr-4 text-sm placeholder-gray-400 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100"
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
] }),
|
|
126
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400", children: [
|
|
127
|
+
/* @__PURE__ */ jsx(
|
|
128
|
+
"input",
|
|
129
|
+
{
|
|
130
|
+
type: "checkbox",
|
|
131
|
+
checked: registeredOnly,
|
|
132
|
+
onChange: (e) => setRegisteredOnly(e.target.checked),
|
|
133
|
+
className: "h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
"Registered only"
|
|
137
|
+
] })
|
|
138
|
+
] }) });
|
|
139
|
+
}
|
|
140
|
+
function Pagination({
|
|
141
|
+
pageIndex,
|
|
142
|
+
pageSize,
|
|
143
|
+
totalRows,
|
|
144
|
+
onPageChange
|
|
145
|
+
}) {
|
|
146
|
+
const totalPages = Math.ceil(totalRows / pageSize);
|
|
147
|
+
const startRow = pageIndex * pageSize + 1;
|
|
148
|
+
const endRow = Math.min((pageIndex + 1) * pageSize, totalRows);
|
|
149
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm text-gray-600 dark:text-gray-400", children: [
|
|
150
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
151
|
+
"Showing ",
|
|
152
|
+
startRow,
|
|
153
|
+
" to ",
|
|
154
|
+
endRow,
|
|
155
|
+
" of ",
|
|
156
|
+
totalRows,
|
|
157
|
+
" agents"
|
|
158
|
+
] }),
|
|
159
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
160
|
+
/* @__PURE__ */ jsx(
|
|
161
|
+
"button",
|
|
162
|
+
{
|
|
163
|
+
type: "button",
|
|
164
|
+
onClick: () => onPageChange(pageIndex - 1),
|
|
165
|
+
disabled: pageIndex === 0,
|
|
166
|
+
className: "rounded-md border border-gray-300 px-3 py-1 disabled:opacity-50 dark:border-gray-700",
|
|
167
|
+
children: "Previous"
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
171
|
+
"Page ",
|
|
172
|
+
pageIndex + 1,
|
|
173
|
+
" of ",
|
|
174
|
+
totalPages
|
|
175
|
+
] }),
|
|
176
|
+
/* @__PURE__ */ jsx(
|
|
177
|
+
"button",
|
|
178
|
+
{
|
|
179
|
+
type: "button",
|
|
180
|
+
onClick: () => onPageChange(pageIndex + 1),
|
|
181
|
+
disabled: pageIndex >= totalPages - 1,
|
|
182
|
+
className: "rounded-md border border-gray-300 px-3 py-1 disabled:opacity-50 dark:border-gray-700",
|
|
183
|
+
children: "Next"
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
] })
|
|
187
|
+
] });
|
|
188
|
+
}
|
|
189
|
+
function formatPhoneNumber(number) {
|
|
190
|
+
return number.replace(/(\+41)(\d{2})(\d{3})(\d{2})(\d{2})/, "$1 $2 $3 $4 $5");
|
|
191
|
+
}
|
|
192
|
+
function formatDate(dateString) {
|
|
193
|
+
return new Date(dateString).toLocaleDateString("en-GB", {
|
|
194
|
+
day: "2-digit",
|
|
195
|
+
month: "2-digit",
|
|
196
|
+
year: "numeric"
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
function getCapacityVariant(value) {
|
|
200
|
+
const fixedValue = parseFloat(value.toFixed(0));
|
|
201
|
+
if (fixedValue >= 85) return "error";
|
|
202
|
+
if (fixedValue > 60) return "warning";
|
|
203
|
+
return "default";
|
|
204
|
+
}
|
|
205
|
+
function MetricCard({ label, value }) {
|
|
206
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-gray-200 bg-white p-4 dark:border-gray-700 dark:bg-gray-800", children: [
|
|
207
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: label }),
|
|
208
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-2xl font-semibold text-gray-900 dark:text-white", children: value })
|
|
209
|
+
] });
|
|
210
|
+
}
|
|
211
|
+
function AgentsSection(props) {
|
|
212
|
+
const isTremorVariant = "agents" in props || !("totalAgents" in props) && !("activeAgents" in props);
|
|
213
|
+
if (isTremorVariant) {
|
|
214
|
+
return /* @__PURE__ */ jsx(AgentsSectionTremor, { ...props });
|
|
215
|
+
}
|
|
216
|
+
const mdxuiProps = props;
|
|
217
|
+
return /* @__PURE__ */ jsx(
|
|
218
|
+
AgentsSectionMdxui,
|
|
219
|
+
{
|
|
220
|
+
totalAgents: mdxuiProps.totalAgents ?? 0,
|
|
221
|
+
activeAgents: mdxuiProps.activeAgents ?? 0,
|
|
222
|
+
runsToday: mdxuiProps.runsToday ?? 0,
|
|
223
|
+
successRate: mdxuiProps.successRate ?? 0,
|
|
224
|
+
loading: mdxuiProps.loading ?? false,
|
|
225
|
+
topAgents: mdxuiProps.topAgents,
|
|
226
|
+
performanceData: mdxuiProps.performanceData,
|
|
227
|
+
className: mdxuiProps.className
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
function AgentsSectionTremor({
|
|
232
|
+
agents = [],
|
|
233
|
+
title = "Agents",
|
|
234
|
+
description = "Monitor agent performance and manage ticket generation",
|
|
235
|
+
className = ""
|
|
236
|
+
}) {
|
|
237
|
+
const [globalFilter, setGlobalFilter] = React.useState("");
|
|
238
|
+
const [registeredOnly, setRegisteredOnly] = React.useState(false);
|
|
239
|
+
const [pageIndex, setPageIndex] = React.useState(0);
|
|
240
|
+
const pageSize = 16;
|
|
241
|
+
const filteredAgents = React.useMemo(() => {
|
|
242
|
+
let result = agents;
|
|
243
|
+
if (globalFilter) {
|
|
244
|
+
const lowerFilter = globalFilter.toLowerCase();
|
|
245
|
+
result = result.filter(
|
|
246
|
+
(agent) => agent.full_name.toLowerCase().includes(lowerFilter) || agent.agent_id.toLowerCase().includes(lowerFilter) || agent.email.toLowerCase().includes(lowerFilter) || agent.account.toLowerCase().includes(lowerFilter)
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
if (registeredOnly) {
|
|
250
|
+
result = result.filter((agent) => agent.registered);
|
|
251
|
+
}
|
|
252
|
+
return result;
|
|
253
|
+
}, [agents, globalFilter, registeredOnly]);
|
|
254
|
+
const paginatedAgents = React.useMemo(() => {
|
|
255
|
+
const start = pageIndex * pageSize;
|
|
256
|
+
return filteredAgents.slice(start, start + pageSize);
|
|
257
|
+
}, [filteredAgents, pageIndex]);
|
|
258
|
+
React.useEffect(() => {
|
|
259
|
+
setPageIndex(0);
|
|
260
|
+
}, []);
|
|
261
|
+
return /* @__PURE__ */ jsxs("main", { className: twMerge("", className), "data-testid": "agents-section", children: [
|
|
262
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between", children: /* @__PURE__ */ jsxs("div", { children: [
|
|
263
|
+
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-semibold text-gray-900 dark:text-gray-50", children: title }),
|
|
264
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-500 sm:text-sm/6 dark:text-gray-500", children: description })
|
|
265
|
+
] }) }),
|
|
266
|
+
/* @__PURE__ */ jsx(Divider, {}),
|
|
267
|
+
/* @__PURE__ */ jsx("section", { className: "mt-8", children: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
268
|
+
/* @__PURE__ */ jsx(
|
|
269
|
+
FilterBar,
|
|
270
|
+
{
|
|
271
|
+
globalFilter,
|
|
272
|
+
setGlobalFilter,
|
|
273
|
+
registeredOnly,
|
|
274
|
+
setRegisteredOnly
|
|
275
|
+
}
|
|
276
|
+
),
|
|
277
|
+
/* @__PURE__ */ jsx("div", { className: "relative overflow-hidden overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: "w-full text-left", children: [
|
|
278
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "border-b border-gray-200 dark:border-gray-800", children: [
|
|
279
|
+
/* @__PURE__ */ jsx("th", { className: "whitespace-nowrap py-1 text-sm font-medium text-gray-900 dark:text-gray-50 sm:text-xs", children: "Agent" }),
|
|
280
|
+
/* @__PURE__ */ jsx("th", { className: "whitespace-nowrap py-1 text-sm font-medium text-gray-900 dark:text-gray-50 sm:text-xs", children: "Contact Information" }),
|
|
281
|
+
/* @__PURE__ */ jsx("th", { className: "whitespace-nowrap py-1 text-sm font-medium text-gray-900 dark:text-gray-50 sm:text-xs", children: "Contract Dates" }),
|
|
282
|
+
/* @__PURE__ */ jsx("th", { className: "whitespace-nowrap py-1 text-sm font-medium text-gray-900 dark:text-gray-50 sm:text-xs", children: "Account" }),
|
|
283
|
+
/* @__PURE__ */ jsx("th", { className: "whitespace-nowrap py-1 text-sm font-medium text-gray-900 dark:text-gray-50 sm:text-xs", children: "Capacity (mins)" }),
|
|
284
|
+
/* @__PURE__ */ jsx("th", { className: "whitespace-nowrap py-1 text-sm font-medium text-gray-900 dark:text-gray-50 sm:text-xs", children: "Ticket Generation" })
|
|
285
|
+
] }) }),
|
|
286
|
+
/* @__PURE__ */ jsx("tbody", { children: paginatedAgents.length > 0 ? paginatedAgents.map((agent) => {
|
|
287
|
+
const capacity = agent.minutes_booked > 0 ? agent.minutes_called / agent.minutes_booked * 100 : 0;
|
|
288
|
+
return /* @__PURE__ */ jsxs(
|
|
289
|
+
"tr",
|
|
290
|
+
{
|
|
291
|
+
className: "group select-none border-b border-gray-100 hover:bg-[#FBFBFC] dark:border-gray-800 hover:dark:bg-gray-900",
|
|
292
|
+
children: [
|
|
293
|
+
/* @__PURE__ */ jsx("td", { className: "relative whitespace-nowrap py-2.5 text-gray-600 dark:text-gray-400", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
294
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-gray-900 dark:text-gray-50", children: agent.full_name }),
|
|
295
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-xs", children: [
|
|
296
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-500 dark:text-gray-500", children: "AgID " }),
|
|
297
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono font-medium uppercase tabular-nums text-gray-900 dark:text-gray-50", children: agent.agent_id }),
|
|
298
|
+
/* @__PURE__ */ jsx(
|
|
299
|
+
ShieldCheckIcon,
|
|
300
|
+
{
|
|
301
|
+
className: twMerge(
|
|
302
|
+
"size-3 shrink-0",
|
|
303
|
+
agent.registered ? "text-emerald-600 dark:text-emerald-400" : "text-gray-400 dark:text-gray-600"
|
|
304
|
+
)
|
|
305
|
+
}
|
|
306
|
+
)
|
|
307
|
+
] })
|
|
308
|
+
] }) }),
|
|
309
|
+
/* @__PURE__ */ jsx("td", { className: "relative whitespace-nowrap py-2.5 text-gray-600 dark:text-gray-400", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
310
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-900 dark:text-gray-50", children: formatPhoneNumber(agent.number) }),
|
|
311
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-gray-500 dark:text-gray-500", children: agent.email })
|
|
312
|
+
] }) }),
|
|
313
|
+
/* @__PURE__ */ jsx("td", { className: "relative whitespace-nowrap py-2.5 text-gray-600 dark:text-gray-400", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
314
|
+
/* @__PURE__ */ jsx("span", { className: "tabular-nums text-gray-900 dark:text-gray-50", children: agent.end_date ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
315
|
+
"End: ",
|
|
316
|
+
formatDate(agent.end_date)
|
|
317
|
+
] }) : /* @__PURE__ */ jsx(Badge, { className: "px-1.5 py-0.5", variant: "success", children: "Active" }) }),
|
|
318
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs tabular-nums text-gray-500 dark:text-gray-500", children: [
|
|
319
|
+
"Start: ",
|
|
320
|
+
formatDate(agent.start_date)
|
|
321
|
+
] })
|
|
322
|
+
] }) }),
|
|
323
|
+
/* @__PURE__ */ jsx("td", { className: "relative whitespace-nowrap py-2.5 text-gray-600 dark:text-gray-400", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
324
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-900 dark:text-gray-50", children: agent.account }),
|
|
325
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-gray-500 dark:text-gray-500", children: "Main division" })
|
|
326
|
+
] }) }),
|
|
327
|
+
/* @__PURE__ */ jsx("td", { className: "relative whitespace-nowrap py-2.5 text-gray-600 dark:text-gray-400", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
328
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-x-2.5", children: /* @__PURE__ */ jsx(ProgressCircle, { value: capacity, radius: 14, strokeWidth: 3, variant: getCapacityVariant(capacity), children: /* @__PURE__ */ jsx("span", { className: "text-[11px] font-semibold text-gray-900 dark:text-gray-50", children: capacity.toFixed(0) }) }) }),
|
|
329
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0", children: [
|
|
330
|
+
/* @__PURE__ */ jsxs("span", { className: "text-gray-900 dark:text-gray-50", children: [
|
|
331
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-500 dark:text-gray-500", children: "Called " }),
|
|
332
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: new Intl.NumberFormat().format(agent.minutes_called) })
|
|
333
|
+
] }),
|
|
334
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs text-gray-500 dark:text-gray-500", children: [
|
|
335
|
+
"Booked ",
|
|
336
|
+
new Intl.NumberFormat().format(agent.minutes_booked)
|
|
337
|
+
] })
|
|
338
|
+
] })
|
|
339
|
+
] }) }),
|
|
340
|
+
/* @__PURE__ */ jsx("td", { className: "relative whitespace-nowrap py-2.5 text-gray-600 dark:text-gray-400", children: /* @__PURE__ */ jsx(TicketGenerationButton, { initialState: agent.ticket_generation }) })
|
|
341
|
+
]
|
|
342
|
+
},
|
|
343
|
+
agent.agent_id
|
|
344
|
+
);
|
|
345
|
+
}) : /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 6, className: "h-24 text-center text-gray-500 dark:text-gray-400", children: "No results." }) }) })
|
|
346
|
+
] }) }),
|
|
347
|
+
/* @__PURE__ */ jsx(Pagination, { pageIndex, pageSize, totalRows: filteredAgents.length, onPageChange: setPageIndex })
|
|
348
|
+
] }) })
|
|
349
|
+
] });
|
|
350
|
+
}
|
|
351
|
+
function AgentsSectionMdxui({
|
|
352
|
+
totalAgents,
|
|
353
|
+
activeAgents,
|
|
354
|
+
runsToday,
|
|
355
|
+
successRate,
|
|
356
|
+
topAgents,
|
|
357
|
+
loading = false,
|
|
358
|
+
className
|
|
359
|
+
}) {
|
|
360
|
+
if (loading) {
|
|
361
|
+
return /* @__PURE__ */ jsxs("div", { "data-testid": "agents-section-loading", className: twMerge("animate-pulse space-y-4", className), children: [
|
|
362
|
+
/* @__PURE__ */ jsx("div", { className: "h-8 w-48 rounded bg-gray-200 dark:bg-gray-700" }),
|
|
363
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-4 md:grid-cols-4", children: [...Array(4)].map((_, i) => /* @__PURE__ */ jsx("div", { className: "h-24 rounded-lg bg-gray-200 dark:bg-gray-700" }, i.toString())) })
|
|
364
|
+
] });
|
|
365
|
+
}
|
|
366
|
+
return /* @__PURE__ */ jsxs("section", { className: twMerge("space-y-6", className), children: [
|
|
367
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Agents Overview" }),
|
|
368
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4 md:grid-cols-4", children: [
|
|
369
|
+
/* @__PURE__ */ jsx(MetricCard, { label: "Total Agents", value: totalAgents }),
|
|
370
|
+
/* @__PURE__ */ jsx(MetricCard, { label: "Active Agents", value: activeAgents }),
|
|
371
|
+
/* @__PURE__ */ jsx(MetricCard, { label: "Runs Today", value: runsToday }),
|
|
372
|
+
/* @__PURE__ */ jsx(MetricCard, { label: "Success Rate", value: `${successRate}%` })
|
|
373
|
+
] }),
|
|
374
|
+
topAgents && topAgents.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-6", children: [
|
|
375
|
+
/* @__PURE__ */ jsx("h3", { className: "mb-4 text-sm font-medium text-gray-700 dark:text-gray-300", children: "Top Performing Agents" }),
|
|
376
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-3", children: topAgents.map((agent) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded-lg border border-gray-200 p-3 dark:border-gray-700", children: [
|
|
377
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
378
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-blue-100 text-blue-600 dark:bg-blue-900 dark:text-blue-300", children: agent.name.charAt(0) }),
|
|
379
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-gray-900 dark:text-white", children: agent.name })
|
|
380
|
+
] }),
|
|
381
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 text-sm text-gray-500 dark:text-gray-400", children: [
|
|
382
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
383
|
+
agent.runs,
|
|
384
|
+
" runs"
|
|
385
|
+
] }),
|
|
386
|
+
/* @__PURE__ */ jsxs("span", { className: "text-green-600 dark:text-green-400", children: [
|
|
387
|
+
agent.successRate,
|
|
388
|
+
"%"
|
|
389
|
+
] })
|
|
390
|
+
] })
|
|
391
|
+
] }, agent.id)) })
|
|
392
|
+
] })
|
|
393
|
+
] });
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// src/overview/components/sections/RetentionSection.tsx
|
|
397
|
+
import { twMerge as twMerge2 } from "tailwind-merge";
|
|
398
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
399
|
+
function RetentionSection({
|
|
400
|
+
cohorts,
|
|
401
|
+
periods,
|
|
402
|
+
currentRetention,
|
|
403
|
+
trend,
|
|
404
|
+
loading = false,
|
|
405
|
+
className
|
|
406
|
+
}) {
|
|
407
|
+
if (loading) {
|
|
408
|
+
return /* @__PURE__ */ jsxs2(
|
|
409
|
+
"div",
|
|
410
|
+
{
|
|
411
|
+
"data-testid": "retention-section-loading",
|
|
412
|
+
className: twMerge2("animate-pulse space-y-4", className),
|
|
413
|
+
children: [
|
|
414
|
+
/* @__PURE__ */ jsx2("div", { className: "h-8 w-48 rounded bg-gray-200 dark:bg-gray-700" }),
|
|
415
|
+
/* @__PURE__ */ jsx2("div", { className: "h-32 rounded-lg bg-gray-200 dark:bg-gray-700" }),
|
|
416
|
+
/* @__PURE__ */ jsx2("div", { className: "h-64 rounded-lg bg-gray-200 dark:bg-gray-700" })
|
|
417
|
+
]
|
|
418
|
+
}
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
return /* @__PURE__ */ jsxs2("section", { className: twMerge2("space-y-6", className), children: [
|
|
422
|
+
/* @__PURE__ */ jsx2("h2", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Retention Analytics" }),
|
|
423
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-4 rounded-lg border border-gray-200 bg-white p-4 dark:border-gray-700 dark:bg-gray-800", children: [
|
|
424
|
+
/* @__PURE__ */ jsxs2("div", { children: [
|
|
425
|
+
/* @__PURE__ */ jsx2("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "Current Retention" }),
|
|
426
|
+
/* @__PURE__ */ jsxs2("p", { className: "mt-1 text-3xl font-semibold text-gray-900 dark:text-white", children: [
|
|
427
|
+
currentRetention,
|
|
428
|
+
"%"
|
|
429
|
+
] })
|
|
430
|
+
] }),
|
|
431
|
+
/* @__PURE__ */ jsx2(TrendIndicator, { trend })
|
|
432
|
+
] }),
|
|
433
|
+
/* @__PURE__ */ jsx2("div", { className: "overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ jsxs2("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [
|
|
434
|
+
/* @__PURE__ */ jsx2("thead", { className: "bg-gray-50 dark:bg-gray-800", children: /* @__PURE__ */ jsxs2("tr", { children: [
|
|
435
|
+
/* @__PURE__ */ jsx2("th", { className: "px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400", children: "Cohort" }),
|
|
436
|
+
/* @__PURE__ */ jsx2("th", { className: "px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400", children: "Size" }),
|
|
437
|
+
periods.map((period) => /* @__PURE__ */ jsx2(
|
|
438
|
+
"th",
|
|
439
|
+
{
|
|
440
|
+
className: "px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400",
|
|
441
|
+
children: period
|
|
442
|
+
},
|
|
443
|
+
period
|
|
444
|
+
))
|
|
445
|
+
] }) }),
|
|
446
|
+
/* @__PURE__ */ jsx2("tbody", { className: "divide-y divide-gray-200 bg-white dark:divide-gray-700 dark:bg-gray-900", children: cohorts.map((cohort) => /* @__PURE__ */ jsxs2("tr", { children: [
|
|
447
|
+
/* @__PURE__ */ jsx2("td", { className: "whitespace-nowrap px-4 py-3 text-sm font-medium text-gray-900 dark:text-white", children: cohort.cohort }),
|
|
448
|
+
/* @__PURE__ */ jsx2("td", { className: "whitespace-nowrap px-4 py-3 text-sm text-gray-500 dark:text-gray-400", children: cohort.size }),
|
|
449
|
+
cohort.retention.map((rate, idx) => /* @__PURE__ */ jsx2(
|
|
450
|
+
"td",
|
|
451
|
+
{
|
|
452
|
+
className: "whitespace-nowrap px-4 py-3 text-sm",
|
|
453
|
+
style: {
|
|
454
|
+
backgroundColor: getRetentionColor(rate)
|
|
455
|
+
},
|
|
456
|
+
children: /* @__PURE__ */ jsxs2("span", { className: "font-medium text-gray-900 dark:text-white", children: [
|
|
457
|
+
rate,
|
|
458
|
+
"%"
|
|
459
|
+
] })
|
|
460
|
+
},
|
|
461
|
+
idx.toString()
|
|
462
|
+
))
|
|
463
|
+
] }, cohort.cohort)) })
|
|
464
|
+
] }) })
|
|
465
|
+
] });
|
|
466
|
+
}
|
|
467
|
+
function TrendIndicator({ trend }) {
|
|
468
|
+
const colors = {
|
|
469
|
+
up: "text-green-600 dark:text-green-400",
|
|
470
|
+
down: "text-red-600 dark:text-red-400",
|
|
471
|
+
flat: "text-gray-500 dark:text-gray-400"
|
|
472
|
+
};
|
|
473
|
+
const arrows = {
|
|
474
|
+
up: /* @__PURE__ */ jsx2(
|
|
475
|
+
"svg",
|
|
476
|
+
{
|
|
477
|
+
className: "h-5 w-5",
|
|
478
|
+
fill: "none",
|
|
479
|
+
viewBox: "0 0 24 24",
|
|
480
|
+
stroke: "currentColor",
|
|
481
|
+
"aria-hidden": "true",
|
|
482
|
+
children: /* @__PURE__ */ jsx2(
|
|
483
|
+
"path",
|
|
484
|
+
{
|
|
485
|
+
strokeLinecap: "round",
|
|
486
|
+
strokeLinejoin: "round",
|
|
487
|
+
strokeWidth: 2,
|
|
488
|
+
d: "M5 10l7-7m0 0l7 7m-7-7v18"
|
|
489
|
+
}
|
|
490
|
+
)
|
|
491
|
+
}
|
|
492
|
+
),
|
|
493
|
+
down: /* @__PURE__ */ jsx2(
|
|
494
|
+
"svg",
|
|
495
|
+
{
|
|
496
|
+
className: "h-5 w-5",
|
|
497
|
+
fill: "none",
|
|
498
|
+
viewBox: "0 0 24 24",
|
|
499
|
+
stroke: "currentColor",
|
|
500
|
+
"aria-hidden": "true",
|
|
501
|
+
children: /* @__PURE__ */ jsx2(
|
|
502
|
+
"path",
|
|
503
|
+
{
|
|
504
|
+
strokeLinecap: "round",
|
|
505
|
+
strokeLinejoin: "round",
|
|
506
|
+
strokeWidth: 2,
|
|
507
|
+
d: "M19 14l-7 7m0 0l-7-7m7 7V3"
|
|
508
|
+
}
|
|
509
|
+
)
|
|
510
|
+
}
|
|
511
|
+
),
|
|
512
|
+
flat: /* @__PURE__ */ jsx2(
|
|
513
|
+
"svg",
|
|
514
|
+
{
|
|
515
|
+
className: "h-5 w-5",
|
|
516
|
+
fill: "none",
|
|
517
|
+
viewBox: "0 0 24 24",
|
|
518
|
+
stroke: "currentColor",
|
|
519
|
+
"aria-hidden": "true",
|
|
520
|
+
children: /* @__PURE__ */ jsx2(
|
|
521
|
+
"path",
|
|
522
|
+
{
|
|
523
|
+
strokeLinecap: "round",
|
|
524
|
+
strokeLinejoin: "round",
|
|
525
|
+
strokeWidth: 2,
|
|
526
|
+
d: "M5 12h14"
|
|
527
|
+
}
|
|
528
|
+
)
|
|
529
|
+
}
|
|
530
|
+
)
|
|
531
|
+
};
|
|
532
|
+
return /* @__PURE__ */ jsxs2(
|
|
533
|
+
"div",
|
|
534
|
+
{
|
|
535
|
+
"data-trend": trend,
|
|
536
|
+
className: twMerge2("flex items-center gap-1", colors[trend]),
|
|
537
|
+
children: [
|
|
538
|
+
arrows[trend],
|
|
539
|
+
/* @__PURE__ */ jsx2("span", { className: "text-sm font-medium capitalize", children: trend })
|
|
540
|
+
]
|
|
541
|
+
}
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
function getRetentionColor(rate) {
|
|
545
|
+
if (rate >= 80) return "rgba(34, 197, 94, 0.2)";
|
|
546
|
+
if (rate >= 60) return "rgba(234, 179, 8, 0.2)";
|
|
547
|
+
if (rate >= 40) return "rgba(249, 115, 22, 0.2)";
|
|
548
|
+
return "rgba(239, 68, 68, 0.2)";
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// src/overview/components/sections/SupportSection.tsx
|
|
552
|
+
import { twMerge as twMerge3 } from "tailwind-merge";
|
|
553
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
554
|
+
function SupportSection({
|
|
555
|
+
openTickets,
|
|
556
|
+
avgResponseTime,
|
|
557
|
+
resolutionRate,
|
|
558
|
+
csat,
|
|
559
|
+
ticketsByStatus,
|
|
560
|
+
ticketsByPriority,
|
|
561
|
+
volumeTrend: _volumeTrend,
|
|
562
|
+
loading = false,
|
|
563
|
+
className
|
|
564
|
+
}) {
|
|
565
|
+
if (loading) {
|
|
566
|
+
return /* @__PURE__ */ jsxs3(
|
|
567
|
+
"div",
|
|
568
|
+
{
|
|
569
|
+
"data-testid": "support-section-loading",
|
|
570
|
+
className: twMerge3("animate-pulse space-y-4", className),
|
|
571
|
+
children: [
|
|
572
|
+
/* @__PURE__ */ jsx3("div", { className: "h-8 w-48 rounded bg-gray-200 dark:bg-gray-700" }),
|
|
573
|
+
/* @__PURE__ */ jsx3("div", { className: "grid grid-cols-2 gap-4 md:grid-cols-4", children: [...Array(4)].map((_, i) => /* @__PURE__ */ jsx3(
|
|
574
|
+
"div",
|
|
575
|
+
{
|
|
576
|
+
className: "h-24 rounded-lg bg-gray-200 dark:bg-gray-700"
|
|
577
|
+
},
|
|
578
|
+
i.toString()
|
|
579
|
+
)) })
|
|
580
|
+
]
|
|
581
|
+
}
|
|
582
|
+
);
|
|
583
|
+
}
|
|
584
|
+
return /* @__PURE__ */ jsxs3("section", { className: twMerge3("space-y-6", className), children: [
|
|
585
|
+
/* @__PURE__ */ jsx3("h2", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Support Overview" }),
|
|
586
|
+
/* @__PURE__ */ jsxs3("div", { className: "grid grid-cols-2 gap-4 md:grid-cols-4", children: [
|
|
587
|
+
/* @__PURE__ */ jsx3(MetricCard2, { label: "Open Tickets", value: openTickets }),
|
|
588
|
+
/* @__PURE__ */ jsx3(MetricCard2, { label: "Avg Response", value: `${avgResponseTime}m` }),
|
|
589
|
+
/* @__PURE__ */ jsx3(MetricCard2, { label: "Resolution Rate", value: `${resolutionRate}%` }),
|
|
590
|
+
/* @__PURE__ */ jsx3(MetricCard2, { label: "CSAT", value: csat })
|
|
591
|
+
] }),
|
|
592
|
+
ticketsByStatus && ticketsByStatus.length > 0 && /* @__PURE__ */ jsxs3("div", { className: "mt-6", children: [
|
|
593
|
+
/* @__PURE__ */ jsx3("h3", { className: "mb-4 text-sm font-medium text-gray-700 dark:text-gray-300", children: "Tickets by Status" }),
|
|
594
|
+
/* @__PURE__ */ jsx3("div", { className: "flex flex-wrap gap-3", children: ticketsByStatus.map((item) => /* @__PURE__ */ jsxs3(
|
|
595
|
+
"div",
|
|
596
|
+
{
|
|
597
|
+
className: "flex items-center gap-2 rounded-full border border-gray-200 px-3 py-1 dark:border-gray-700",
|
|
598
|
+
children: [
|
|
599
|
+
/* @__PURE__ */ jsx3(StatusDot, { status: item.status }),
|
|
600
|
+
/* @__PURE__ */ jsx3("span", { className: "text-sm font-medium text-gray-900 dark:text-white", children: item.status }),
|
|
601
|
+
/* @__PURE__ */ jsx3("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: item.count })
|
|
602
|
+
]
|
|
603
|
+
},
|
|
604
|
+
item.status
|
|
605
|
+
)) })
|
|
606
|
+
] }),
|
|
607
|
+
ticketsByPriority && ticketsByPriority.length > 0 && /* @__PURE__ */ jsxs3("div", { className: "mt-6", children: [
|
|
608
|
+
/* @__PURE__ */ jsx3("h3", { className: "mb-4 text-sm font-medium text-gray-700 dark:text-gray-300", children: "Tickets by Priority" }),
|
|
609
|
+
/* @__PURE__ */ jsx3("div", { className: "space-y-2", children: ticketsByPriority.map((item) => /* @__PURE__ */ jsxs3(
|
|
610
|
+
"div",
|
|
611
|
+
{
|
|
612
|
+
className: "flex items-center justify-between rounded-lg border border-gray-200 p-3 dark:border-gray-700",
|
|
613
|
+
children: [
|
|
614
|
+
/* @__PURE__ */ jsx3("span", { className: "text-sm font-medium text-gray-900 dark:text-white", children: item.priority }),
|
|
615
|
+
/* @__PURE__ */ jsxs3("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
|
|
616
|
+
item.count,
|
|
617
|
+
" tickets"
|
|
618
|
+
] })
|
|
619
|
+
]
|
|
620
|
+
},
|
|
621
|
+
item.priority
|
|
622
|
+
)) })
|
|
623
|
+
] })
|
|
624
|
+
] });
|
|
625
|
+
}
|
|
626
|
+
function MetricCard2({
|
|
627
|
+
label,
|
|
628
|
+
value
|
|
629
|
+
}) {
|
|
630
|
+
return /* @__PURE__ */ jsxs3("div", { className: "rounded-lg border border-gray-200 bg-white p-4 dark:border-gray-700 dark:bg-gray-800", children: [
|
|
631
|
+
/* @__PURE__ */ jsx3("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: label }),
|
|
632
|
+
/* @__PURE__ */ jsx3("p", { className: "mt-1 text-2xl font-semibold text-gray-900 dark:text-white", children: value })
|
|
633
|
+
] });
|
|
634
|
+
}
|
|
635
|
+
function StatusDot({ status }) {
|
|
636
|
+
const colors = {
|
|
637
|
+
Open: "bg-blue-500",
|
|
638
|
+
Pending: "bg-yellow-500",
|
|
639
|
+
Resolved: "bg-green-500",
|
|
640
|
+
Closed: "bg-gray-500"
|
|
641
|
+
};
|
|
642
|
+
return /* @__PURE__ */ jsx3(
|
|
643
|
+
"span",
|
|
644
|
+
{
|
|
645
|
+
className: twMerge3(
|
|
646
|
+
"h-2 w-2 rounded-full",
|
|
647
|
+
colors[status] || "bg-gray-400"
|
|
648
|
+
)
|
|
649
|
+
}
|
|
650
|
+
);
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
// src/overview/components/sections/WorkflowSection.tsx
|
|
654
|
+
import { twMerge as twMerge4 } from "tailwind-merge";
|
|
655
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
656
|
+
function WorkflowSection({
|
|
657
|
+
totalWorkflows,
|
|
658
|
+
activeWorkflows,
|
|
659
|
+
runsToday,
|
|
660
|
+
successRate,
|
|
661
|
+
timeSaved,
|
|
662
|
+
runsByWorkflow,
|
|
663
|
+
runHistory: _runHistory,
|
|
664
|
+
loading = false,
|
|
665
|
+
className
|
|
666
|
+
}) {
|
|
667
|
+
if (loading) {
|
|
668
|
+
return /* @__PURE__ */ jsxs4(
|
|
669
|
+
"div",
|
|
670
|
+
{
|
|
671
|
+
"data-testid": "workflow-section-loading",
|
|
672
|
+
className: twMerge4("animate-pulse space-y-4", className),
|
|
673
|
+
children: [
|
|
674
|
+
/* @__PURE__ */ jsx4("div", { className: "h-8 w-48 rounded bg-gray-200 dark:bg-gray-700" }),
|
|
675
|
+
/* @__PURE__ */ jsx4("div", { className: "grid grid-cols-2 gap-4 md:grid-cols-4", children: [...Array(4)].map((_, i) => /* @__PURE__ */ jsx4(
|
|
676
|
+
"div",
|
|
677
|
+
{
|
|
678
|
+
className: "h-24 rounded-lg bg-gray-200 dark:bg-gray-700"
|
|
679
|
+
},
|
|
680
|
+
i.toString()
|
|
681
|
+
)) })
|
|
682
|
+
]
|
|
683
|
+
}
|
|
684
|
+
);
|
|
685
|
+
}
|
|
686
|
+
const metrics = [
|
|
687
|
+
{ label: "Total Workflows", value: totalWorkflows },
|
|
688
|
+
{ label: "Active Workflows", value: activeWorkflows },
|
|
689
|
+
{ label: "Runs Today", value: runsToday },
|
|
690
|
+
{ label: "Success Rate", value: `${successRate}%` }
|
|
691
|
+
];
|
|
692
|
+
if (timeSaved !== void 0) {
|
|
693
|
+
metrics.push({ label: "Time Saved", value: `${timeSaved}h` });
|
|
694
|
+
}
|
|
695
|
+
return /* @__PURE__ */ jsxs4("section", { className: twMerge4("space-y-6", className), children: [
|
|
696
|
+
/* @__PURE__ */ jsx4("h2", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Workflow Automation" }),
|
|
697
|
+
/* @__PURE__ */ jsx4("div", { className: "grid grid-cols-2 gap-4 md:grid-cols-4 lg:grid-cols-5", children: metrics.map((metric) => /* @__PURE__ */ jsx4(
|
|
698
|
+
MetricCard3,
|
|
699
|
+
{
|
|
700
|
+
label: metric.label,
|
|
701
|
+
value: metric.value
|
|
702
|
+
},
|
|
703
|
+
metric.label
|
|
704
|
+
)) }),
|
|
705
|
+
runsByWorkflow && runsByWorkflow.length > 0 && /* @__PURE__ */ jsxs4("div", { className: "mt-6", children: [
|
|
706
|
+
/* @__PURE__ */ jsx4("h3", { className: "mb-4 text-sm font-medium text-gray-700 dark:text-gray-300", children: "Workflows Overview" }),
|
|
707
|
+
/* @__PURE__ */ jsx4("div", { className: "space-y-3", children: runsByWorkflow.map((workflow) => /* @__PURE__ */ jsxs4(
|
|
708
|
+
"div",
|
|
709
|
+
{
|
|
710
|
+
className: "flex items-center justify-between rounded-lg border border-gray-200 p-3 dark:border-gray-700",
|
|
711
|
+
children: [
|
|
712
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3", children: [
|
|
713
|
+
/* @__PURE__ */ jsx4("div", { className: "flex h-8 w-8 items-center justify-center rounded-lg bg-purple-100 text-purple-600 dark:bg-purple-900 dark:text-purple-300", children: /* @__PURE__ */ jsx4(WorkflowIcon, {}) }),
|
|
714
|
+
/* @__PURE__ */ jsx4("span", { className: "font-medium text-gray-900 dark:text-white", children: workflow.name })
|
|
715
|
+
] }),
|
|
716
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-4 text-sm text-gray-500 dark:text-gray-400", children: [
|
|
717
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
718
|
+
workflow.runs,
|
|
719
|
+
" runs"
|
|
720
|
+
] }),
|
|
721
|
+
/* @__PURE__ */ jsxs4(
|
|
722
|
+
"span",
|
|
723
|
+
{
|
|
724
|
+
className: workflow.successRate >= 90 ? "text-green-600 dark:text-green-400" : workflow.successRate >= 70 ? "text-yellow-600 dark:text-yellow-400" : "text-red-600 dark:text-red-400",
|
|
725
|
+
children: [
|
|
726
|
+
workflow.successRate,
|
|
727
|
+
"%"
|
|
728
|
+
]
|
|
729
|
+
}
|
|
730
|
+
)
|
|
731
|
+
] })
|
|
732
|
+
]
|
|
733
|
+
},
|
|
734
|
+
workflow.id
|
|
735
|
+
)) })
|
|
736
|
+
] })
|
|
737
|
+
] });
|
|
738
|
+
}
|
|
739
|
+
function MetricCard3({
|
|
740
|
+
label,
|
|
741
|
+
value
|
|
742
|
+
}) {
|
|
743
|
+
return /* @__PURE__ */ jsxs4("div", { className: "rounded-lg border border-gray-200 bg-white p-4 dark:border-gray-700 dark:bg-gray-800", children: [
|
|
744
|
+
/* @__PURE__ */ jsx4("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: label }),
|
|
745
|
+
/* @__PURE__ */ jsx4("p", { className: "mt-1 text-2xl font-semibold text-gray-900 dark:text-white", children: value })
|
|
746
|
+
] });
|
|
747
|
+
}
|
|
748
|
+
function WorkflowIcon() {
|
|
749
|
+
return /* @__PURE__ */ jsx4(
|
|
750
|
+
"svg",
|
|
751
|
+
{
|
|
752
|
+
className: "h-4 w-4",
|
|
753
|
+
fill: "none",
|
|
754
|
+
viewBox: "0 0 24 24",
|
|
755
|
+
stroke: "currentColor",
|
|
756
|
+
"aria-hidden": "true",
|
|
757
|
+
children: /* @__PURE__ */ jsx4(
|
|
758
|
+
"path",
|
|
759
|
+
{
|
|
760
|
+
strokeLinecap: "round",
|
|
761
|
+
strokeLinejoin: "round",
|
|
762
|
+
strokeWidth: 2,
|
|
763
|
+
d: "M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"
|
|
764
|
+
}
|
|
765
|
+
)
|
|
766
|
+
}
|
|
767
|
+
);
|
|
768
|
+
}
|
|
769
|
+
export {
|
|
770
|
+
AgentsSection,
|
|
771
|
+
RetentionSection,
|
|
772
|
+
SupportSection,
|
|
773
|
+
WorkflowSection
|
|
774
|
+
};
|
|
775
|
+
//# sourceMappingURL=index.js.map
|