Skip to content

Commit

Permalink
Merge branch 'v3' into waltti
Browse files Browse the repository at this point in the history
  • Loading branch information
vesameskanen committed Sep 11, 2024
2 parents 7a707f3 + 75b49f1 commit a29880e
Show file tree
Hide file tree
Showing 113 changed files with 1,799 additions and 752 deletions.
46 changes: 23 additions & 23 deletions .github/workflows/dev-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ jobs:
node-version: [20.x]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

# https://github.com/actions/cache/blob/8f1e2e02865c42348f9baddbbaafb1841dce610a/examples.md#node---yarn-2
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- name: Cache .yarn/cache
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: '.yarn/cache'
key: yarn-v3-cache-${{ github.ref_name }}
Expand All @@ -50,7 +50,7 @@ jobs:

- name: cache shared components
id: cache-shared-components
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: 'digitransit-*'
key: ${{ runner.os }}-shared-components-${{ hashFiles('digitransit-*') }}
Expand All @@ -66,26 +66,26 @@ jobs:
node-version: [20.x]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: "Set time zone to Europe/Helsinki"
uses: zcong1993/setup-timezone@master
with:
timezone: "Europe/Helsinki"
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

# https://github.com/actions/cache/blob/8f1e2e02865c42348f9baddbbaafb1841dce610a/examples.md#node---yarn-2
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- name: Cache .yarn/cache
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: '.yarn/cache'
key: yarn-v3-cache-${{ github.ref_name }}
Expand All @@ -96,7 +96,7 @@ jobs:

- name: cache shared components
id: cache-shared-components
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: 'digitransit-*'
key: ${{ runner.os }}-shared-components-${{ hashFiles('digitransit-*') }}
Expand All @@ -120,26 +120,26 @@ jobs:
node-version: [20.x]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: "Set time zone to Europe/Helsinki"
uses: zcong1993/setup-timezone@master
with:
timezone: "Europe/Helsinki"
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

# https://github.com/actions/cache/blob/8f1e2e02865c42348f9baddbbaafb1841dce610a/examples.md#node---yarn-2
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- name: Cache .yarn/cache
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: '.yarn/cache'
key: yarn-v3-cache-${{ github.ref_name }}
Expand All @@ -150,7 +150,7 @@ jobs:

- name: cache shared components
id: cache-shared-components
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: 'digitransit-*'
key: ${{ runner.os }}-shared-components-${{ hashFiles('digitransit-*') }}
Expand All @@ -160,7 +160,7 @@ jobs:

- name: cache built Relay queries
id: cache-relay
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
./__generated__
Expand All @@ -186,26 +186,26 @@ jobs:
node-version: [ 20.x ]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: "Set time zone to Europe/Helsinki"
uses: zcong1993/setup-timezone@master
with:
timezone: "Europe/Helsinki"
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

# https://github.com/actions/cache/blob/8f1e2e02865c42348f9baddbbaafb1841dce610a/examples.md#node---yarn-2
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- name: Cache .yarn/cache
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: '.yarn/cache'
key: yarn-v3-cache-${{ github.ref_name }}
Expand All @@ -216,7 +216,7 @@ jobs:

- name: cache shared components
id: cache-shared-components
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: 'digitransit-*'
key: ${{ runner.os }}-shared-components-${{ hashFiles('digitransit-*') }}
Expand All @@ -226,7 +226,7 @@ jobs:

- name: cache built Relay queries
id: cache-relay
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
./__generated__
Expand Down Expand Up @@ -280,7 +280,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set time zone to Europe/Helsinki
uses: zcong1993/setup-timezone@master
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prod-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Check Tag
id: check-tag
run: |
Expand Down
2 changes: 1 addition & 1 deletion app/component/AboutPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const AboutPage = ({ currentLanguage }, { config }) => {
/>
))}
{section.link && (
<a href={section.link}>
<a href={section.link} target="_blank" rel="noreferrer">
<FormattedMessage
id="journey-planner-manual"
defaultMessage="Journey planner manual"
Expand Down
2 changes: 1 addition & 1 deletion app/component/AppBarHsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const AppBarHsl = ({ lang, user, favourites }, context) => {
id="CookieConsent"
src="https://policy.app.cookieinformation.com/uc.js"
data-gcm-version="2.0"
data-culture="FI"
data-culture={lang.toUpperCase()}
type="text/javascript"
/>
</Helmet>
Expand Down
6 changes: 5 additions & 1 deletion app/component/EmbeddedSearchGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,11 @@ const EmbeddedSearchGenerator = (props, context) => {
</form>
{config.embeddedSearch?.cookieLink && (
<p>
<a href={config.embeddedSearch.cookieLink[lang].url}>
<a
href={config.embeddedSearch.cookieLink[lang].url}
target="_blank"
rel="noreferrer"
>
{config.embeddedSearch.cookieLink[lang].text}
</a>
</p>
Expand Down
4 changes: 2 additions & 2 deletions app/component/FavouriteVehicleRentalStationContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const FavouriteVehicleRentalStationContainer = connectToStores(
context.executeAction(saveFavourite, {
lat: vehicleRentalStation.lat,
lon: vehicleRentalStation.lon,
network: vehicleRentalStation.network,
network: vehicleRentalStation.rentalNetwork.networkId,
name: vehicleRentalStation.name,
stationId: vehicleRentalStation.stationId,
type: 'bikeStation',
Expand All @@ -35,7 +35,7 @@ const FavouriteVehicleRentalStationContainer = connectToStores(
.getStore('FavouriteStore')
.getByStationIdAndNetworks(
vehicleRentalStation.stationId,
vehicleRentalStation.network,
vehicleRentalStation.rentalNetwork.networkId,
);
context.executeAction(deleteFavourite, vehicleRentalStationToDelete);
addAnalyticsEvent({
Expand Down
5 changes: 4 additions & 1 deletion app/component/FavouritesContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,10 @@ class FavouritesContainer extends React.Component {
item => item.type === 'place',
);
if (
useCitybikes(this.context.config.cityBike?.networks, this.context.config)
useCitybikes(
this.context.config.vehicleRental?.networks,
this.context.config,
)
) {
targets.push('VehicleRentalStations');
}
Expand Down
29 changes: 28 additions & 1 deletion app/component/IndexPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import DTAutoSuggest from '@digitransit-component/digitransit-component-autosugg
import DTAutosuggestPanel from '@digitransit-component/digitransit-component-autosuggest-panel';
import { getModesWithAlerts } from '@digitransit-search-util/digitransit-search-util-query-utils';
import { createUrl } from '@digitransit-store/digitransit-store-future-route';
import inside from 'point-in-polygon';
import { configShape, locationShape } from '../util/shapes';
import storeOrigin from '../action/originActions';
import storeDestination from '../action/destinationActions';
Expand Down Expand Up @@ -36,6 +37,10 @@ import {
getNearYouModes,
useCitybikes,
} from '../util/modeUtils';
import {
checkPositioningPermission,
startLocationWatch,
} from '../action/PositionActions';

const StopRouteSearch = withSearchContext(DTAutoSuggest);
const LocationSearch = withSearchContext(DTAutosuggestPanel);
Expand Down Expand Up @@ -105,6 +110,16 @@ class IndexPage extends React.Component {
this.context.executeAction(storeDestination, destination);
}

if (this.context.config.startSearchFromUserLocation) {
checkPositioningPermission().then(permission => {
if (
permission.state === 'granted' &&
this.props.locationState.status === 'no-location'
) {
this.context.executeAction(startLocationWatch);
}
});
}
scrollTop();
}

Expand All @@ -128,6 +143,18 @@ class IndexPage extends React.Component {
const { router, match, config } = this.context;
const { location } = match;

const currentLocation =
config.startSearchFromUserLocation &&
!this.props.origin.address &&
this.props.locationState?.hasLocation &&
this.props.locationState;
if (currentLocation && !currentLocation.isReverseGeocodingInProgress) {
const originPoint = [currentLocation.lon, currentLocation.lat];
if (inside(originPoint, config.areaPolygon)) {
this.context.executeAction(storeOrigin, currentLocation);
}
}

if (definesItinerarySearch(origin, destination)) {
const newLocation = {
...location,
Expand Down Expand Up @@ -280,7 +307,7 @@ class IndexPage extends React.Component {
'Stops',
];

if (useCitybikes(config.cityBike?.networks, config)) {
if (useCitybikes(config.vehicleRental?.networks, config)) {
stopAndRouteSearchTargets.push('VehicleRentalStations');
locationSearchTargets.push('VehicleRentalStations');
}
Expand Down
48 changes: 26 additions & 22 deletions app/component/MainMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import intializeSearchContext from '../util/DTSearchContextInitializer';
function MainMenu(props, { config, intl, executeAction }) {
const [countries, setCountries] = useState(props.countries);
const appBarLinkHref =
config.appBarLink.alternativeHref?.[props.currentLanguage] ||
config.appBarLink.href;
config.appBarLink?.alternativeHref?.[props.currentLanguage] ||
config.appBarLink?.href;
return (
<div className="main-menu no-select" tabIndex={-1}>
<div className="main-menu-top-section">
Expand Down Expand Up @@ -67,7 +67,11 @@ function MainMenu(props, { config, intl, executeAction }) {
)}
{config.mainMenu.stopMonitor.show && (
<div className="offcanvas-section">
<a href={config.mainMenu.stopMonitor.url}>
<a
href={config.mainMenu.stopMonitor.url}
target="_blank"
rel="noreferrer"
>
<FormattedMessage id="create-stop-monitor" />
</a>
</div>
Expand Down Expand Up @@ -117,25 +121,25 @@ function MainMenu(props, { config, intl, executeAction }) {
</div>
</div>
))}
{config.appBarLink?.name &&
appBarLinkHref &&
!config.hideAppBarLink && (
<div className="offcanvas-section">
<a
id="appBarLink"
href={appBarLinkHref}
onClick={() => {
addAnalyticsEvent({
category: 'Navigation',
action: 'appBarLink',
name: null,
});
}}
>
{config.appBarLink.name}
</a>
</div>
)}
{config.appBarLink?.name && appBarLinkHref && (
<div className="offcanvas-section">
<a
id="appBarLink"
href={appBarLinkHref}
target="_blank"
onClick={() => {
addAnalyticsEvent({
category: 'Navigation',
action: 'appBarLink',
name: null,
});
}}
rel="noreferrer"
>
{config.appBarLink.name}
</a>
</div>
)}
</section>
<section className="menu-section secondary-links">
<MainMenuLinks
Expand Down
Loading

0 comments on commit a29880e

Please sign in to comment.