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

DT-6182 rental scooters #5016

Merged
merged 97 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
f191eb9
Merge remote-tracking branch 'origin/DT-6175-4' into DT-6182
sharhio Jan 31, 2024
8885d24
Merge branch 'v3' into DT-6182
sharhio Feb 12, 2024
61251fb
Merge branch 'v3' into DT-6182
sharhio Feb 13, 2024
9c8d127
Merge branch 'v3' into DT-6182
sharhio Feb 22, 2024
67333c6
Merge branch 'v3' into DT-6182
sharhio Feb 22, 2024
14b6a5c
Merge branch 'v3' into DT-6182
sharhio Feb 28, 2024
0d932e8
feat: dt-6182 initial scooters
sharhio Feb 28, 2024
c993bec
feat: DT-6182 refactoring merged
sharhio Feb 29, 2024
15dc48c
feat: dt-6182 merge refatoring
sharhio Feb 29, 2024
cf827c0
merge v3
sharhio Mar 25, 2024
c668df0
DT-6182 scooter features
sharhio Apr 18, 2024
7f45f30
DT-6182 test, style and translations fixes
sharhio Apr 18, 2024
45b38f0
DT-6182 merge, bug fix on itinerary, style fixes
sharhio Apr 22, 2024
d565973
DT-6182 merge v3, fix issues
sharhio Apr 29, 2024
31914a4
fix test result after adding a mode
sharhio Apr 29, 2024
2e5c720
fix test
sharhio Apr 29, 2024
ac69cea
DT-6182 merge v3
sharhio Apr 29, 2024
01c9ebe
DT-6182 fix scooter duration & scooter leave message
sharhio Apr 29, 2024
9d637d7
DT-6182 scooter return removed from walkleg, always shows
sharhio Apr 29, 2024
26886ec
DT-6182 scooter cluster details view, show only bikestations
sharhio May 2, 2024
bdc2124
DT-6182 scooter lighter grey color scheme
sharhio May 6, 2024
713e895
DT-6182 search nearest by network, scooters are never default
sharhio May 7, 2024
ab32817
DT-6182 remove scooters from unnecessary maplayers
sharhio May 7, 2024
dca5359
merge v3
sharhio May 24, 2024
7d579db
DT-6182 show only configured stations or vehicles on map + fixes
sharhio May 27, 2024
1f12e46
DT-6182 schema update rentalvehicle systemurl
sharhio May 27, 2024
9ebb1f7
Merge branch 'v3' into DT-6182
sharhio Jun 5, 2024
b7e22cf
DT-6182 filter out invisible stations
sharhio Jun 10, 2024
2d9d005
DT-6182 ui clustering
sharhio Jun 11, 2024
914af2f
DT-6182 do not add invisible rental stations to map data
sharhio Jun 11, 2024
6effb33
DT-6182 sorting & settings fixed
sharhio Jun 12, 2024
0dd3714
DT-6182 cluster row selection, renaming
sharhio Jun 12, 2024
cba1851
DT-6182 vehicle rental row tests
sharhio Jun 12, 2024
0a0097b
DT-6182 renaming
sharhio Jun 12, 2024
da33efb
DT-6182 renaming, translations fix
sharhio Jun 12, 2024
b2db6fb
DT-6182 clarification
sharhio Jun 12, 2024
2ddff7b
DT-6182 style fix in relaxed scooter result
sharhio Jun 12, 2024
c3351a0
DT-6182 rentalvehicle link validation
sharhio Jun 12, 2024
7d1233e
DT-6182 removed test config
sharhio Jun 12, 2024
e671c23
DT-6182 scooter logo color fixed
sharhio Jun 12, 2024
719f66d
Merge branch 'v3' into DT-6182
sharhio Jun 12, 2024
186fd82
schema fix
sharhio Jun 12, 2024
0d3ce30
DT-6182 clustering dependency
sharhio Jun 13, 2024
dccc91f
DT-6182 scooter configs
sharhio Jun 13, 2024
089db6d
merge v3
sharhio Jun 13, 2024
1ebdcb7
DT-6182 scooters off in layeroptions, default icon fix, taxi text rem…
sharhio Jun 14, 2024
0d741c8
old test config removed
sharhio Jun 14, 2024
cc6d345
local test maplayer config removed
sharhio Jun 14, 2024
e4af2a9
Merge branch 'v3' into DT-6182
sharhio Jun 14, 2024
b96e3ab
fix error in merge
sharhio Jun 14, 2024
09965df
DT-6182 use vehicleRentalSystemType for system url
sharhio Jun 17, 2024
cf0d769
DT-6182 filterByNetwork naming
sharhio Jun 17, 2024
1c0eb85
filterByNetwork description
sharhio Jun 17, 2024
13ba69e
DT-6182 schema fix
sharhio Jun 18, 2024
5cd420a
DT-6182 missing icon added
sharhio Jun 18, 2024
f37243e
DT-6182 linter warning fixes
sharhio Jun 18, 2024
827c0dd
DT-6182 transportmode shape fix
sharhio Jun 18, 2024
c082452
DT-6182 config fixes, comment removed
sharhio Jun 18, 2024
c7bc2d7
DT-6182 removed extra method call and comment
sharhio Jun 18, 2024
75a1d29
DT-6182 scooter color fix, conditional scooter
sharhio Jun 18, 2024
7967e1c
DT-6182 support for selecting single scooter markers, cluster id fix
sharhio Jun 18, 2024
3d4c6e0
fix: restore path change caused by incorrect code review
vesameskanen Jun 19, 2024
ea61289
DT-6182 scooter details styles
sharhio Jun 19, 2024
4aea712
remove comments
sharhio Jun 20, 2024
7d9f086
DT-6182 reverse show when routing logic
sharhio Jun 20, 2024
d87bbac
merge disclaimer divs
sharhio Jun 20, 2024
14f46ca
DT-6182 remove unnecessary fields from queries
sharhio Jun 20, 2024
a1bb888
DT-6182 scooter detail box layout fixed
sharhio Jun 20, 2024
7ecaa43
fix: rename network list parameter
vesameskanen Jun 24, 2024
51f65a2
fix: remove unused query fields
vesameskanen Jun 24, 2024
1f11f6f
fix: remove more unused query fields
vesameskanen Jun 26, 2024
b8f4c7b
chore: simplify scooter itinerary querying
vesameskanen Jun 26, 2024
21fb52f
fix: put query need checks where they belong
vesameskanen Jun 26, 2024
93f7f8a
fix: scooter and transit plan merge logic
vesameskanen Jun 26, 2024
7292d2e
fix: check combinedState loading instead of scooter and transit separ…
vesameskanen Jun 27, 2024
cb433e4
Merge remote-tracking branch 'origin/v3' into DT-6182
vesameskanen Jun 27, 2024
9eb2986
fix: triplink props
vesameskanen Jun 27, 2024
a6db3b2
fix: remove unused rentalVehicle fields from itineraryLine
vesameskanen Jun 27, 2024
373b257
fix: remove OTP1 modes
vesameskanen Jun 27, 2024
e747ee3
fix: refactor badly outdated transport mode handling
vesameskanen Jun 27, 2024
a075261
chore: update modeUtil unit tests
vesameskanen Jun 27, 2024
40fb2f1
fix: remove useless modeToOtp util func
vesameskanen Jun 27, 2024
2670b3a
chore: refactor MapLayersDialogContent.js
vesameskanen Jun 27, 2024
38ff3f9
fix: no need for conditional config access
vesameskanen Jun 27, 2024
a45ea84
fix: unit tests whic did not pass config
vesameskanen Jun 27, 2024
2024c46
fix: do not suggest citybike if wheelchair is enabled
vesameskanen Jun 28, 2024
769e8a5
fix: do not suggest citybikes if wheelchair option is set
vesameskanen Jun 28, 2024
e7f77db
chore: rename
vesameskanen Jun 28, 2024
b5ca294
fix: catch hsl banner fetch errors
vesameskanen Jun 28, 2024
5fc39ea
fix: check correct plan when considering relaxed plans
vesameskanen Jun 28, 2024
008931c
fix: no need to expose children's prop in container
vesameskanen Jun 28, 2024
cc6ac21
fix: no need to pass itineray page state back as parameter from a chi…
vesameskanen Jun 28, 2024
ac44b3f
fix: pass openSettings func, not toggle, to scooter legs
vesameskanen Jun 28, 2024
2c95236
fix: change toggleSettings to openSettings in unit tests
vesameskanen Jun 28, 2024
6779343
fix: rename network types
vesameskanen Jun 28, 2024
c2a816a
fix: remove local test URLs from config
vesameskanen Jun 28, 2024
c7f5b99
fix: unit tests
vesameskanen Jun 28, 2024
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
6 changes: 3 additions & 3 deletions app/component/AppBarHsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ const AppBarHsl = ({ lang, user, favourites }, context) => {

useEffect(() => {
if (config.URL.BANNERS && config.NODE_ENV !== 'test') {
getJson(`${config.URL.BANNERS}&language=${lang}`).then(data =>
setBanners(data),
);
getJson(`${config.URL.BANNERS}&language=${lang}`)
.then(data => setBanners(data))
.catch(() => setBanners([]));
}
}, [lang]);

Expand Down
2 changes: 2 additions & 0 deletions app/component/ExternalLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export default function ExternalLink({
}}
className="external-link"
href={href}
target="_blank"
rel="noopener noreferrer"
>
{name || children}
</a>
Expand Down
62 changes: 41 additions & 21 deletions app/component/MapLayersDialogContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import MapLayerStore, { mapLayerShape } from '../store/MapLayerStore';
import { updateMapLayers } from '../action/MapLayerActions';
import { addAnalyticsEvent } from '../util/analyticsUtils';
import withGeojsonObjects from './map/withGeojsonObjects';
import { getTransportModes, showCityBikes } from '../util/modeUtils';
import { getTransportModes, showRentalVehiclesOfType } from '../util/modeUtils';
import { TransportMode } from '../constants';

const transportModeconfigShape = PropTypes.shape({
availableForSelection: PropTypes.bool,
Expand Down Expand Up @@ -50,6 +51,7 @@ const mapLayersconfigShape = PropTypes.shape({
rail: transportModeconfigShape,
subway: transportModeconfigShape,
tram: transportModeconfigShape,
scooter: transportModeconfigShape,
}),
mapLayers: PropTypes.shape({
tooltip: PropTypes.shape({
Expand Down Expand Up @@ -115,7 +117,7 @@ class MapLayersDialogContent extends React.Component {
};

render() {
const { citybike, parkAndRide, stop, geoJson, vehicles } =
const { citybike, parkAndRide, stop, geoJson, vehicles, scooter } =
this.props.mapLayers;
let arr;
if (this.props.geoJson) {
Expand All @@ -125,7 +127,8 @@ class MapLayersDialogContent extends React.Component {
}
const isTransportModeEnabled = transportMode =>
transportMode && transportMode.availableForSelection;
const transportModes = getTransportModes(this.context.config);
const { config } = this.context;
const transportModes = getTransportModes(config);
return (
<Fragment>
<button
Expand All @@ -145,7 +148,7 @@ class MapLayersDialogContent extends React.Component {
})}
</span>
<div className="checkbox-grouping" />
{this.context.config.vehicles && (
{config.vehicles && (
<div className="checkbox-grouping">
<Checkbox
large
Expand Down Expand Up @@ -205,9 +208,10 @@ class MapLayersDialogContent extends React.Component {
}}
/>
)}
{showCityBikes(
this.context.config?.cityBike?.networks,
this.context.config,
{showRentalVehiclesOfType(
config.cityBike?.networks,
config,
TransportMode.Citybike,
) && (
<Checkbox
large
Expand All @@ -221,6 +225,23 @@ class MapLayersDialogContent extends React.Component {
}}
/>
)}
{showRentalVehiclesOfType(
config.cityBike?.networks,
config,
TransportMode.Scooter,
) && (
<Checkbox
large
checked={scooter}
disabled={!!this.props.mapLayerOptions?.scooter?.isLocked}
defaultMessage="Scooters"
labelId="map-layer-scooter"
onChange={e => {
this.updateSetting({ scooter: e.target.checked });
sendLayerChangeAnalytic('Scooter', e.target.checked);
}}
/>
)}
{isTransportModeEnabled(transportModes.funicular) && (
<Checkbox
large
Expand All @@ -234,20 +255,19 @@ class MapLayersDialogContent extends React.Component {
}}
/>
)}
{this.context.config.parkAndRide &&
this.context.config.parkAndRide.showParkAndRide && (
<Checkbox
large
checked={parkAndRide}
disabled={!!this.props.mapLayerOptions?.parkAndRide?.isLocked}
defaultMessage="Park &amp; ride"
labelId="map-layer-park-and-ride"
onChange={e => {
this.updateSetting({ parkAndRide: e.target.checked });
sendLayerChangeAnalytic('ParkAndRide', e.target.checked);
}}
/>
)}
{config.parkAndRide?.showParkAndRide && (
<Checkbox
large
checked={parkAndRide}
disabled={!!this.props.mapLayerOptions?.parkAndRide?.isLocked}
defaultMessage="Park &amp; ride"
labelId="map-layer-park-and-ride"
onChange={e => {
this.updateSetting({ parkAndRide: e.target.checked });
sendLayerChangeAnalytic('ParkAndRide', e.target.checked);
}}
/>
)}
</div>
{arr && Array.isArray(arr) && (
<div className="checkbox-grouping">
Expand Down
20 changes: 14 additions & 6 deletions app/component/ParkOrStationHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ import { getJson } from '../util/xhrPromise';
import getZoneId from '../util/zoneIconUtils';
import ZoneIcon from './ZoneIcon';
import withBreakpoint from '../util/withBreakpoint';
import { hasStationCode } from '../util/vehicleRentalUtils';
import {
hasVehicleRentalCode,
getVehicleRentalStationNetworkConfig,
} from '../util/vehicleRentalUtils';
import { getIdWithoutFeed } from '../util/feedScopedIdUtils';
import { TransportMode } from '../constants';

const modules = {
FavouriteVehicleRentalStationContainer: () =>
Expand Down Expand Up @@ -46,8 +50,13 @@ const ParkOrBikeStationHeader = (
});
}, []);

const { name, stationId } = parkOrStation;
const { name, stationId, network } = parkOrStation;
const networkConfig = getVehicleRentalStationNetworkConfig(network, config);
const parkHeaderId = parkType === 'bike' ? 'bike-park' : 'car-park';
const noIdHeaderName =
networkConfig.type === TransportMode.Citybike.toLowerCase()
? 'citybike-station-no-id'
: 'e-scooter-station';
return (
<div className="bike-station-header">
{breakpoint === 'large' && (
Expand All @@ -59,10 +68,8 @@ const ParkOrBikeStationHeader = (
<div className="header">
<h1>{name}</h1>
<div className="bike-station-sub-header">
<FormattedMessage
id={stationId ? 'citybike-station-no-id' : parkHeaderId}
/>
{stationId && hasStationCode(parkOrStation) && (
<FormattedMessage id={stationId ? noIdHeaderName : parkHeaderId} />
{stationId && hasVehicleRentalCode(parkOrStation.stationId) && (
<StopCode code={getIdWithoutFeed(stationId)} />
)}
{zoneId && (
Expand Down Expand Up @@ -92,6 +99,7 @@ ParkOrBikeStationHeader.propTypes = {
stationId: PropTypes.string,
lat: PropTypes.number.isRequired,
lon: PropTypes.number.isRequired,
network: PropTypes.string.isRequired,
}).isRequired,
parkType: PropTypes.string,
};
Expand Down
32 changes: 32 additions & 0 deletions app/component/RentalVehicle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import PropTypes from 'prop-types';
import React from 'react';
import Icon from './Icon';
import {
getVehicleRentalStationNetworkIcon,
getVehicleRentalStationNetworkConfig,
} from '../util/vehicleRentalUtils';
import { rentalVehicleShape } from '../util/shapes';

const RentalVehicle = ({ rentalVehicle }, { config }) => {
const disabled = !rentalVehicle.operative;

const vehicleIcon = getVehicleRentalStationNetworkIcon(
getVehicleRentalStationNetworkConfig(rentalVehicle.network, config),
disabled,
);
return (
<div className="scooter-content-container">
<Icon img={vehicleIcon} />
</div>
);
};

RentalVehicle.contextTypes = {
config: PropTypes.shape({
cityBike: { networks: PropTypes.arrayOf(PropTypes.string.isRequired) },
}).isRequired,
};
RentalVehicle.propTypes = {
rentalVehicle: rentalVehicleShape.isRequired,
};
export default RentalVehicle;
Loading
Loading