From 1cc512783f39189ffb3f2c7594a12be4b8bea4e6 Mon Sep 17 00:00:00 2001
From: Sym Roe
Date: Thu, 18 Apr 2024 16:17:03 +0100
Subject: [PATCH 1/2] Add accesibility links for supported councils
---
src/AddressPicker.js | 5 ++++-
src/ElectionInformationWidget.js | 12 +++++++++++-
src/PollingStation.js | 17 +++++++++++++++++
3 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/src/AddressPicker.js b/src/AddressPicker.js
index c1f1844a..5edf7663 100644
--- a/src/AddressPicker.js
+++ b/src/AddressPicker.js
@@ -13,11 +13,14 @@ class AddressPicker extends React.Component {
setAddress(event) {
this.setState({ address: event.target.value });
+ if (event.target.selectedOptions.length > 0) {
+ this.props.setUPRN(event.target.selectedOptions[0].dataset.uprn);
+ }
}
addressOption(address, index) {
return (
-
+
{address.address}
);
diff --git a/src/ElectionInformationWidget.js b/src/ElectionInformationWidget.js
index f9bf6b63..810042b9 100644
--- a/src/ElectionInformationWidget.js
+++ b/src/ElectionInformationWidget.js
@@ -36,6 +36,7 @@ function ElectionInformationWidget(props) {
const [notifications, setNotifications] = useState(undefined);
const [addressList, setAddressList] = useState(undefined);
const [postcode, setPostcode] = useState(undefined);
+ const [uprn, setUPRN] = useState(undefined);
const [dates, setDates] = useState(undefined);
const [electoralServices, setElectoralServices] = useState(undefined);
const dataSource = process.env.REACT_APP_API;
@@ -156,6 +157,7 @@ function ElectionInformationWidget(props) {
)}
@@ -167,7 +169,15 @@ function ElectionInformationWidget(props) {
notifications={notifications}
/>
)}
- {station && }
+ {station && (
+
+ )}
{stationNotFound && (
)}
diff --git a/src/PollingStation.js b/src/PollingStation.js
index 5771dfe2..6e429aad 100644
--- a/src/PollingStation.js
+++ b/src/PollingStation.js
@@ -6,6 +6,17 @@ import { Directions } from './Directions';
function PollingStation(props) {
let splitAddress = [];
+ var wdiv_link;
+ if (props.uprn) {
+ wdiv_link = `https://wheredoivote.co.uk/address/${props.uprn}/`;
+ } else {
+ wdiv_link = `https://wheredoivote.co.uk/postcode/${props.postcode}/`;
+ }
+ var show_i18n_link = false;
+ const i18n_councils = ['CGN', 'CMN', 'COV', 'CRF', 'NTL', 'NWP', 'STY', 'VGL', 'WAE'];
+ if (i18n_councils.indexOf(props.electoralServices.council_id) > -1) {
+ show_i18n_link = true;
+ }
props.station.address.split(',').forEach(function (line, index) {
splitAddress.push(line.trim());
@@ -25,6 +36,12 @@ function PollingStation(props) {
description="Polling stations are open from 7am to 10pm on polling day."
/>
+ {show_i18n_link && (
+
+ For detailed information on accessibility, see WhereDoIVote.co.uk
+
+ )}
+
{props.station.coordinates && (
Date: Sun, 21 Apr 2024 10:50:40 +0100
Subject: [PATCH 2/2] Change mock council ID
This is a quick way to test the accessibility links without having to
mock the councils who have the link enabled
---
public/example-responses/postcode-AA12AA.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/example-responses/postcode-AA12AA.json b/public/example-responses/postcode-AA12AA.json
index 6cf231ec..a99e98c5 100644
--- a/public/example-responses/postcode-AA12AA.json
+++ b/public/example-responses/postcode-AA12AA.json
@@ -136,7 +136,7 @@
}
],
"electoral_services": {
- "council_id": "E09000033",
+ "council_id": "WAE",
"name": "City of Westminster",
"email": "electoralservices@westminster.gov.uk",
"phone": "020 7641 2730",