Skip to content

Commit cffbc32

Browse files
committed
fix(lifecycle): use index-based mapping for incident data and show validation count
1 parent 56a32b1 commit cffbc32

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

Frontend/src/components/IncidentLifecycle.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ const IncidentLifecycle = () => {
8383
</div>
8484
<div className={`mt-2 text-xs font-semibold ${isComplete ? 'text-foreground' : 'text-secondary'}`}>
8585
{stage.label}
86+
{stage.key === 'validated' && lastIncident && lastIncident.validations > 0 && (
87+
<span className="ml-1 text-primary">({lastIncident.validations})</span>
88+
)}
8689
</div>
8790
{isCurrent && (
8891
<div className="mt-1 px-2 py-0.5 bg-primary/20 text-primary rounded-full text-[10px] font-bold">

Frontend/src/context/ChainWardDataProvider.tsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -243,22 +243,26 @@ export const ChainWardDataProvider = ({ children }: { children: ReactNode }) =>
243243
);
244244
batchResults.forEach(inc => {
245245
if (inc && Number(inc.id) > 0) {
246+
const validations = inc.validations !== undefined ? Number(inc.validations) : Number(inc[8] || 0);
247+
const disputes = inc.disputes !== undefined ? Number(inc.disputes) : Number(inc[9] || 0);
248+
246249
allIncidents.push({
247-
id: inc.id.toString(),
248-
incidentType: inc.incidentType,
249-
timestamp: Number(inc.timestamp),
250-
reporter: inc.reporter,
251-
severity: Number(inc.severity),
252-
description: inc.description,
253-
resolved: inc.resolved,
254-
resolvedAt: Number(inc.resolvedAt),
255-
validations: Number(inc.validations),
256-
disputes: Number(inc.disputes),
257-
slashed: inc.slashed,
250+
id: inc.id?.toString() || inc[0]?.toString(),
251+
incidentType: inc.incidentType || inc[1],
252+
timestamp: Number(inc.timestamp || inc[2]),
253+
reporter: inc.reporter || inc[3],
254+
severity: Number(inc.severity ?? inc[4]),
255+
description: inc.description || inc[5],
256+
resolved: inc.resolved ?? inc[6],
257+
resolvedAt: Number(inc.resolvedAt || inc[7]),
258+
validations: validations,
259+
disputes: disputes,
260+
slashed: inc.slashed ?? inc[10],
258261
});
259262
}
260263
});
261264
}
265+
console.log(`📡 Fetched ${allIncidents.length} incidents. Latest validations: ${allIncidents[0]?.validations}`);
262266
setIncidents(allIncidents.sort((a, b) => Number(b.id) - Number(a.id)));
263267
} else {
264268
setIncidents([]);

0 commit comments

Comments
 (0)