+
Reasons to be counted
@@ -264,3 +278,78 @@ export default async function ConstituencyPage({
>
);
}
+
+function TacticalAdvice({
+ constituencyData,
+}: {
+ constituencyData: ConstituencyData;
+}) {
+ const getTopProgressives = (
+ results: PartyVoteResult[],
+ ): [PartySlug, PartySlug] => {
+ const progResults = results
+ .filter((result) => progressiveSlugs.includes(result.partySlug))
+ .sort((a, b) => b.votePercent - a.votePercent);
+
+ return [progResults[0].partySlug, progResults[1].partySlug];
+ };
+
+ const toryWinUnlikely =
+ constituencyData.otherVoteData.conservativeWinUnlikely;
+ //TODO add in a column for safe opposition seat definition
+ const clearAdvice = !!constituencyData.recommendation.partySlug;
+ const recommendation = constituencyData.recommendation.partySlug;
+ const [topProgressive, secondProgressive] = getTopProgressives(
+ constituencyData.pollingResults.partyVoteResults,
+ );
+
+ if (toryWinUnlikely) {
+ if (clearAdvice) {
+ return (
+ <>
+
Vote with your heart
+ Join up and together we can pressure them
+ >
+ );
+ } else {
+ return (
+ <>
+
+ Vote{" "}
+
+ {shortPartyNameFromSlug(topProgressive)}
+ {" "}
+ or{" "}
+
+ {shortPartyNameFromSlug(secondProgressive)}
+ {" "}
+
+
+ BUT THAT'S NOT ENOUGH, JOIN UP
+ >
+ );
+ }
+ } else {
+ //Tories CAN win
+ if (clearAdvice) {
+ return (
+ <>
+ Your tactical vote
+
+ {partyNameFromSlug(recommendation)}
+
+ But that's not enough, join up
+ >
+ );
+ } else {
+ return (
+ <>
+ {" "}
+ Your tactical vote
+ Too soon to call
+ Join up to be notified
+ >
+ );
+ }
+ }
+}
diff --git a/app/globals.scss b/app/globals.scss
index 84d86de..20a30dd 100644
--- a/app/globals.scss
+++ b/app/globals.scss
@@ -679,15 +679,11 @@ section h3.party {
font-size: 7vmax;
font-weight: 800;
text-transform: uppercase;
- overflow: auto;
}
@include media-breakpoint-up(lg) {
section h3.party {
font-size: 4vmax;
- font-weight: 800;
- text-transform: uppercase;
- overflow: auto;
}
}
@@ -708,7 +704,8 @@ div.party-heart {
/*border: solid 1px var(--bs-gray-300);*/
}
-a span.party-none h3.party-none,
+span.party-none,
+h3.party-none,
svg.party-none,
i.party-none {
color: var(--bs-gray-500);
diff --git a/utils/Party.ts b/utils/Party.ts
index e6945dc..e9fa53d 100644
--- a/utils/Party.ts
+++ b/utils/Party.ts
@@ -91,7 +91,10 @@ const partyCssClassFromSlug = (slug: PartySlug) => {
}
};
+const progressiveSlugs: PartySlug[] = ["Lab", "LD", "Green", "SNP", "PC"];
+
export {
+ progressiveSlugs,
partyColorFromSlug,
partyNameFromSlug,
shortPartyNameFromSlug,