mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 11:55:22 +02:00
fix: show dashboard when didResults exist even if verdict is missing
This commit is contained in:
@@ -474,7 +474,7 @@ const ExperimentDetailView: React.FC<{
|
||||
);
|
||||
}
|
||||
|
||||
if (experiment.verdict && primaryResult && didResults) {
|
||||
if (experiment.verdict || didResults) {
|
||||
const prob = Math.round((experiment.verdict_probability || 0) * 100);
|
||||
const radius = 60;
|
||||
const circumference = 2 * Math.PI * radius;
|
||||
@@ -542,19 +542,31 @@ const ExperimentDetailView: React.FC<{
|
||||
</thead>
|
||||
<tbody className="divide-y divide-white/5">
|
||||
{/* Render specific metrics: Units, Revenue, CVR, BSR/ACOS (if available in didResults) */}
|
||||
{['units', 'revenue', 'cvr', 'acos'].map(metric => {
|
||||
const res = didResults.metrics[metric];
|
||||
{['units', 'revenue', 'cvr', 'acos', 'sessions', 'roas', 'ctr'].map(metric => {
|
||||
const res = didResults?.metrics?.[metric];
|
||||
if (!res) return null;
|
||||
const isPositiveGood = !['acos', 'bsr'].includes(metric);
|
||||
const isGood = isPositiveGood ? res.lift_percent >= 0 : res.lift_percent <= 0;
|
||||
return (
|
||||
<tr key={metric} className="hover:bg-white/[0.02] transition-colors">
|
||||
<td className="py-4 text-[15px] font-bold text-slate-200">{METRIC_LABELS[metric] || metric}</td>
|
||||
<td className="py-4 text-[15px] text-[#64748b] font-medium">{formatMetricValue(res.control_after, metric)}</td>
|
||||
<td className="py-4 text-[15px] text-white font-bold">{formatMetricValue(res.treatment_after, metric)}</td>
|
||||
<td className="py-4 text-[13px] font-bold text-slate-200">
|
||||
{METRIC_LABELS[metric] || metric}
|
||||
{metric === experiment.primary_metric && (
|
||||
<span className="ml-2 bg-indigo-500/20 text-indigo-400 border border-indigo-500/20 text-[9px] font-bold uppercase tracking-wider px-1.5 py-0.5 rounded">PRIMARY</span>
|
||||
)}
|
||||
</td>
|
||||
<td className="py-4 text-[14px] text-[#64748b] font-medium">{formatMetricValue(res.treatment_before, metric)}</td>
|
||||
<td className="py-4 text-[14px] text-white font-bold">{formatMetricValue(res.treatment_after, metric)}</td>
|
||||
<td className={`py-4 text-sm font-bold flex items-center gap-1 ${isGood ? 'text-emerald-400' : 'text-[#f43f5e]'}`}>
|
||||
<div className="flex flex-col">
|
||||
<span className="flex items-center gap-1">
|
||||
<svg className={`w-3.5 h-3.5 ${isGood ? (res.lift_percent >= 0 ? '' : 'rotate-180') : 'rotate-180'}`} fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={3}><path strokeLinecap="round" strokeLinejoin="round" d="M5 15l7-7 7 7" /></svg>
|
||||
{res.lift_percent >= 0 ? '+' : ''}{res.lift_percent.toFixed(1)}%
|
||||
</span>
|
||||
<span className="text-[10px] text-[#64748b] font-medium mt-0.5 ml-1">
|
||||
DiD: {res.did_estimate >= 0 ? '+' : ''}{formatMetricValue(res.did_estimate, metric)}
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user