Skip to content

Commit

Permalink
round vote & polling figures, add contact candidate line
Browse files Browse the repository at this point in the history
  • Loading branch information
jms301 committed Mar 29, 2024
1 parent 166b905 commit 203dd1c
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions components/info_box/ToryCantWinReasoningBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
FaUser,
FaChartSimple,
FaChartLine,
FaEnvelope,
FaTriangleExclamation,
FaBan,
} from "react-icons/fa6";

Expand All @@ -20,15 +20,17 @@ const ToryCantWinReasoningBox = ({
const pollingBiggestProgressive =
constituencyData.pollingResults.biggestProgressiveParty;

const pollingGap =
const pollingGap = (
votePercent(constituencyData.pollingResults, pollingBiggestProgressive) -
votePercent(constituencyData.pollingResults, "Con");
votePercent(constituencyData.pollingResults, "Con")
).toFixed(1);

const previousGap =
const previousGap = (
votePercent(
constituencyData.impliedPreviousResult,
previousBiggestProgressive,
) - votePercent(constituencyData.impliedPreviousResult, "Con");
) - votePercent(constituencyData.impliedPreviousResult, "Con")
).toFixed(1);

return (
<div className="rounded-box info-area">
Expand Down Expand Up @@ -72,7 +74,7 @@ const ToryCantWinReasoningBox = ({
<FaChartLine className={`me-2 ${partyCssClassFromSlug("Con")}`} />
Polls give <strong>Tories</strong> only{" "}
<strong>
{votePercent(constituencyData.pollingResults, "Con")}%
{votePercent(constituencyData.pollingResults, "Con").toFixed(1)}%
</strong>{" "}
here
</p>
Expand All @@ -91,10 +93,17 @@ const ToryCantWinReasoningBox = ({
{/* Show polling biggest progressive if it matches our recommendation */}
<p>
<FaChartLine className={`me-2 ${partyCssClassFromSlug("Con")}`} />
They are <strong>{pollingGap}%</strong> behind{" "}
They&apos;re now <strong>{pollingGap}%</strong> behind{" "}
<strong>{partyNameFromSlug(pollingBiggestProgressive)}</strong> in
polls
</p>
<p>
<FaTriangleExclamation
className="me-2"
style={{ color: "var(--bs-red)" }}
/>
Don&apos;t be ignored <strong>contact your candidate</strong>
</p>

{/*
TODO Link to some non-voting action to get what they want
Expand Down

0 comments on commit 203dd1c

Please sign in to comment.