diff --git a/package.json b/package.json index 5786ec2..a0ef427 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@code4ro/reusable-components", - "version": "0.1.27", + "version": "0.1.28", "description": "Component library for code4ro", "keywords": [ "code4ro", diff --git a/src/components/ElectionResultsSummarySection/ElectionResultsSummarySection.tsx b/src/components/ElectionResultsSummarySection/ElectionResultsSummarySection.tsx index 4acfc38..b288fd8 100644 --- a/src/components/ElectionResultsSummarySection/ElectionResultsSummarySection.tsx +++ b/src/components/ElectionResultsSummarySection/ElectionResultsSummarySection.tsx @@ -42,6 +42,18 @@ export const ElectionResultsSummarySection = themable( const completeness = electionScopeIsComplete(scope); const topCandidate = results?.candidates && results.candidates[0]; + const votes = topCandidate?.votes; + let percentage = formatPercentage(fractionOf(votes || 0, results?.validVotes || 0)); + if ( + meta && + meta.type === "referendum" && + topCandidate && + topCandidate.name === "NU AU VOTAT" && + results && + results.eligibleVoters + ) { + percentage = formatPercentage(fractionOf(topCandidate.votes, results.eligibleVoters)); + } const map = width != null && ( ( > {topCandidate && (
-
- {formatPercentage(fractionOf(topCandidate.votes, results?.validVotes || 0))} -
+
{percentage}
{topCandidate.shortName || topCandidate.name}
)}