+ {/* Left Panel: Available Insights */}
+
+
+ {loading ? (
+
+
+ Loading...
+
+ ) : availableInsights.length === 0 ? (
+
+
+
No insights available for this study.
+
Run some trials first.
+
+ ) : (
+
+ {availableInsights.map((insight) => {
+ const Icon = getIcon(insight.type);
+ const colorClass = getColorClass(insight.type);
+ const isGenerating = generating === insight.type;
+
+ return (
+
+
+
+
+
+
+
{insight.name}
+
{insight.description}
+
+
+
+
+ );
+ })}
+
+ )}
+
+
+ {/* Previously Generated */}
+ {generatedFiles.length > 0 && (
+
+
+ {generatedFiles.map((file) => {
+ const Icon = getIcon(file.insight_type);
+
+ return (
+
+
+
+
{file.insight_type}
+
{file.size_kb} KB
+
+
+
+
+
+
+ );
+ })}
+
+
+ )}
+
+
+ {/* Right Panel: Visualization */}
+
+ {activeInsight ? (
+
+ {activeInsight.insight_type.replace('_', ' ').toUpperCase()}
+
+
+
+
+
+ }
+ className="h-full"
+ >
+ {/* Summary Stats */}
+ {activeInsight.summary && Object.keys(activeInsight.summary).length > 0 && (
+
+ {Object.entries(activeInsight.summary).slice(0, 8).map(([key, value]) => (
+
+
{key.replace(/_/g, ' ')}
+
+ {typeof value === 'number'
+ ? value.toExponential ? value.toExponential(3) : value
+ : String(value)
+ }
+
+
+ ))}
+
+ )}
+
+ {/* Plotly Figure */}
+ {activeInsight.plotly_figure ? (
+
+ ) : (
+
+
No visualization data available
+
+ )}
+
+ ) : (
+
+
+
+
No Insight Selected
+
+ Select an insight type from the left panel to generate a visualization.
+
+
+
+ )}
+