Skip to content

Commit

Permalink
Edit party list description in ElectionMapTooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
na399 committed Mar 24, 2019
1 parent e630f8e commit 738d575
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/ElectionMapTooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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"
}

Expand Down Expand Up @@ -109,8 +113,8 @@ export default function ElectionMapTooltip({ positionId, positions }) {
<div style={LARGE_FONT}>
<b>ส.ส. บัญชีรายชื่อ</b>
</div>
<div>อันดับที่ {seat.no}</div>
<div>{party ? `พรรค${party.name}` : null}</div>
<div>{partyStat.partyListSeats} ที่นั่ง</div>
</div>
)}
</td>
Expand Down

0 comments on commit 738d575

Please sign in to comment.