From 738d575bc7858d986eacb628d5b9e2b04cc43c80 Mon Sep 17 00:00:00 2001 From: Max Adulyanukosol Date: Mon, 25 Mar 2019 02:56:28 +0700 Subject: [PATCH] Edit party list description in ElectionMapTooltip ref #214 --- src/components/ElectionMapTooltip.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/ElectionMapTooltip.js b/src/components/ElectionMapTooltip.js index 06d8d75..cd7c903 100644 --- a/src/components/ElectionMapTooltip.js +++ b/src/components/ElectionMapTooltip.js @@ -12,6 +12,7 @@ import loadingSmall from "../styles/images/loading.gif" import ZoneMark from "./ZoneMark" import PercentBarChart from "./PercentBarChart" import { useSummaryData } from "../models/LiveDataSubscription" +import { nationwidePartyStatsFromSummaryJSON } from "../models/PartyStats" import _ from "lodash" const partyLookup = keyBy(parties, d => d.id) @@ -56,6 +57,7 @@ export default function ElectionMapTooltip({ positionId, positions }) { let percentage = 0 let noVotesWin = false let noProgress = true + let partyStat if (zone && completed) { const { zoneWinningCandidateMap = {}, zoneStatsMap = {} } = data || {} const { no, provinceId } = zone @@ -75,6 +77,8 @@ export default function ElectionMapTooltip({ positionId, positions }) { } } } else if (seat) { + const partyStats = nationwidePartyStatsFromSummaryJSON(data) + partyStat = _.find(partyStats, { party: { id: party.id } }) markColor = party ? party.color : "#ccc" } @@ -109,8 +113,8 @@ export default function ElectionMapTooltip({ positionId, positions }) {
ส.ส. บัญชีรายชื่อ
-
อันดับที่ {seat.no}
{party ? `พรรค${party.name}` : null}
+
{partyStat.partyListSeats} ที่นั่ง
)}