Skip to content

Commit 91c4d99

Browse files
authored
Deployment 1.1.6
Deployment 1.1.6 (duplicated commits by accident - shouldnt affect any code or git blames)
2 parents 6a6208e + 0d666e0 commit 91c4d99

File tree

7 files changed

+18
-44
lines changed

7 files changed

+18
-44
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hsl-map-publisher",
3-
"version": "1.1.5",
3+
"version": "1.1.6",
44
"description": "HSL Map Publisher",
55
"main": "index.js",
66
"scripts": {

src/components/inlineSVG.js

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,7 @@
1-
import React from 'react';
1+
import React, { useRef, useEffect } from 'react';
22
import PropTypes from 'prop-types';
33

4-
const getIframeStyle = (src, fitToSize) => {
5-
let style = { border: 'none', height: '100%', width: '100%' };
6-
7-
if (!fitToSize) return style;
8-
9-
const parser = new DOMParser();
10-
const doc = parser.parseFromString(src, 'image/svg+xml');
11-
const svg = doc.querySelector('svg');
12-
13-
if (!svg) return style;
14-
15-
const width = svg.getAttribute('width') || (svg.viewBox?.baseVal?.width ?? null);
16-
const height = svg.getAttribute('height') || (svg.viewBox?.baseVal?.height ?? null);
17-
18-
if (!width || !height) return style;
19-
20-
style = { ...style, width: `${width}px`, height: `${height}px` };
21-
return style;
22-
};
23-
24-
const InlineSVG = ({ src, fitToSize = false, ...otherProps }) => {
25-
const iframeStyle = getIframeStyle(src, fitToSize);
4+
const InlineSVG = ({ src, ...otherProps }) => {
265
return (
276
<div
287
// eslint-disable-next-line react/no-danger
@@ -34,11 +13,6 @@ const InlineSVG = ({ src, fitToSize = false, ...otherProps }) => {
3413

3514
InlineSVG.propTypes = {
3615
src: PropTypes.string.isRequired,
37-
fitToSize: PropTypes.bool,
38-
};
39-
40-
InlineSVG.defaultProps = {
41-
fitToSize: false,
4216
};
4317

4418
export default InlineSVG;

src/components/lineTimetable/lineTimetable.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ RouteDepartures.propTypes = {
236236

237237
const checkForTrainRoutes = routes => {
238238
return routes.map(route => {
239-
if (route.mode === 'RAIL') {
239+
const { mode } = route;
240+
if (mode === 'RAIL' || mode === 'SUBWAY') {
240241
return { ...route, routeIdParsed: shortenTrainParsedLineId(route.routeIdParsed) };
241242
}
242243
return route;

src/components/lineTimetable/lineTimetableContainer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ const hoc = compose(
294294
// Fetch all variants
295295
const lineId = String(props.lineId || '')
296296
.trim()
297-
.replace(/^(\d+)[A-Za-z]+$/, '$1');
297+
.replace(/^([\dM]+)[A-Za-z]+$/, '$1');
298298

299299
return {
300300
variables: {

src/components/map/stopMap.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ const LocationSymbol = props => (
5151

5252
const getSalesPointIcon = type => (
5353
<InlineSVG
54-
fitToSize
5554
src={type.toLowerCase() === 'myyntipiste' ? ticketSalesPointIcon : ticketMachineIcon}
5655
/>
5756
);

src/components/stopPoster/adContainer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class AdContainer extends Component {
6666
this.root = ref;
6767
}}>
6868
{ads.slice(0, this.state.spaces).map((src, i) => (
69-
<InlineSVG key={i} style={iconStyle} src={src} fitToSize />
69+
<InlineSVG key={i} style={iconStyle} src={src} />
7070
))}
7171
</div>
7272
);

src/components/stopPoster/stopPoster.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,7 @@ class StopPoster extends Component {
238238
}
239239

240240
if (this.state.hasColumnTimetable) {
241-
this.setState({
242-
hasColumnTimetable: false,
243-
});
244-
return;
245-
}
246-
247-
if (this.state.hasRoutes) {
248-
this.setState({ hasRoutes: false });
241+
this.setState({ hasColumnTimetable: false });
249242
return;
250243
}
251244

@@ -276,6 +269,11 @@ class StopPoster extends Component {
276269
return;
277270
}
278271

272+
if (this.state.hasRoutes) {
273+
this.setState({ hasRoutes: false });
274+
return;
275+
}
276+
279277
this.onError('Failed to remove layout overflow');
280278
return;
281279
}
@@ -285,9 +283,11 @@ class StopPoster extends Component {
285283
return;
286284
}
287285

288-
if (this.state.template && this.state.removedAds.length > 0) {
289-
const { template } = this.state;
290-
const svg = get(template, 'areas', []).find(t => t.key === 'map').slots[0];
286+
const { template } = this.state;
287+
const mapTemplateArea = get(template, 'areas', []).find(t => t.key === 'map');
288+
289+
if (template && this.state.removedAds.length > 0 && mapTemplateArea) {
290+
const svg = mapTemplateArea.slots[0];
291291
// If using svg postpone adsPhase untill we have mapHeight.
292292
if (!svg.image) {
293293
this.setState({ adsPhase: true });

0 commit comments

Comments
 (0)