Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rail disruption time #734

Merged
merged 10 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ package = "@sentry/netlify-build-plugin"

# Set env variables for deploy preview on netlify
[context.deploy-preview.environment]
REACT_APP_API_HOST='https://wmca-api-portal-staging.azure-api.net'
REACT_APP_API_KEY='0d4cca4a2c5d40c3bfbbfe45d1bbf294'
REACT_APP_API_HOST='https://api.wmnetwork.co.uk'
REACT_APP_API_KEY='514b8bafa009424289cb2d7a12c54f6e'
REACT_APP_BUS_AUTOCOMPLETE_API='https://rtccdisruptions6zqwajo6s.azurewebsites.net'
REACT_APP_ROADS_AUTOCOMPLETE_KEY='e0c1216f818a41be8d528ac1d4f7ebfd'
REACT_APP_FEEDBACK_LINK_URL='https://forms.office.com/Pages/ResponsePage.aspx'
Expand Down
31 changes: 31 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
"esri-loader": "^3.6.0",
"fecha": "^4.2.3",
"haversine-distance": "^1.2.1",
"moment": "^2.29.4",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-app-polyfill": "^3.0.0",
"react-datepicker": "^4.8.0",
"react-debounce-input": "^3.3.0",
"react-dom": "^18.2.0",
"react-easy-swipe": "0.0.22",
"react-moment": "^1.1.3",
"react-scripts": "5.0.1",
"react-share": "^4.4.1",
"sass": "^1.32.8"
Expand Down
15 changes: 12 additions & 3 deletions src/components/shared/DisruptionInfo/DisruptionInfo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import dompurify from 'dompurify';
// Import Moment
import Moment from 'react-moment';
// Import contexts
import { AutoCompleteContext, FetchDisruptionsContext, ModeContext } from 'globalState';
// Import Helper functions
Expand Down Expand Up @@ -49,7 +51,7 @@ function DisruptionInfo({ disruption }) {

const createDateString = (rawDate) => {
const date = new Date(rawDate);
return `${date.toLocaleDateString(undefined, dateOptions)}`;
return `${date.toLocaleDateString('en-GB', dateOptions)}`;
};

// Promoter organisation
Expand Down Expand Up @@ -107,8 +109,15 @@ function DisruptionInfo({ disruption }) {
<p>
<strong>When?</strong>
<br />
{createDateString(disruption.disruptionTimeWindow.start)} to{' '}
{createDateString(disruption.disruptionTimeWindow.end)}
{/* Temporary fix for textual errors of rail disruption timings during British Summer Time */}
<Moment locale="en-GB" format="dddd, Do MMMM YYYY HH:mm" add={{ hours: 1 }}>
{disruption.disruptionTimeWindow.start}
</Moment>
{' to '}

<Moment locale="en-GB" format="dddd, Do MMMM YYYY HH:mm" add={{ hours: 1 }}>
{disruption.disruptionTimeWindow.end}
</Moment>
</p>
<div
className="wmnds-m-b-lg wmnds-col-1"
Expand Down
2 changes: 1 addition & 1 deletion src/components/shared/Message/Message.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import Icon from 'components/shared/Icon/Icon';
import dompurify from 'dompurify';
import Icon from 'components/shared/Icon/Icon';

const { sanitize } = dompurify;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import Icon from 'components/shared/Icon/Icon';
import PropTypes from 'prop-types';
import Icon from 'components/shared/Icon/Icon';

import s from './CloseButton.module.scss';

Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ if (process.env.NODE_ENV === 'production') {
Sentry.init({ dsn: 'https://[email protected]/5272889' });
}

ReactDOM.render(
const root = ReactDOM.createRoot(document.getElementById('disruptionsApp'));
root.render(
<Sentry.ErrorBoundary>
<App />
</Sentry.ErrorBoundary>,
document.getElementById('disruptionsApp'),
);

// If you want your app to work offline and load faster, you can change
Expand Down