diff --git a/app/constituencies/[slug]/page.tsx b/app/constituencies/[slug]/page.tsx index 0b6ee0f..de7077e 100644 --- a/app/constituencies/[slug]/page.tsx +++ b/app/constituencies/[slug]/page.tsx @@ -5,6 +5,7 @@ import ImpliedChart from "@/components/info_box/ImpliedChart"; import MRPChart from "@/components/info_box/MRPChart"; import PlanToVoteBox from "@/components/info_box/PlanToVoteBox"; import TacticalReasoningBox from "@/components/info_box/TacticalReasoningBox"; +import ToryCantWinReasoningBox from "@/components/info_box/ToryCantWinReasoningBox"; import { partyCssClassFromSlug, partyNameFromSlug } from "@/utils/Party"; import { getConstituenciesData, @@ -215,7 +216,13 @@ export default async function ConstituencyPage({ - + {constituencyData.otherVoteData.conservativeWinUnlikely ? ( + + ) : ( + + )} Read more about our process diff --git a/components/info_box/ToryCantWinReasoningBox.tsx b/components/info_box/ToryCantWinReasoningBox.tsx index aa902fc..7f96bd2 100644 --- a/components/info_box/ToryCantWinReasoningBox.tsx +++ b/components/info_box/ToryCantWinReasoningBox.tsx @@ -1,11 +1,12 @@ import { partyCssClassFromSlug, partyNameFromSlug } from "@/utils/Party"; - +import { votePercent } from "@/utils/constituencyData"; +import Link from "next/link"; import { FaUser, FaChartSimple, FaChartLine, - FaBullseye, - FaTriangleExclamation, + FaEnvelope, + FaBan, } from "react-icons/fa6"; const ToryCantWinReasoningBox = ({ @@ -13,66 +14,100 @@ const ToryCantWinReasoningBox = ({ }: { constituencyData: ConstituencyData; }) => { - const recommendedParty = constituencyData.recommendation.partySlug; - const recommendedPartyName = partyNameFromSlug(recommendedParty); - - const previousWinner = constituencyData.impliedPreviousResult.winningParty; const previousBiggestProgressive = constituencyData.impliedPreviousResult.biggestProgressiveParty; - const pollingWinner = constituencyData.pollingResults.winningParty; const pollingBiggestProgressive = constituencyData.pollingResults.biggestProgressiveParty; - const recommendedPartyTargetSeat = - constituencyData.otherVoteData.targetSeatData.some( - (target) => - target.partySlug == recommendedParty && target.likelyTarget == "YES", - ); + const pollingGap = + votePercent(constituencyData.pollingResults, pollingBiggestProgressive) - + votePercent(constituencyData.pollingResults, "Con"); - const closeSeat = !constituencyData.otherVoteData.conservativeWinUnlikely; + const previousGap = + votePercent( + constituencyData.impliedPreviousResult, + previousBiggestProgressive, + ) - votePercent(constituencyData.impliedPreviousResult, "Con"); return (
<> - {/* Always show previous general election winner */}

- - {partyNameFromSlug(previousWinner)} won in 2019 + + + + + A Tory is unlikely to win here this time +

+

+ + Polls give Tories only{" "} + + {votePercent(constituencyData.pollingResults, "Con")}% + {" "} + here

- {/* Show previous biggest progressive if it matches our recommendation AND they weren't the winner */} - {recommendedParty == previousBiggestProgressive && - recommendedParty != previousWinner && ( -

- - {recommendedPartyName} were closest in 2019 -

- )} +

+ + They were {previousGap}% behind{" "} + {partyNameFromSlug(previousBiggestProgressive)} in + 2019 +

{/* Show polling biggest progressive if it matches our recommendation */} - {recommendedParty == pollingBiggestProgressive && ( -

- + + They are {pollingGap}% behind{" "} + {partyNameFromSlug(pollingBiggestProgressive)} in + polls +

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

+ + - Polls favour {recommendedPartyName} here -

- )} - - {/* If this is a target seat for our recommended party, show this */} - {recommendedPartyTargetSeat && ( -

- - Likely a {recommendedPartyName} target seat -

- )} + Make your vote count + +

- {/* TODO motivational text based on whats required to get tories out Check if this is a close seat {closeSeat && (