Skip to content

Commit

Permalink
Merge pull request #815 from stadtnavi/mobidatabw
Browse files Browse the repository at this point in the history
Add mobidata-bw extensions
  • Loading branch information
hbruch authored Nov 4, 2024
2 parents d2a9e34 + c268891 commit ab6dc58
Show file tree
Hide file tree
Showing 820 changed files with 29,689 additions and 10,052 deletions.
1 change: 1 addition & 0 deletions .github/workflows/dev-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ jobs:
run: yarn lint
- name: lint SVG sprites using xmllint
run: |
sudo apt-get update
sudo apt install -y libxml2-utils
xmllint --nonet --noout static/assets/svg-sprite.*.svg
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/lint-test-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ jobs:
run: yarn lint
- name: lint SVG sprites using xmllint
run: |
sudo apt-get update
sudo apt install -y libxml2-utils
xmllint --nonet --noout static/assets/svg-sprite.*.svg
Expand Down Expand Up @@ -244,18 +245,18 @@ jobs:
# branch's one. This is why, on the default branch (`next`), we *do* build & cache the Docker layers
# but don't push and don't deploy the resulting image.
# todo: as of 2023-04-27, this fails because of https://github.com/moby/buildkit/issues/2887
if: github.ref_name == 'next' || (github.ref_type == 'tag' && startsWith(github.ref_name, 'release_'))
if: github.ref_name == 'mobidatabw' || github.ref_name == 'next' || (github.ref_type == 'tag' && startsWith(github.ref_name, 'release_'))
needs:
- lint
- unit-test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set time zone to Europe/Helsinki
- name: Set time zone to Europe/Berlin
uses: zcong1993/setup-timezone@master
with:
timezone: "Europe/Helsinki"
timezone: "Europe/Berlin"

- name: Create buildInfo.js file
run: |
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ENV \
# install dependencies for npm packages
RUN \
# required for sharp, which builds libvips using node-gyp
apk add --no-cache python3 make g++ vips-dev
apk add --no-cache python3 make g++ vips-dev bash

COPY .yarnrc.yml package.json yarn.lock lerna.json ./
COPY .yarn ./.yarn
Expand Down
3 changes: 3 additions & 0 deletions app/action/SelectFeatureActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function selectFeature(actionContext, feature) {
actionContext.dispatch('SetSelectedFeature', feature);
}
2 changes: 2 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import FavouriteStore from './store/FavouriteStore';
import RoutingSettingsStore from './store/RoutingSettingsStore';
import FutureRouteStore from './store/FutureRouteStore';
import MapModeStore from './store/MapModeStore';
import SelectedFeatureStore from './store/SelectedFeatureStore';

export default config => {
const app = new Fluxible({
Expand All @@ -41,6 +42,7 @@ export default config => {
app.registerStore(RoutingSettingsStore);
app.registerStore(FutureRouteStore);
app.registerStore(MapModeStore);
app.registerStore(SelectedFeatureStore);

app.plug({
name: 'extra-context-plugin',
Expand Down
3 changes: 0 additions & 3 deletions app/component/AppBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ const AppBar = (
logo={logo}
title={title}
/>
{!!config.appBarTitle && (
<span className="logo community">{config.appBarTitle}</span>
)}
</button>
</section>
<section className="controls">
Expand Down
23 changes: 10 additions & 13 deletions app/component/BicycleLeg.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { PREFIX_STOPS } from '../util/path';
import {
getCityBikeNetworkConfig,
getCityBikeNetworkId,
CityBikeNetworkType,
} from '../util/citybikes';
import { isKeyboardSelectionEvent } from '../util/browser';
import ItineraryCircleLineWithIcon from './ItineraryCircleLineWithIcon';
Expand Down Expand Up @@ -59,29 +58,27 @@ function BicycleLeg(
config,
);
const isFirstLeg = i => i === 0;
const isScooter =
networkConfig && networkConfig.type === CityBikeNetworkType.Scooter;
// TODO should better be deduced from leg, as network may rent different formFactors
const rentalFormFactor =
networkConfig?.type && networkConfig?.type !== 'citybike'
? networkConfig?.type
: 'bicycle';
let rentalUri;

if (leg.mode === 'WALK' || leg.mode === 'BICYCLE_WALK') {
modeClassName = leg.mode.toLowerCase();
stopsDescription = (
<FormattedMessage
id={
isScooter
? 'scooterwalk-distance-duration'
: 'cyclewalk-distance-duration'
}
id={`${rentalFormFactor}walk-distance-duration`}
values={{ distance, duration }}
defaultMessage="Walk your bike {distance} ({duration})"
defaultMessage="Walk your vehicle {distance} ({duration})"
/>
);
} else {
stopsDescription = (
<FormattedMessage
id={isScooter ? 'scooter-distance-duration' : 'cycle-distance-duration'}
id={`${rentalFormFactor}-distance-duration`}
values={{ distance, duration }}
defaultMessage="Cycle {distance} ({duration})"
defaultMessage="Continue {distance} ({duration})"
/>
);
}
Expand All @@ -90,7 +87,7 @@ function BicycleLeg(
modeClassName = 'citybike';
legDescription = (
<FormattedMessage
id={isScooter ? 'rent-scooter-at' : 'rent-citybike-at'}
id={`rent-${rentalFormFactor}-at`}
defaultMessage="Fetch a bike"
/>
);
Expand Down
23 changes: 14 additions & 9 deletions app/component/CarLeg.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,20 @@ function CarLeg(props, { config, intl, router, match, executeAction }) {
</button>
</div>
)}
<div className="itinerary-leg-action" aria-hidden="true">
<button
type="button"
className="standalone-btn cursor-pointer carpool-offer-btn"
onClick={props.toggleCarpoolDrawer}
>
<FormattedMessage id="offer-ride" defaultMessage="Offer carpool" />
</button>
</div>
{config.showCarpoolOfferButton === true && (
<div className="itinerary-leg-action" aria-hidden="true">
<button
type="button"
className="standalone-btn cursor-pointer carpool-offer-btn"
onClick={props.toggleCarpoolDrawer}
>
<FormattedMessage
id="offer-ride"
defaultMessage="Offer carpool"
/>
</button>
</div>
)}
{leg.to.vehicleParkingWithEntrance?.vehicleParking.tags.includes(
'state:few',
) && (
Expand Down
1 change: 1 addition & 0 deletions app/component/CityBikeLeg.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function CityBikeLeg(
getCityBikeNetworkId(bikeRentalStation.networks),
config,
);
// TODO formFactor should be deduced from leg
const formFactor = networkConfig.type || 'citybike';

// eslint-disable-next-line no-nested-ternary
Expand Down
2 changes: 1 addition & 1 deletion app/component/CityBikeStopContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const CityBikeStopContent = ({ bikeRentalStation }, { config }) => {
fewAvailableCount={fewAvailableCount}
fewerAvailableCount={fewerAvailableCount}
useSpacesAvailable={citybikeCapacity === BIKEAVL_WITHMAX}
formFactor={networkConfig.type || 'citybike'}
formFactor={networkConfig.type || 'bicycle'}
/>
</div>
);
Expand Down
33 changes: 10 additions & 23 deletions app/component/CustomizeSearchNew.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import PropTypes from 'prop-types';
import React from 'react';
import { FormattedMessage, intlShape } from 'react-intl';
import { intlShape } from 'react-intl';
import connectToStores from 'fluxible-addons-react/connectToStores';

import Icon from './Icon';
import FareZoneSelector from './customizesearch/FareZoneSelector';
import SharingSettingsPanel from './customizesearch/SharingSettingsPanel.stadtnavi';
import StreetModeSelectorPanel from './customizesearch/StreetModeSelectorPanel';
import TransportModesSection from './customizesearch/TransportModesSection';
import WalkingOptionsSection from './customizesearch/WalkingOptionsSection';
import AccessibilityOptionSection from './customizesearch/AccessibilityOptionSection';
import TransferOptionsSection from './customizesearch/TransferOptionsSection';
import CityBikeNetworkSelector from './customizesearch/CityBikeNetworkSelector';
import { showModeSettings, useCitybikes } from '../util/modeUtils';
import ScrollableWrapper from './ScrollableWrapper';
import { getDefaultSettings } from '../util/planParamUtil';
import { getCitybikeNetworks } from '../util/citybikes';

class CustomizeSearch extends React.Component {
static contextTypes = {
Expand Down Expand Up @@ -112,27 +111,15 @@ class CustomizeSearch extends React.Component {
/>
</div>
</div>
{
// TODO: extract the whole section into new, customizable component
}

{useCitybikes(config?.cityBike?.networks) && (
<div className="settings-section">
<div className="settings-option-container">
<fieldset>
<legend className="settings-header transport-mode-subheader">
<FormattedMessage
id="citybike-network-header"
defaultMessage={intl.formatMessage({
id: 'citybike-network-headers',
defaultMessage: 'Citybikes and scooters',
})}
/>
</legend>
<div className="transport-modes-container">
<CityBikeNetworkSelector
currentOptions={getCitybikeNetworks(config)}
/>
</div>
</fieldset>
</div>
</div>
<SharingSettingsPanel
currentSettings={currentSettings}
defaultSettings={this.defaultSettings}
/>
)}
<div className="settings-section">
<div className="settings-option-container">
Expand Down
64 changes: 46 additions & 18 deletions app/component/EmbeddedSearch/EmbeddedSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const translations = {
de: {
'own-position': 'Ihre aktuelle Position',
'find-bike-route': 'Eine Radroute finden',
'find-car-route': 'Eine PKW-Route finden',
'find-carpool-route': 'Mitfahrgelegenheit finden',
'find-walk-route': 'Einen Fußweg finden',
'find-route': 'Verbindungssuche',
'search-fields-sr-instructions': '',
Expand All @@ -33,6 +35,8 @@ const translations = {
fi: {
'own-position': 'Nykyinen sijaintisi',
'find-bike-route': 'Löydä pyöräreitti',
'find-car-route': 'Löydä autoreitti',
'find-carpool-route': 'Löydä kyyti',
'find-walk-route': 'Löydä kävelyreitti',
'find-route': 'Löydä reitti',
'search-fields-sr-instructions': '',
Expand All @@ -41,14 +45,28 @@ const translations = {
en: {
'own-position': 'Your current location',
'find-bike-route': 'Find a biking route',
'find-car-route': 'Find a driving route',
'find-capool-route': 'Find a carpooling offer',
'find-walk-route': 'Find a walking route',
'find-route': 'Find a route',
'search-fields-sr-instructions': '',
'search-route': 'Search routes',
},
nl: {
'own-position': 'Actuele locatie',
'find-bike-route': 'Zoek een fietsroute',
'find-car-route': 'Zoek een rijroute',
'find-capool-route': 'Zoek een carpoolaanbieding',
'find-walk-route': 'Zoek een looproute',
'find-route': 'Zoek een route',
'search-fields-sr-instructions': '',
'search-route': 'Routes zoeken',
},
sv: {
'own-position': 'Min position',
'find-bike-route': 'Sök en cyckelrutt',
'find-car-route': 'Sök en bilrutt',
'find-carpool-route': 'Sök en resa',
'find-walk-route': 'Sök en promenadsrutt',
'find-route': 'Sök en rutt',
'search-fields-sr-instructions': '',
Expand Down Expand Up @@ -76,6 +94,8 @@ const EmbeddedSearch = (props, context) => {
const { config } = context;
const { colors, fontWeights } = config;
const bikeOnly = query?.bikeOnly;
const carOnly = query?.carOnly;
const carpoolOnly = query?.carpoolOnly;
const walkOnly = query?.walkOnly;
const lang = query.lang || 'fi';
const url =
Expand Down Expand Up @@ -169,6 +189,10 @@ const EmbeddedSearch = (props, context) => {
titleText = i18next.t('find-bike-route');
} else if (walkOnly) {
titleText = i18next.t('find-walk-route');
} else if (carOnly) {
titleText = i18next.t('find-car-route');
} else if (carpoolOnly) {
titleText = i18next.t('find-carpool-route');
} else {
titleText = i18next.t('find-route');
}
Expand Down Expand Up @@ -231,7 +255,15 @@ const EmbeddedSearch = (props, context) => {
isEmbedded: true,
};

const mode = bikeOnly ? 'bike' : walkOnly ? 'walk' : 'all';
const mode = bikeOnly
? 'bike'
: walkOnly
? 'walk'
: carOnly
? 'car'
: carpoolOnly
? 'carpool'
: 'all';

const utmCampaignParams = useUTMCampaignParams({
mode,
Expand All @@ -240,7 +272,15 @@ const EmbeddedSearch = (props, context) => {
});

const executeSearch = () => {
const urlEnd = bikeOnly ? '/bike' : walkOnly ? '/walk' : '';
const urlEnd = bikeOnly
? '/bike'
: walkOnly
? '/walk'
: carOnly
? '/car'
: carpoolOnly
? '/carpool'
: '';

const targetUrl = buildURL([
lang,
Expand All @@ -249,7 +289,6 @@ const EmbeddedSearch = (props, context) => {
]);

targetUrl.search += buildQueryString(utmCampaignParams);

addAnalyticsEvent({
category: 'EmbeddedSearch',
action: 'executeSearch',
Expand All @@ -263,20 +302,11 @@ const EmbeddedSearch = (props, context) => {

// eslint-disable-next-line consistent-return
const drawBackgroundIcon = () => {
if (bikeOnly) {
return (
<Icon
img="icon-embedded-search-bike-background"
className="background bike"
color={config.colors.primary}
/>
);
}
if (walkOnly) {
if (mode !== 'all') {
return (
<Icon
img="icon-embedded-search-walk-background"
className="background walk"
img={`icon-embedded-search-${mode}-background`}
className={`background ${mode}`}
color={config.colors.primary}
/>
);
Expand Down Expand Up @@ -304,9 +334,7 @@ const EmbeddedSearch = (props, context) => {

return (
<div
className={`embedded-seach-container ${
bikeOnly ? 'bike' : walkOnly ? 'walk' : ''
}`}
className={`embedded-seach-container ${mode === 'all' ? '' : mode}`}
id={appElement}
>
<div className="background-container">{drawBackgroundIcon()}</div>
Expand Down
Loading

0 comments on commit ab6dc58

Please sign in to comment.