@optifye/dashboard-core 4.2.9 → 4.3.4
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/index.d.mts +39 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.js +734 -21
- package/dist/index.mjs +732 -22
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2109,28 +2109,42 @@ var AuthProvider = ({ children }) => {
|
|
|
2109
2109
|
id: supabaseUser.id,
|
|
2110
2110
|
email: supabaseUser.email
|
|
2111
2111
|
};
|
|
2112
|
-
if (!
|
|
2112
|
+
if (!supabase) return basicUser;
|
|
2113
2113
|
try {
|
|
2114
2114
|
const timeoutPromise = new Promise(
|
|
2115
2115
|
(_, reject) => setTimeout(() => reject(new Error("Profile fetch timeout")), 5e3)
|
|
2116
2116
|
);
|
|
2117
|
-
const
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2117
|
+
const rolePromise = supabase.from("user_roles").select("role_level").eq("user_id", supabaseUser.id).single();
|
|
2118
|
+
let profilePromise = null;
|
|
2119
|
+
if (userProfileTable) {
|
|
2120
|
+
profilePromise = supabase.from(userProfileTable).select(roleColumn).eq("id", supabaseUser.id).single();
|
|
2121
|
+
}
|
|
2122
|
+
const [roleResult, profileResult] = await Promise.race([
|
|
2123
|
+
Promise.all([
|
|
2124
|
+
rolePromise,
|
|
2125
|
+
profilePromise || Promise.resolve(null)
|
|
2126
|
+
]),
|
|
2127
|
+
timeoutPromise.then(() => {
|
|
2128
|
+
throw new Error("Timeout");
|
|
2129
|
+
})
|
|
2121
2130
|
]);
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2131
|
+
let roleLevel = void 0;
|
|
2132
|
+
if (roleResult && !roleResult.error && roleResult.data) {
|
|
2133
|
+
roleLevel = roleResult.data.role_level;
|
|
2134
|
+
} else if (roleResult?.error) {
|
|
2135
|
+
console.log("Error fetching role_level:", roleResult.error.message);
|
|
2136
|
+
}
|
|
2137
|
+
let roleValue = void 0;
|
|
2138
|
+
if (profileResult && !profileResult.error && profileResult.data) {
|
|
2139
|
+
roleValue = profileResult.data[roleColumn];
|
|
2129
2140
|
}
|
|
2130
|
-
|
|
2131
|
-
|
|
2141
|
+
return {
|
|
2142
|
+
...basicUser,
|
|
2143
|
+
role: roleValue,
|
|
2144
|
+
role_level: roleLevel
|
|
2145
|
+
};
|
|
2132
2146
|
} catch (err) {
|
|
2133
|
-
console.error("Error fetching user
|
|
2147
|
+
console.error("Error fetching user details:", err);
|
|
2134
2148
|
return basicUser;
|
|
2135
2149
|
}
|
|
2136
2150
|
}, [supabase, userProfileTable, roleColumn]);
|
|
@@ -2165,7 +2179,8 @@ var AuthProvider = ({ children }) => {
|
|
|
2165
2179
|
email: userDetails.email,
|
|
2166
2180
|
name: userDetails.email,
|
|
2167
2181
|
// using email as the display name for now
|
|
2168
|
-
role: userDetails.role
|
|
2182
|
+
role: userDetails.role,
|
|
2183
|
+
role_level: userDetails.role_level
|
|
2169
2184
|
});
|
|
2170
2185
|
}
|
|
2171
2186
|
}
|
|
@@ -2203,7 +2218,8 @@ var AuthProvider = ({ children }) => {
|
|
|
2203
2218
|
identifyCoreUser(userDetails.id, {
|
|
2204
2219
|
email: userDetails.email,
|
|
2205
2220
|
name: userDetails.email,
|
|
2206
|
-
role: userDetails.role
|
|
2221
|
+
role: userDetails.role,
|
|
2222
|
+
role_level: userDetails.role_level
|
|
2207
2223
|
});
|
|
2208
2224
|
}
|
|
2209
2225
|
}
|
|
@@ -17989,6 +18005,187 @@ var SOPComplianceChart = ({
|
|
|
17989
18005
|
renderLegend()
|
|
17990
18006
|
] });
|
|
17991
18007
|
};
|
|
18008
|
+
var GaugeChart = ({
|
|
18009
|
+
value,
|
|
18010
|
+
min,
|
|
18011
|
+
max,
|
|
18012
|
+
target,
|
|
18013
|
+
label,
|
|
18014
|
+
unit = "",
|
|
18015
|
+
thresholds,
|
|
18016
|
+
className = ""
|
|
18017
|
+
}) => {
|
|
18018
|
+
const normalizedValue = (value - min) / (max - min) * 100;
|
|
18019
|
+
const clampedValue = Math.max(0, Math.min(100, normalizedValue));
|
|
18020
|
+
const data = [
|
|
18021
|
+
{ name: "value", value: clampedValue },
|
|
18022
|
+
{ name: "empty", value: 100 - clampedValue }
|
|
18023
|
+
];
|
|
18024
|
+
const getColor = () => {
|
|
18025
|
+
if (thresholds && thresholds.length > 0) {
|
|
18026
|
+
const sortedThresholds = [...thresholds].sort((a, b) => a.value - b.value);
|
|
18027
|
+
for (let i = sortedThresholds.length - 1; i >= 0; i--) {
|
|
18028
|
+
if (value >= sortedThresholds[i].value) {
|
|
18029
|
+
return sortedThresholds[i].color;
|
|
18030
|
+
}
|
|
18031
|
+
}
|
|
18032
|
+
return sortedThresholds[0].color;
|
|
18033
|
+
}
|
|
18034
|
+
if (clampedValue < 33) return "#ef4444";
|
|
18035
|
+
if (clampedValue < 66) return "#f59e0b";
|
|
18036
|
+
return "#10b981";
|
|
18037
|
+
};
|
|
18038
|
+
const gaugeColor = getColor();
|
|
18039
|
+
const targetAngle = target !== void 0 ? 180 - (target - min) / (max - min) * 180 : null;
|
|
18040
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `relative w-full h-full flex flex-col items-center justify-center ${className}`, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full max-w-[280px] aspect-square", children: [
|
|
18041
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(recharts.PieChart, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18042
|
+
recharts.Pie,
|
|
18043
|
+
{
|
|
18044
|
+
data,
|
|
18045
|
+
cx: "50%",
|
|
18046
|
+
cy: "50%",
|
|
18047
|
+
startAngle: 180,
|
|
18048
|
+
endAngle: 0,
|
|
18049
|
+
innerRadius: "65%",
|
|
18050
|
+
outerRadius: "85%",
|
|
18051
|
+
paddingAngle: 0,
|
|
18052
|
+
dataKey: "value",
|
|
18053
|
+
animationBegin: 0,
|
|
18054
|
+
animationDuration: 1e3,
|
|
18055
|
+
animationEasing: "ease-out",
|
|
18056
|
+
children: [
|
|
18057
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Cell, { fill: gaugeColor }),
|
|
18058
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Cell, { fill: "#f3f4f6" })
|
|
18059
|
+
]
|
|
18060
|
+
}
|
|
18061
|
+
) }) }),
|
|
18062
|
+
targetAngle !== null && /* @__PURE__ */ jsxRuntime.jsx(
|
|
18063
|
+
"div",
|
|
18064
|
+
{
|
|
18065
|
+
className: "absolute top-1/2 left-1/2 w-1 h-[42%] bg-gray-800 origin-bottom",
|
|
18066
|
+
style: {
|
|
18067
|
+
transform: `translate(-50%, -100%) rotate(${targetAngle}deg)`,
|
|
18068
|
+
transition: "transform 0.3s ease-out"
|
|
18069
|
+
},
|
|
18070
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute -top-1 -left-1.5 w-3 h-3 bg-gray-800 rounded-full" })
|
|
18071
|
+
}
|
|
18072
|
+
),
|
|
18073
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
|
|
18074
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-3xl font-bold text-gray-800", children: [
|
|
18075
|
+
value.toFixed(unit === "%" ? 1 : 0),
|
|
18076
|
+
unit
|
|
18077
|
+
] }),
|
|
18078
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-600 mt-1 font-medium", children: label }),
|
|
18079
|
+
target !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-gray-500 mt-1", children: [
|
|
18080
|
+
"Target: ",
|
|
18081
|
+
target,
|
|
18082
|
+
unit
|
|
18083
|
+
] })
|
|
18084
|
+
] }) }),
|
|
18085
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute bottom-[15%] left-[15%] text-xs text-gray-500", children: [
|
|
18086
|
+
min,
|
|
18087
|
+
unit
|
|
18088
|
+
] }),
|
|
18089
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute bottom-[15%] right-[15%] text-xs text-gray-500", children: [
|
|
18090
|
+
max,
|
|
18091
|
+
unit
|
|
18092
|
+
] })
|
|
18093
|
+
] }) });
|
|
18094
|
+
};
|
|
18095
|
+
var DEFAULT_COLORS = [
|
|
18096
|
+
"#3b82f6",
|
|
18097
|
+
// blue-500
|
|
18098
|
+
"#10b981",
|
|
18099
|
+
// green-500
|
|
18100
|
+
"#f59e0b",
|
|
18101
|
+
// amber-500
|
|
18102
|
+
"#ef4444",
|
|
18103
|
+
// red-500
|
|
18104
|
+
"#8b5cf6",
|
|
18105
|
+
// violet-500
|
|
18106
|
+
"#06b6d4",
|
|
18107
|
+
// cyan-500
|
|
18108
|
+
"#f97316",
|
|
18109
|
+
// orange-500
|
|
18110
|
+
"#6366f1"
|
|
18111
|
+
// indigo-500
|
|
18112
|
+
];
|
|
18113
|
+
var PieChart4 = ({
|
|
18114
|
+
data,
|
|
18115
|
+
className = "",
|
|
18116
|
+
showPercentages = false,
|
|
18117
|
+
colors = DEFAULT_COLORS
|
|
18118
|
+
}) => {
|
|
18119
|
+
const total = data.reduce((sum, entry) => sum + entry.value, 0);
|
|
18120
|
+
const dataWithPercentage = data.map((entry) => ({
|
|
18121
|
+
...entry,
|
|
18122
|
+
percentage: (entry.value / total * 100).toFixed(1)
|
|
18123
|
+
}));
|
|
18124
|
+
const renderCustomLabel = (props) => {
|
|
18125
|
+
if (!showPercentages) return null;
|
|
18126
|
+
const { cx: cx2, cy, midAngle, innerRadius, outerRadius, percentage } = props;
|
|
18127
|
+
const RADIAN = Math.PI / 180;
|
|
18128
|
+
const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
|
|
18129
|
+
const x = cx2 + radius * Math.cos(-midAngle * RADIAN);
|
|
18130
|
+
const y = cy + radius * Math.sin(-midAngle * RADIAN);
|
|
18131
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18132
|
+
"text",
|
|
18133
|
+
{
|
|
18134
|
+
x,
|
|
18135
|
+
y,
|
|
18136
|
+
fill: "white",
|
|
18137
|
+
textAnchor: x > cx2 ? "start" : "end",
|
|
18138
|
+
dominantBaseline: "central",
|
|
18139
|
+
className: "text-xs font-medium",
|
|
18140
|
+
children: [
|
|
18141
|
+
percentage,
|
|
18142
|
+
"%"
|
|
18143
|
+
]
|
|
18144
|
+
}
|
|
18145
|
+
);
|
|
18146
|
+
};
|
|
18147
|
+
const CustomTooltip = ({ active, payload }) => {
|
|
18148
|
+
if (active && payload && payload.length) {
|
|
18149
|
+
const data2 = payload[0];
|
|
18150
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white px-3 py-2 shadow-lg rounded-lg border border-gray-200", children: [
|
|
18151
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-gray-900", children: data2.name }),
|
|
18152
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-gray-600", children: [
|
|
18153
|
+
"Value: ",
|
|
18154
|
+
data2.value,
|
|
18155
|
+
showPercentages && ` (${data2.payload.percentage}%)`
|
|
18156
|
+
] })
|
|
18157
|
+
] });
|
|
18158
|
+
}
|
|
18159
|
+
return null;
|
|
18160
|
+
};
|
|
18161
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `w-full h-full ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.PieChart, { children: [
|
|
18162
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18163
|
+
recharts.Pie,
|
|
18164
|
+
{
|
|
18165
|
+
data: dataWithPercentage,
|
|
18166
|
+
cx: "50%",
|
|
18167
|
+
cy: "50%",
|
|
18168
|
+
labelLine: false,
|
|
18169
|
+
label: showPercentages ? renderCustomLabel : void 0,
|
|
18170
|
+
outerRadius: "80%",
|
|
18171
|
+
fill: "#8884d8",
|
|
18172
|
+
dataKey: "value",
|
|
18173
|
+
animationBegin: 0,
|
|
18174
|
+
animationDuration: 800,
|
|
18175
|
+
children: dataWithPercentage.map((entry, index) => /* @__PURE__ */ jsxRuntime.jsx(recharts.Cell, { fill: colors[index % colors.length] }, `cell-${index}`))
|
|
18176
|
+
}
|
|
18177
|
+
),
|
|
18178
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(CustomTooltip, {}) }),
|
|
18179
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18180
|
+
recharts.Legend,
|
|
18181
|
+
{
|
|
18182
|
+
verticalAlign: "bottom",
|
|
18183
|
+
height: 36,
|
|
18184
|
+
formatter: (value) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: value })
|
|
18185
|
+
}
|
|
18186
|
+
)
|
|
18187
|
+
] }) }) });
|
|
18188
|
+
};
|
|
17992
18189
|
var TrendIcon = ({ trend }) => {
|
|
17993
18190
|
if (trend === "up") {
|
|
17994
18191
|
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, { className: "h-4 w-4 text-green-500" });
|
|
@@ -22587,7 +22784,7 @@ var getWorkspaceStyles = (position, isPlaceholder = false) => {
|
|
|
22587
22784
|
${additionalStyles}
|
|
22588
22785
|
${isPlaceholder ? "cursor-default" : ""}`;
|
|
22589
22786
|
};
|
|
22590
|
-
var
|
|
22787
|
+
var Legend6 = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2 sm:gap-3 bg-white/95 rounded-lg shadow-sm px-2 sm:px-4 py-1 sm:py-1.5 border border-gray-200/60 backdrop-blur-sm text-xs sm:text-sm", children: [
|
|
22591
22788
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium text-gray-700 hidden sm:block", children: "Efficiency:" }),
|
|
22592
22789
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 sm:gap-4", children: [
|
|
22593
22790
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 sm:gap-2", children: [
|
|
@@ -22725,8 +22922,8 @@ var WorkspaceGrid = React14__namespace.default.memo(({
|
|
|
22725
22922
|
const { VideoGridView: VideoGridViewComponent } = useRegistry();
|
|
22726
22923
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `relative w-full h-full overflow-hidden ${className}`, children: [
|
|
22727
22924
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute top-0 left-2 sm:left-4 right-2 sm:right-8 z-20", children: [
|
|
22728
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row items-center justify-between py-1 sm:py-1.5 gap-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
22729
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sm:hidden mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
22925
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row items-center justify-between py-1 sm:py-1.5 gap-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsxRuntime.jsx(Legend6, {}) }) }),
|
|
22926
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sm:hidden mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(Legend6, {}) })
|
|
22730
22927
|
] }),
|
|
22731
22928
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-10 sm:top-16 left-0 right-0 bottom-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
22732
22929
|
VideoGridViewComponent,
|
|
@@ -23329,6 +23526,78 @@ var WorkspaceMonthlyDataFetcher = ({
|
|
|
23329
23526
|
}, [workspaceId, selectedMonth, selectedYear, supabase, onDataLoaded, onLoadingChange]);
|
|
23330
23527
|
return null;
|
|
23331
23528
|
};
|
|
23529
|
+
var WorkspaceDisplayNameExample = () => {
|
|
23530
|
+
const { displayNames, loading, error } = useWorkspaceDisplayNames();
|
|
23531
|
+
const { displayName: singleWorkspaceName, loading: singleLoading } = useWorkspaceDisplayName("WS01");
|
|
23532
|
+
const { displayNames: displayNamesMap, loading: mapLoading } = useWorkspaceDisplayNamesMap(["WS01", "WS02", "WS03"]);
|
|
23533
|
+
if (loading) {
|
|
23534
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: "Loading workspace display names..." });
|
|
23535
|
+
}
|
|
23536
|
+
if (error) {
|
|
23537
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4 text-red-600", children: [
|
|
23538
|
+
"Error loading workspace display names: ",
|
|
23539
|
+
error.message
|
|
23540
|
+
] });
|
|
23541
|
+
}
|
|
23542
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-6 max-w-4xl mx-auto", children: [
|
|
23543
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl font-bold mb-6", children: "Workspace Display Names Examples" }),
|
|
23544
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-8", children: [
|
|
23545
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold mb-4", children: "1. All Workspace Display Names" }),
|
|
23546
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4", children: Object.entries(displayNames).map(([workspaceId, displayName]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-3 border rounded-lg", children: [
|
|
23547
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium", children: workspaceId }),
|
|
23548
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-600", children: displayName })
|
|
23549
|
+
] }, workspaceId)) }),
|
|
23550
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 p-3 bg-gray-50 rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm", children: [
|
|
23551
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Using utility function:" }),
|
|
23552
|
+
` getWorkspaceDisplayName('WS01') = "`,
|
|
23553
|
+
getWorkspaceDisplayName("WS01"),
|
|
23554
|
+
'"'
|
|
23555
|
+
] }) })
|
|
23556
|
+
] }),
|
|
23557
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-8", children: [
|
|
23558
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold mb-4", children: "2. Single Workspace Display Name" }),
|
|
23559
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-3 border rounded-lg", children: singleLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Loading WS01..." }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
23560
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "WS01:" }),
|
|
23561
|
+
" ",
|
|
23562
|
+
singleWorkspaceName
|
|
23563
|
+
] }) })
|
|
23564
|
+
] }),
|
|
23565
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-8", children: [
|
|
23566
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold mb-4", children: "3. Specific Workspaces Map" }),
|
|
23567
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4", children: mapLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Loading specific workspaces..." }) : Object.entries(displayNamesMap).map(([workspaceId, displayName]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-3 border rounded-lg", children: [
|
|
23568
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium", children: workspaceId }),
|
|
23569
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-600", children: displayName })
|
|
23570
|
+
] }, workspaceId)) })
|
|
23571
|
+
] }),
|
|
23572
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-8 p-4 bg-blue-50 rounded-lg", children: [
|
|
23573
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold mb-2", children: "Migration Guide" }),
|
|
23574
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm space-y-2", children: [
|
|
23575
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Before (hardcoded):" }) }),
|
|
23576
|
+
/* @__PURE__ */ jsxRuntime.jsxs("code", { className: "block p-2 bg-gray-100 rounded", children: [
|
|
23577
|
+
"import ",
|
|
23578
|
+
`{getWorkspaceDisplayName}`,
|
|
23579
|
+
" from '@optifye/dashboard-core';",
|
|
23580
|
+
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
23581
|
+
"const name = getWorkspaceDisplayName('WS01'); // Synchronous, hardcoded"
|
|
23582
|
+
] }),
|
|
23583
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "After (from Supabase):" }) }),
|
|
23584
|
+
/* @__PURE__ */ jsxRuntime.jsxs("code", { className: "block p-2 bg-gray-100 rounded", children: [
|
|
23585
|
+
"import ",
|
|
23586
|
+
`{useWorkspaceDisplayName}`,
|
|
23587
|
+
" from '@optifye/dashboard-core';",
|
|
23588
|
+
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
23589
|
+
"const ",
|
|
23590
|
+
`{displayName, loading}`,
|
|
23591
|
+
" = useWorkspaceDisplayName('WS01'); // Async, from database"
|
|
23592
|
+
] }),
|
|
23593
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-blue-700", children: [
|
|
23594
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Note:" }),
|
|
23595
|
+
" The old synchronous functions are still available as fallbacks and for backward compatibility."
|
|
23596
|
+
] })
|
|
23597
|
+
] })
|
|
23598
|
+
] })
|
|
23599
|
+
] });
|
|
23600
|
+
};
|
|
23332
23601
|
var Breadcrumbs = ({ items }) => {
|
|
23333
23602
|
const navigation = useNavigation();
|
|
23334
23603
|
if (!items || items.length === 0) return null;
|
|
@@ -24774,6 +25043,447 @@ var AIAgentView = () => {
|
|
|
24774
25043
|
});
|
|
24775
25044
|
}
|
|
24776
25045
|
const renderAssistantContent = (content) => {
|
|
25046
|
+
const parseChartPatterns = (text) => {
|
|
25047
|
+
const chartElements = [];
|
|
25048
|
+
let lastIndex = 0;
|
|
25049
|
+
console.log("[DEBUG] Parsing chart patterns from text:", text);
|
|
25050
|
+
const chartRegex = /\[\s*(?:Calling\s+|CALL\s+)?(create_[a-z_]+)\s*\(([\s\S]*?)\)\s*\]/g;
|
|
25051
|
+
let match;
|
|
25052
|
+
const processedIndices = /* @__PURE__ */ new Set();
|
|
25053
|
+
let matchCount = 0;
|
|
25054
|
+
while ((match = chartRegex.exec(text)) !== null) {
|
|
25055
|
+
matchCount++;
|
|
25056
|
+
const startIndex = match.index;
|
|
25057
|
+
const endIndex = startIndex + match[0].length;
|
|
25058
|
+
console.log(`[DEBUG] Found chart pattern #${matchCount}:`, {
|
|
25059
|
+
fullMatch: match[0],
|
|
25060
|
+
chartType: match[1],
|
|
25061
|
+
argsString: match[2],
|
|
25062
|
+
startIndex,
|
|
25063
|
+
endIndex
|
|
25064
|
+
});
|
|
25065
|
+
if (!processedIndices.has(startIndex)) {
|
|
25066
|
+
processedIndices.add(startIndex);
|
|
25067
|
+
if (startIndex > lastIndex) {
|
|
25068
|
+
const beforeText = text.substring(lastIndex, startIndex);
|
|
25069
|
+
chartElements.push(
|
|
25070
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25071
|
+
"div",
|
|
25072
|
+
{
|
|
25073
|
+
dangerouslySetInnerHTML: { __html: formatMessage(beforeText) }
|
|
25074
|
+
},
|
|
25075
|
+
`text-${lastIndex}`
|
|
25076
|
+
)
|
|
25077
|
+
);
|
|
25078
|
+
}
|
|
25079
|
+
const chartType = match[1];
|
|
25080
|
+
const argsString = match[2];
|
|
25081
|
+
try {
|
|
25082
|
+
const args = parseChartArguments(argsString);
|
|
25083
|
+
const chartElement = renderChart(chartType, args, startIndex);
|
|
25084
|
+
if (chartElement) {
|
|
25085
|
+
console.log(`[DEBUG] Successfully rendered chart: ${chartType}`);
|
|
25086
|
+
chartElements.push(chartElement);
|
|
25087
|
+
} else {
|
|
25088
|
+
console.warn(`[DEBUG] Chart element was null for type: ${chartType}`);
|
|
25089
|
+
}
|
|
25090
|
+
} catch (error) {
|
|
25091
|
+
console.error(`Failed to parse chart ${chartType}:`, error);
|
|
25092
|
+
chartElements.push(
|
|
25093
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
25094
|
+
"div",
|
|
25095
|
+
{
|
|
25096
|
+
className: "text-red-500 text-sm",
|
|
25097
|
+
children: [
|
|
25098
|
+
"Error rendering chart: ",
|
|
25099
|
+
match[0]
|
|
25100
|
+
]
|
|
25101
|
+
},
|
|
25102
|
+
`error-${startIndex}`
|
|
25103
|
+
)
|
|
25104
|
+
);
|
|
25105
|
+
}
|
|
25106
|
+
lastIndex = endIndex;
|
|
25107
|
+
}
|
|
25108
|
+
}
|
|
25109
|
+
console.log(`[DEBUG] Total chart patterns found: ${matchCount}`);
|
|
25110
|
+
if (lastIndex < text.length) {
|
|
25111
|
+
const remainingText = text.substring(lastIndex);
|
|
25112
|
+
chartElements.push(
|
|
25113
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25114
|
+
"div",
|
|
25115
|
+
{
|
|
25116
|
+
dangerouslySetInnerHTML: { __html: formatMessage(remainingText) }
|
|
25117
|
+
},
|
|
25118
|
+
`text-${lastIndex}`
|
|
25119
|
+
)
|
|
25120
|
+
);
|
|
25121
|
+
}
|
|
25122
|
+
if (chartElements.length === 1 && lastIndex === 0) {
|
|
25123
|
+
console.log("[DEBUG] No charts found in text, returning null");
|
|
25124
|
+
return null;
|
|
25125
|
+
}
|
|
25126
|
+
console.log(`[DEBUG] Returning ${chartElements.length} chart elements`);
|
|
25127
|
+
return chartElements;
|
|
25128
|
+
};
|
|
25129
|
+
const parseChartArguments = (argsString) => {
|
|
25130
|
+
const args = {};
|
|
25131
|
+
console.log("[DEBUG] Parsing chart arguments:", argsString);
|
|
25132
|
+
const jsonParamRegex = /(\w+)\s*=\s*(\[[\s\S]*?\](?=\s*(?:,|\s*\)|\s*$))|\{[\s\S]*?\}(?=\s*(?:,|\s*\)|\s*$)))/g;
|
|
25133
|
+
let jsonMatch;
|
|
25134
|
+
while ((jsonMatch = jsonParamRegex.exec(argsString)) !== null) {
|
|
25135
|
+
const paramName = jsonMatch[1];
|
|
25136
|
+
const jsonValue = jsonMatch[2];
|
|
25137
|
+
console.log(`[DEBUG] Found JSON parameter: ${paramName} = ${jsonValue}`);
|
|
25138
|
+
try {
|
|
25139
|
+
args[paramName] = JSON.parse(jsonValue);
|
|
25140
|
+
console.log(`[DEBUG] Successfully parsed ${paramName}:`, args[paramName]);
|
|
25141
|
+
argsString = argsString.replace(jsonMatch[0], "");
|
|
25142
|
+
} catch (e) {
|
|
25143
|
+
console.error(`Failed to parse ${paramName} JSON:`, e);
|
|
25144
|
+
console.error(`JSON value that failed:`, jsonValue);
|
|
25145
|
+
}
|
|
25146
|
+
}
|
|
25147
|
+
const argRegex = /(\w+)\s*=\s*("([^"]*)"|'([^']*)'|([^,\s\)]+))/g;
|
|
25148
|
+
let argMatch;
|
|
25149
|
+
while ((argMatch = argRegex.exec(argsString)) !== null) {
|
|
25150
|
+
const key = argMatch[1];
|
|
25151
|
+
const value = argMatch[3] || argMatch[4] || argMatch[5];
|
|
25152
|
+
if (key === "data") continue;
|
|
25153
|
+
if (value === "true" || value === "True") {
|
|
25154
|
+
args[key] = true;
|
|
25155
|
+
} else if (value === "false" || value === "False") {
|
|
25156
|
+
args[key] = false;
|
|
25157
|
+
} else if (value === "null" || value === "None") {
|
|
25158
|
+
args[key] = null;
|
|
25159
|
+
} else if (!isNaN(Number(value)) && value !== "") {
|
|
25160
|
+
args[key] = Number(value);
|
|
25161
|
+
} else {
|
|
25162
|
+
args[key] = value;
|
|
25163
|
+
}
|
|
25164
|
+
}
|
|
25165
|
+
console.log("[DEBUG] Final parsed arguments:", args);
|
|
25166
|
+
return args;
|
|
25167
|
+
};
|
|
25168
|
+
const renderChart = (chartType, args, key) => {
|
|
25169
|
+
console.log(`[DEBUG] Attempting to render chart type: ${chartType}`, args);
|
|
25170
|
+
switch (chartType) {
|
|
25171
|
+
case "create_gauge_chart":
|
|
25172
|
+
console.log("[DEBUG] Rendering gauge chart");
|
|
25173
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-6 h-64 w-full flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
25174
|
+
GaugeChart,
|
|
25175
|
+
{
|
|
25176
|
+
value: args.value || 0,
|
|
25177
|
+
min: args.min_value || 0,
|
|
25178
|
+
max: args.max_value || 100,
|
|
25179
|
+
target: args.target,
|
|
25180
|
+
label: args.title || "",
|
|
25181
|
+
unit: args.unit || "",
|
|
25182
|
+
thresholds: args.thresholds,
|
|
25183
|
+
className: "w-full max-w-sm"
|
|
25184
|
+
}
|
|
25185
|
+
) }, `gauge-${key}`);
|
|
25186
|
+
case "create_bar_chart":
|
|
25187
|
+
console.log("[DEBUG] Rendering bar chart");
|
|
25188
|
+
if (!args.data || !args.x_field || !args.y_field) {
|
|
25189
|
+
console.error("Bar chart missing required parameters:", { data: !!args.data, x_field: !!args.x_field, y_field: !!args.y_field });
|
|
25190
|
+
return null;
|
|
25191
|
+
}
|
|
25192
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full", style: { maxWidth: args.max_width || "100%" }, children: [
|
|
25193
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25194
|
+
BarChart,
|
|
25195
|
+
{
|
|
25196
|
+
data: args.data,
|
|
25197
|
+
bars: [{
|
|
25198
|
+
dataKey: args.y_field,
|
|
25199
|
+
fill: args.color || "#3b82f6",
|
|
25200
|
+
labelList: args.show_values
|
|
25201
|
+
}],
|
|
25202
|
+
xAxisDataKey: args.x_field,
|
|
25203
|
+
className: "h-64",
|
|
25204
|
+
showLegend: false
|
|
25205
|
+
}
|
|
25206
|
+
),
|
|
25207
|
+
args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
|
|
25208
|
+
] }, `bar-${key}`);
|
|
25209
|
+
case "create_line_chart":
|
|
25210
|
+
console.log("[DEBUG] Rendering line chart");
|
|
25211
|
+
if (!args.data || !args.x_field || !args.y_field) {
|
|
25212
|
+
console.error("Line chart missing required parameters:", { data: !!args.data, x_field: !!args.x_field, y_field: !!args.y_field });
|
|
25213
|
+
return null;
|
|
25214
|
+
}
|
|
25215
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full", style: {
|
|
25216
|
+
height: args.height || 256,
|
|
25217
|
+
width: args.width || "100%"
|
|
25218
|
+
}, children: [
|
|
25219
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25220
|
+
LineChart,
|
|
25221
|
+
{
|
|
25222
|
+
data: args.data,
|
|
25223
|
+
lines: [{
|
|
25224
|
+
dataKey: args.y_field,
|
|
25225
|
+
stroke: "#3b82f6",
|
|
25226
|
+
strokeWidth: 2
|
|
25227
|
+
}],
|
|
25228
|
+
xAxisDataKey: args.x_field,
|
|
25229
|
+
className: "h-full",
|
|
25230
|
+
showLegend: false
|
|
25231
|
+
}
|
|
25232
|
+
),
|
|
25233
|
+
args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
|
|
25234
|
+
] }, `line-${key}`);
|
|
25235
|
+
case "create_pie_chart":
|
|
25236
|
+
console.log("[DEBUG] Rendering pie chart");
|
|
25237
|
+
if (!args.data || !args.label_field || !args.value_field) {
|
|
25238
|
+
console.error("Pie chart missing required parameters:", { data: !!args.data, label_field: !!args.label_field, value_field: !!args.value_field });
|
|
25239
|
+
console.error("Available args:", Object.keys(args));
|
|
25240
|
+
return null;
|
|
25241
|
+
}
|
|
25242
|
+
const pieData = args.data.map((item) => ({
|
|
25243
|
+
name: item[args.label_field],
|
|
25244
|
+
value: item[args.value_field]
|
|
25245
|
+
}));
|
|
25246
|
+
console.log("[DEBUG] Pie chart data transformed:", pieData);
|
|
25247
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full flex flex-col items-center", children: [
|
|
25248
|
+
args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-gray-700 mb-2", children: args.title }),
|
|
25249
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-64 w-full max-w-md", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
25250
|
+
PieChart4,
|
|
25251
|
+
{
|
|
25252
|
+
data: pieData,
|
|
25253
|
+
showPercentages: args.show_percentages || false
|
|
25254
|
+
}
|
|
25255
|
+
) })
|
|
25256
|
+
] }, `pie-${key}`);
|
|
25257
|
+
case "create_comparison_table":
|
|
25258
|
+
console.log("[DEBUG] Rendering comparison table");
|
|
25259
|
+
if (!args.data) {
|
|
25260
|
+
console.error("Comparison table missing required data");
|
|
25261
|
+
return null;
|
|
25262
|
+
}
|
|
25263
|
+
const columns = args.columns || Object.keys(args.data[0] || {});
|
|
25264
|
+
let sortedData = [...args.data];
|
|
25265
|
+
if (args.sort_by && columns.includes(args.sort_by)) {
|
|
25266
|
+
sortedData.sort((a, b) => {
|
|
25267
|
+
const aVal = a[args.sort_by];
|
|
25268
|
+
const bVal = b[args.sort_by];
|
|
25269
|
+
const comparison = aVal > bVal ? 1 : aVal < bVal ? -1 : 0;
|
|
25270
|
+
return args.sort_descending === false ? comparison : -comparison;
|
|
25271
|
+
});
|
|
25272
|
+
}
|
|
25273
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full overflow-x-auto", children: [
|
|
25274
|
+
args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-gray-700 mb-2", children: args.title }),
|
|
25275
|
+
/* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full divide-y divide-gray-200", children: [
|
|
25276
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-gray-50", children: /* @__PURE__ */ jsxRuntime.jsx("tr", { children: columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
25277
|
+
"th",
|
|
25278
|
+
{
|
|
25279
|
+
className: `px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider ${col === args.highlight_column ? "bg-blue-50" : ""}`,
|
|
25280
|
+
children: col
|
|
25281
|
+
},
|
|
25282
|
+
col
|
|
25283
|
+
)) }) }),
|
|
25284
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "bg-white divide-y divide-gray-200", children: sortedData.map((row, rowIdx) => /* @__PURE__ */ jsxRuntime.jsx("tr", { className: rowIdx % 2 === 0 ? "bg-white" : "bg-gray-50", children: columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
25285
|
+
"td",
|
|
25286
|
+
{
|
|
25287
|
+
className: `px-4 py-2 whitespace-nowrap text-sm ${col === args.highlight_column ? "font-medium text-blue-600 bg-blue-50" : "text-gray-900"}`,
|
|
25288
|
+
children: row[col]
|
|
25289
|
+
},
|
|
25290
|
+
col
|
|
25291
|
+
)) }, rowIdx)) })
|
|
25292
|
+
] })
|
|
25293
|
+
] }, `table-${key}`);
|
|
25294
|
+
case "create_multi_line_chart":
|
|
25295
|
+
console.log("[DEBUG] Rendering multi-line chart");
|
|
25296
|
+
if (!args.data || !args.x_field || !args.y_fields || !args.legend) {
|
|
25297
|
+
console.error("Multi-line chart missing required parameters:", {
|
|
25298
|
+
data: !!args.data,
|
|
25299
|
+
x_field: !!args.x_field,
|
|
25300
|
+
y_fields: !!args.y_fields,
|
|
25301
|
+
legend: !!args.legend
|
|
25302
|
+
});
|
|
25303
|
+
return null;
|
|
25304
|
+
}
|
|
25305
|
+
const colors = ["#3b82f6", "#ef4444", "#10b981", "#f59e0b", "#8b5cf6", "#06b6d4", "#84cc16", "#f97316"];
|
|
25306
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full", children: [
|
|
25307
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.LineChart, { data: args.data, children: [
|
|
25308
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { strokeDasharray: "3 3" }),
|
|
25309
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.XAxis, { dataKey: args.x_field }),
|
|
25310
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, {}),
|
|
25311
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, {}),
|
|
25312
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Legend, {}),
|
|
25313
|
+
args.y_fields.map((field, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
25314
|
+
recharts.Line,
|
|
25315
|
+
{
|
|
25316
|
+
type: "monotone",
|
|
25317
|
+
dataKey: field,
|
|
25318
|
+
stroke: colors[index % colors.length],
|
|
25319
|
+
strokeWidth: 2,
|
|
25320
|
+
name: args.legend[index] || field,
|
|
25321
|
+
dot: { r: 4 },
|
|
25322
|
+
activeDot: { r: 6 }
|
|
25323
|
+
},
|
|
25324
|
+
field
|
|
25325
|
+
))
|
|
25326
|
+
] }) }),
|
|
25327
|
+
args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
|
|
25328
|
+
] }, `multi-line-${key}`);
|
|
25329
|
+
case "create_stacked_bar_chart":
|
|
25330
|
+
console.log("[DEBUG] Rendering stacked bar chart");
|
|
25331
|
+
if (!args.data || !args.x_field || !args.stack_fields) {
|
|
25332
|
+
console.error("Stacked bar chart missing required parameters:", {
|
|
25333
|
+
data: !!args.data,
|
|
25334
|
+
x_field: !!args.x_field,
|
|
25335
|
+
stack_fields: !!args.stack_fields
|
|
25336
|
+
});
|
|
25337
|
+
return null;
|
|
25338
|
+
}
|
|
25339
|
+
const stackColors = ["#3b82f6", "#ef4444", "#10b981", "#f59e0b", "#8b5cf6", "#06b6d4", "#84cc16", "#f97316"];
|
|
25340
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full", children: [
|
|
25341
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.BarChart, { data: args.data, children: [
|
|
25342
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { strokeDasharray: "3 3" }),
|
|
25343
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.XAxis, { dataKey: args.x_field }),
|
|
25344
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, {}),
|
|
25345
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, {}),
|
|
25346
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Legend, {}),
|
|
25347
|
+
args.stack_fields.map((field, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
25348
|
+
recharts.Bar,
|
|
25349
|
+
{
|
|
25350
|
+
dataKey: field,
|
|
25351
|
+
stackId: "stack",
|
|
25352
|
+
fill: stackColors[index % stackColors.length],
|
|
25353
|
+
name: field
|
|
25354
|
+
},
|
|
25355
|
+
field
|
|
25356
|
+
))
|
|
25357
|
+
] }) }),
|
|
25358
|
+
args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
|
|
25359
|
+
] }, `stacked-bar-${key}`);
|
|
25360
|
+
case "create_dual_axis_chart":
|
|
25361
|
+
console.log("[DEBUG] Rendering dual-axis chart");
|
|
25362
|
+
if (!args.data || !args.x_field || !args.left_y_field || !args.right_y_field) {
|
|
25363
|
+
console.error("Dual-axis chart missing required parameters:", {
|
|
25364
|
+
data: !!args.data,
|
|
25365
|
+
x_field: !!args.x_field,
|
|
25366
|
+
left_y_field: !!args.left_y_field,
|
|
25367
|
+
right_y_field: !!args.right_y_field
|
|
25368
|
+
});
|
|
25369
|
+
return null;
|
|
25370
|
+
}
|
|
25371
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full", children: [
|
|
25372
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.ComposedChart, { data: args.data, children: [
|
|
25373
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { strokeDasharray: "3 3" }),
|
|
25374
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.XAxis, { dataKey: args.x_field }),
|
|
25375
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, { yAxisId: "left", orientation: "left", label: { value: args.left_label || "", angle: -90, position: "insideLeft" } }),
|
|
25376
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, { yAxisId: "right", orientation: "right", label: { value: args.right_label || "", angle: 90, position: "insideRight" } }),
|
|
25377
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, {}),
|
|
25378
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Legend, {}),
|
|
25379
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Bar, { yAxisId: "left", dataKey: args.left_y_field, fill: "#3b82f6", name: args.left_label || args.left_y_field }),
|
|
25380
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Line, { yAxisId: "right", type: "monotone", dataKey: args.right_y_field, stroke: "#ef4444", strokeWidth: 2, name: args.right_label || args.right_y_field })
|
|
25381
|
+
] }) }),
|
|
25382
|
+
args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
|
|
25383
|
+
] }, `dual-axis-${key}`);
|
|
25384
|
+
case "create_scatter_plot":
|
|
25385
|
+
console.log("[DEBUG] Rendering scatter plot");
|
|
25386
|
+
if (!args.data || !args.x_field || !args.y_field || !args.group_field) {
|
|
25387
|
+
console.error("Scatter plot missing required parameters:", {
|
|
25388
|
+
data: !!args.data,
|
|
25389
|
+
x_field: !!args.x_field,
|
|
25390
|
+
y_field: !!args.y_field,
|
|
25391
|
+
group_field: !!args.group_field
|
|
25392
|
+
});
|
|
25393
|
+
return null;
|
|
25394
|
+
}
|
|
25395
|
+
const groupedData = args.data.reduce((acc, item) => {
|
|
25396
|
+
const group = item[args.group_field];
|
|
25397
|
+
if (!acc[group]) {
|
|
25398
|
+
acc[group] = [];
|
|
25399
|
+
}
|
|
25400
|
+
acc[group].push(item);
|
|
25401
|
+
return acc;
|
|
25402
|
+
}, {});
|
|
25403
|
+
const scatterColors = ["#3b82f6", "#ef4444", "#10b981", "#f59e0b", "#8b5cf6", "#06b6d4", "#84cc16", "#f97316"];
|
|
25404
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full", children: [
|
|
25405
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.ScatterChart, { children: [
|
|
25406
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { strokeDasharray: "3 3" }),
|
|
25407
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.XAxis, { dataKey: args.x_field, type: "number", name: args.x_field }),
|
|
25408
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, { dataKey: args.y_field, type: "number", name: args.y_field }),
|
|
25409
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { cursor: { strokeDasharray: "3 3" } }),
|
|
25410
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Legend, {}),
|
|
25411
|
+
Object.entries(groupedData).map(([group, data], index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
25412
|
+
recharts.Scatter,
|
|
25413
|
+
{
|
|
25414
|
+
name: group,
|
|
25415
|
+
data,
|
|
25416
|
+
fill: scatterColors[index % scatterColors.length]
|
|
25417
|
+
},
|
|
25418
|
+
group
|
|
25419
|
+
))
|
|
25420
|
+
] }) }),
|
|
25421
|
+
args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
|
|
25422
|
+
] }, `scatter-${key}`);
|
|
25423
|
+
case "create_combo_chart":
|
|
25424
|
+
console.log("[DEBUG] Rendering combo chart");
|
|
25425
|
+
if (!args.data || !args.x_field || !args.bar_field || !args.line_field) {
|
|
25426
|
+
console.error("Combo chart missing required parameters:", {
|
|
25427
|
+
data: !!args.data,
|
|
25428
|
+
x_field: !!args.x_field,
|
|
25429
|
+
bar_field: !!args.bar_field,
|
|
25430
|
+
line_field: !!args.line_field
|
|
25431
|
+
});
|
|
25432
|
+
return null;
|
|
25433
|
+
}
|
|
25434
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full", children: [
|
|
25435
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.ComposedChart, { data: args.data, children: [
|
|
25436
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { strokeDasharray: "3 3" }),
|
|
25437
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.XAxis, { dataKey: args.x_field }),
|
|
25438
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, { yAxisId: "left", orientation: "left" }),
|
|
25439
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, { yAxisId: "right", orientation: "right" }),
|
|
25440
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, {}),
|
|
25441
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Legend, {}),
|
|
25442
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Bar, { yAxisId: "left", dataKey: args.bar_field, fill: "#3b82f6", name: args.bar_field }),
|
|
25443
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Line, { yAxisId: "right", type: "monotone", dataKey: args.line_field, stroke: "#ef4444", strokeWidth: 2, name: args.line_field })
|
|
25444
|
+
] }) }),
|
|
25445
|
+
args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
|
|
25446
|
+
] }, `combo-${key}`);
|
|
25447
|
+
case "create_area_chart":
|
|
25448
|
+
console.log("[DEBUG] Rendering area chart");
|
|
25449
|
+
if (!args.data || !args.x_field || !args.y_field) {
|
|
25450
|
+
console.error("Area chart missing required parameters:", {
|
|
25451
|
+
data: !!args.data,
|
|
25452
|
+
x_field: !!args.x_field,
|
|
25453
|
+
y_field: !!args.y_field
|
|
25454
|
+
});
|
|
25455
|
+
return null;
|
|
25456
|
+
}
|
|
25457
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full", children: [
|
|
25458
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.ComposedChart, { data: args.data, children: [
|
|
25459
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { strokeDasharray: "3 3" }),
|
|
25460
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.XAxis, { dataKey: args.x_field }),
|
|
25461
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, {}),
|
|
25462
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, {}),
|
|
25463
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.Legend, {}),
|
|
25464
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25465
|
+
recharts.Area,
|
|
25466
|
+
{
|
|
25467
|
+
type: "monotone",
|
|
25468
|
+
dataKey: args.y_field,
|
|
25469
|
+
stroke: "#3b82f6",
|
|
25470
|
+
fill: args.fill ? "#3b82f6" : "none",
|
|
25471
|
+
fillOpacity: args.fill ? 0.6 : 0,
|
|
25472
|
+
name: args.y_field
|
|
25473
|
+
}
|
|
25474
|
+
)
|
|
25475
|
+
] }) }),
|
|
25476
|
+
args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
|
|
25477
|
+
] }, `area-${key}`);
|
|
25478
|
+
default:
|
|
25479
|
+
console.warn(`Unknown chart type: ${chartType}`);
|
|
25480
|
+
return null;
|
|
25481
|
+
}
|
|
25482
|
+
};
|
|
25483
|
+
const chartContent = parseChartPatterns(content);
|
|
25484
|
+
if (chartContent) {
|
|
25485
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "formatted-content", children: chartContent });
|
|
25486
|
+
}
|
|
24777
25487
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
24778
25488
|
"div",
|
|
24779
25489
|
{
|
|
@@ -31029,6 +31739,7 @@ exports.DebugAuth = DebugAuth;
|
|
|
31029
31739
|
exports.DebugAuthView = DebugAuthView_default;
|
|
31030
31740
|
exports.EmptyStateMessage = EmptyStateMessage;
|
|
31031
31741
|
exports.FactoryView = FactoryView_default;
|
|
31742
|
+
exports.GaugeChart = GaugeChart;
|
|
31032
31743
|
exports.GridComponentsPlaceholder = GridComponentsPlaceholder;
|
|
31033
31744
|
exports.Header = Header;
|
|
31034
31745
|
exports.HelpView = HelpView_default;
|
|
@@ -31044,7 +31755,7 @@ exports.KPIsOverviewView = KPIsOverviewView_default;
|
|
|
31044
31755
|
exports.LINE_1_UUID = LINE_1_UUID;
|
|
31045
31756
|
exports.LargeOutputProgressChart = LargeOutputProgressChart;
|
|
31046
31757
|
exports.LeaderboardDetailView = LeaderboardDetailView_default;
|
|
31047
|
-
exports.Legend =
|
|
31758
|
+
exports.Legend = Legend6;
|
|
31048
31759
|
exports.LineChart = LineChart;
|
|
31049
31760
|
exports.LineHistoryCalendar = LineHistoryCalendar;
|
|
31050
31761
|
exports.LineMonthlyHistory = LineMonthlyHistory;
|
|
@@ -31064,6 +31775,7 @@ exports.NoWorkspaceData = NoWorkspaceData;
|
|
|
31064
31775
|
exports.OptifyeAgentClient = OptifyeAgentClient;
|
|
31065
31776
|
exports.OutputProgressChart = OutputProgressChart;
|
|
31066
31777
|
exports.PageHeader = PageHeader;
|
|
31778
|
+
exports.PieChart = PieChart4;
|
|
31067
31779
|
exports.ProfileView = ProfileView_default;
|
|
31068
31780
|
exports.RegistryProvider = RegistryProvider;
|
|
31069
31781
|
exports.S3Service = S3Service;
|
|
@@ -31098,6 +31810,7 @@ exports.WORKSPACE_POSITIONS = WORKSPACE_POSITIONS;
|
|
|
31098
31810
|
exports.WhatsAppShareButton = WhatsAppShareButton;
|
|
31099
31811
|
exports.WorkspaceCard = WorkspaceCard;
|
|
31100
31812
|
exports.WorkspaceDetailView = WorkspaceDetailView_default;
|
|
31813
|
+
exports.WorkspaceDisplayNameExample = WorkspaceDisplayNameExample;
|
|
31101
31814
|
exports.WorkspaceGrid = WorkspaceGrid;
|
|
31102
31815
|
exports.WorkspaceGridItem = WorkspaceGridItem;
|
|
31103
31816
|
exports.WorkspaceHistoryCalendar = WorkspaceHistoryCalendar;
|