Skip to content

Commit

Permalink
Merge pull request #248 from City-of-Turku/develop
Browse files Browse the repository at this point in the history
Release v1.7.6
  • Loading branch information
juhomakkonen authored Jun 4, 2024
2 parents 47b4d41 + df4f42f commit 72efb35
Show file tree
Hide file tree
Showing 265 changed files with 5,052 additions and 3,750 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ REITTIOPAS_URL="https://reittiopas.foli.fi/reitti/"
THEME_PKG=1
MOBILITY_PLATFORM_API="https://palvelukartta-api.turku.fi"
RAILWAYS_API="https://rata.digitraffic.fi/api/v1"
ROADWORKS_API="https://tie.digitraffic.fi/api/traffic-message/v1/messages"
ROADWORKS_API="https://palvelukartta-api.turku.fi/exceptional_situations/api/v1"
AIR_MONITORING_API="https://palvelukartta-api.turku.fi/environment_data/api/v1"
MOBILITY_TEST_API="https://liikkumistesti-api.turku.fi/api/v1/postalcoderesult"

# API URLs to fetch parking spaces data
PARKING_SPACES_URL="https://parkkiopas.turku.fi/public/v1/parking_area/"
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
# The branches below must be a subset of the branches above
branches: [ develop ]
schedule:
- cron: '29 10 * * 6'
- cron: '39 16 * * 1'

jobs:
analyze:
Expand All @@ -38,11 +38,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -53,7 +53,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -67,4 +67,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v3
1 change: 1 addition & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,4 +285,5 @@ export default {
"airMonitoringAPI": settings.AIR_MONITORING_API,
"roadworksAPI": settings.ROADWORKS_API,
"railwaysAPI": settings.RAILWAYS_API,
"mobilityTestAPI": settings.MOBILITY_TEST_API,
}
13 changes: 13 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"@datapunt/matomo-tracker-js": "^0.5.1",
"@emotion/css": "^11.11.2",
"@emotion/react": "^11.10.8",
"@emotion/styled": "^11.10.8",
"@formatjs/intl-pluralrules": "^1.5.9",
Expand Down
1 change: 1 addition & 0 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ const htmlTemplate = (req, reactDom, preloadedState, css, cssString, emotionCss,
window.nodeEnvSettings.ROADWORKS_API = "${process.env.ROADWORKS_API}";
window.nodeEnvSettings.RAILWAYS_API = "${process.env.RAILWAYS_API}";
window.nodeEnvSettings.AIR_MONITORING_API = "${process.env.AIR_MONITORING_API}";
window.nodeEnvSettings.MOBILITY_TEST_API = "${process.env.MOBILITY_TEST_API}";
window.nodeEnvSettings.FEATURE_SERVICEMAP_PAGE_TRACKING = "${process.env.FEATURE_SERVICEMAP_PAGE_TRACKING}";
window.appVersion = {};
Expand Down
19 changes: 12 additions & 7 deletions src/components/AddressSearchBar/AddressSearchBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import useMobileStatus from '../../utils/isMobile';
import ServiceMapAPI from '../../utils/newFetch/ServiceMapAPI';
import useLocaleText from '../../utils/useLocaleText';
import { getAddressText } from '../../utils/address';
import { getCitySettings } from '../../redux/selectors/settings';
import { focusToPosition } from '../../views/MapView/utils/mapActions';
import config from '../../../config';

const AddressSearchBar = ({ title, intl, handleAddressChange }) => {
const getLocaleText = useLocaleText();
Expand All @@ -24,6 +26,7 @@ const AddressSearchBar = ({ title, intl, handleAddressChange }) => {
const map = useSelector(state => state.mapRef);
const customPosition = useSelector(state => state.user.customPosition);
const position = useSelector(state => state.user.position);
const citySettings = useSelector(getCitySettings);

const defaultAddress = position.addressData || customPosition.addressData;

Expand All @@ -36,12 +39,14 @@ const AddressSearchBar = ({ title, intl, handleAddressChange }) => {
const suggestionCount = 5;
const inputRef = useRef();

const fetchAddressResults = async (text) => {
const fetchAddressResults = async text => {
const smAPI = new ServiceMapAPI();
const municipalities = citySettings?.length ? citySettings?.join(',') : config.cities;
const fetchOptions = {
page_size: suggestionCount,
type: 'address',
address_limit: suggestionCount,
municipality: municipalities,
language: locale,
};
setIsFetching(true);
Expand All @@ -50,7 +55,7 @@ const AddressSearchBar = ({ title, intl, handleAddressChange }) => {
return results;
};

const handleAddressSelect = (address) => {
const handleAddressSelect = address => {
if (!addressResults.length) return;
if (inputRef.current) {
inputRef.current.focus();
Expand All @@ -64,7 +69,7 @@ const AddressSearchBar = ({ title, intl, handleAddressChange }) => {
focusToPosition(map, address.location?.coordinates);
};

const handleSearchBarKeyPress = (e) => {
const handleSearchBarKeyPress = e => {
if (e.key === 'ArrowDown') {
e.preventDefault();
if (resultIndex === null || resultIndex === addressResults.length - 1) {
Expand All @@ -82,14 +87,14 @@ const AddressSearchBar = ({ title, intl, handleAddressChange }) => {
}
};

const clearSuggestions = (e) => {
const clearSuggestions = e => {
e.preventDefault();
setTimeout(() => {
setAddressResults([]);
}, 200);
};

const handleSubmit = (e) => {
const handleSubmit = e => {
if (resultIndex !== null) {
handleAddressSelect(addressResults[resultIndex]);
} else {
Expand All @@ -98,7 +103,7 @@ const AddressSearchBar = ({ title, intl, handleAddressChange }) => {
clearSuggestions(e);
};

const handleInputChange = (text) => {
const handleInputChange = text => {
// Reset cleared text
if (cleared) {
setCleared(false);
Expand All @@ -108,7 +113,7 @@ const AddressSearchBar = ({ title, intl, handleAddressChange }) => {
if (currentLocation) {
setCurrentLocation(null);
}
fetchAddressResults(text).then((data) => {
fetchAddressResults(text).then(data => {
if (!isFetching) setAddressResults(data);
});
} else if (addressResults.length) setAddressResults([]);
Expand Down
32 changes: 21 additions & 11 deletions src/components/EcoCounter/CounterMarkers/CounterMarkers.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { PropTypes } from 'prop-types';
import React from 'react';
import { useSelector } from 'react-redux';
import styled from '@emotion/styled';
import ecoCounterIcon from 'servicemap-ui-turku/assets/icons/icons-icon_ecocounter.svg';
import ecoCounterIconBw from 'servicemap-ui-turku/assets/icons/contrast/icons-icon_ecocounter-bw.svg';
import { useAccessibleMap } from '../../../redux/selectors/settings';
import { createIcon } from '../../MobilityPlatform/utils/utils';

const CounterMarkers = ({
classes, counterStation, children,
}) => {
const CounterMarkers = ({ counterStation, children }) => {
const useContrast = useSelector(useAccessibleMap);

const { Marker, Popup } = global.rL;
Expand All @@ -18,22 +17,33 @@ const CounterMarkers = ({

return (
<Marker icon={customIcon} position={[counterStation.lat, counterStation.lon]}>
<div className={classes.popupWrapper}>
<StyledWrapper>
<Popup className="ecocounter-popup">
<div className={classes.popupInner}>
<StyledContentInner>
{children}
</div>
</StyledContentInner>
</Popup>
</div>
</StyledWrapper>
</Marker>
);
};

const StyledWrapper = styled.div(({ theme }) => ({
position: 'absolute',
textAlign: 'center',
marginBottom: theme.spacing(2),
width: '429px',
}));

const StyledContentInner = styled.div(({ theme }) => ({
borderRadius: '3px',
marginBottom: theme.spacing(1),
marginLeft: theme.spacing(1.2),
lineHeight: 1.2,
overflowX: 'hidden',
}));

CounterMarkers.propTypes = {
classes: PropTypes.shape({
popupWrapper: PropTypes.string,
popupInner: PropTypes.string,
}).isRequired,
counterStation: PropTypes.shape({
lat: PropTypes.number,
lon: PropTypes.number,
Expand Down
4 changes: 1 addition & 3 deletions src/components/EcoCounter/CounterMarkers/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { withStyles } from '@mui/styles';
import CounterMarkers from './CounterMarkers';
import styles from './styles';

export default withStyles(styles)(CounterMarkers);
export default CounterMarkers;
17 changes: 0 additions & 17 deletions src/components/EcoCounter/CounterMarkers/styles.js

This file was deleted.

14 changes: 0 additions & 14 deletions src/components/EcoCounter/InputDate/styles.js

This file was deleted.

Loading

0 comments on commit 72efb35

Please sign in to comment.