Skip to content

Commit

Permalink
Merge branch 'dev' into otp-ui-update-jan-24
Browse files Browse the repository at this point in the history
  • Loading branch information
miles-grant-ibigroup committed Feb 2, 2024
2 parents 4665b9d + e004d3b commit 073cdc1
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 70 deletions.
11 changes: 7 additions & 4 deletions index.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ input[type="text"]::-ms-clear {
.slide-pane_from_left {
margin: 52px auto 0 0;
/* Keep pane from overflowing on smaller screens */
height: calc(100vh - 52px);
height: calc(100% - 52px);
}

.slide-pane__content {
Expand Down Expand Up @@ -111,9 +111,12 @@ input[type="text"]::-ms-clear {
width: 100%;
}

.app-menu a:hover,
.app-menu button:hover {
color: #4c97f5;
/* Prevents hover styles from getting triggered on mobile */
@media (hover: hover) {
.app-menu a:hover,
.app-menu button:hover {
color: #4c97f5;
}
}

.app-menu a:focus,
Expand Down
10 changes: 9 additions & 1 deletion lib/actions/apiV2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
aggregateModes,
getBannedRoutesFromSubmodes,
populateSettingWithValue
} from '@opentripplanner/trip-form'
import { createAction } from 'redux-actions'
Expand Down Expand Up @@ -1041,17 +1042,24 @@ export function routingQuery(searchId = null, updateSearchInReducer) {
const modeSettings = modeSettingDefinitions?.map(
populateSettingWithValue(modeSettingValues)
)

// Get the raw query param strings to save for the rider's search history
const rawModeButtonQP = urlSearchParams.get('modeButtons')
const queryParamData = {
modeButtons: rawModeButtonQP,
...modeSettingValues
}

const excludedRoutes =
config.routeModeOverrides &&
getBannedRoutesFromSubmodes(
modeSettings,
config.routeModeOverrides
)?.join(',')

const baseQuery = {
arriveBy,
banned: {
routes: excludedRoutes || undefined,
trips: bannedTrips
},
date,
Expand Down
19 changes: 12 additions & 7 deletions lib/components/form/batch-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,18 @@ function BatchSettings({
)

const addCustomSettingLabels = useCallback(
(msd: ModeSetting) =>
msd.type === 'SUBMODE'
? {
...msd,
label: getFormattedMode(msd.addTransportMode.mode, intl)
}
: msd,
(msd: ModeSetting) => {
let modeLabel
// If we're using route mode overrides, make sure we're using the custom mode name
if (msd.type === 'SUBMODE') {
modeLabel = msd.overrideMode || msd.addTransportMode.mode
return {
...msd,
label: getFormattedMode(modeLabel, intl)
}
}
return msd
},
[intl]
)

Expand Down
35 changes: 19 additions & 16 deletions lib/components/user/common/dropdown-options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,25 @@ export const Select = ({
label,
name,
onChange
}: SelectProps): JSX.Element => (
// <Field> is kept outside of <label> to accommodate layout in table/grid cells.
<>
{label && <label htmlFor={name}>{label}</label>}
<Field
as={Control}
componentClass="select"
defaultValue={defaultValue}
id={name}
name={name}
onChange={onChange}
>
{children}
</Field>
</>
)
}: SelectProps): JSX.Element => {
const fieldProps = {
as: Control,
componentClass: 'select',
defaultValue,
id: name,
name,
onChange
}
/* Passing an onChange will override Formik's onChange, so only pass if onChange exists. */
if (!onChange) delete fieldProps.onChange
return (
// <Field> is kept outside of <label> to accommodate layout in table/grid cells.
<>
{label && <label htmlFor={name}>{label}</label>}
<Field {...fieldProps}>{children}</Field>
</>
)
}

interface OptionsPropsBase<T> {
defaultValue?: T
Expand Down
48 changes: 29 additions & 19 deletions lib/components/viewers/nearby/nearby-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ function NearbyView({
setLocation(payload)
}

// Make sure the highlighted location is cleaned up when leaving nearby
useEffect(() => {
return function cleanup() {
setHighlightedLocation(null)
}
})

useEffect(() => {
const listener = (e: any) => {
if (e.geolocateSource) {
Expand Down Expand Up @@ -177,26 +184,29 @@ function NearbyView({
setHighlightedLocation(null)
}, [setHighlightedLocation])

const nearbyItemList = nearby?.map((n: any) => (
<li
className={
(n.place.gtfsId ?? n.place.id) === entityId ? 'highlighted' : ''
}
key={n.place.id}
>
{/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
<div
onBlur={onMouseLeave}
onFocus={() => onMouseEnter(n.place)}
onMouseEnter={() => onMouseEnter(n.place)}
onMouseLeave={onMouseLeave}
/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */
tabIndex={0}
const nearbyItemList =
nearby?.map &&
nearby?.map((n: any) => (
<li
className={
(n.place.gtfsId ?? n.place.id) === entityId ? 'highlighted' : ''
}
key={n.place.id}
>
{getNearbyItem(n.place, onClickSetLocation)}
</div>
</li>
))
{/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
<div
onBlur={onMouseLeave}
onFocus={() => onMouseEnter(n.place)}
onMouseEnter={() => onMouseEnter(n.place)}
onMouseLeave={onMouseLeave}
/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */
tabIndex={0}
>
{getNearbyItem(n.place, onClickSetLocation)}
</div>
</li>
))

useEffect(() => {
setLoading(false)
}, [nearby])
Expand Down
10 changes: 7 additions & 3 deletions lib/reducers/create-otp-reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,17 @@ export function getInitialState(userDefinedConfig) {
}

const transitModeSettings = config?.modes?.transitModes.map((transitMode) => {
const { mode } = transitMode
const { mode, overrideMode } = transitMode
const displayedMode = overrideMode || mode
return {
// This is the mode that gets added to the actual query to OTP
addTransportMode: { mode },
applicableMode: 'TRANSIT',
default: true,
iconName: mode.toLowerCase(),
key: mode.toLowerCase(),
iconName: displayedMode.toLowerCase(),
key: displayedMode.toLowerCase(),
// This overrideMode is used in case we need to filter routes out based on their overrideMode
overrideMode,
type: 'SUBMODE'
}
})
Expand Down
45 changes: 25 additions & 20 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@
dependencies:
regenerator-runtime "^0.13.4"

"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.5", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.13", "@babel/runtime@^7.13.10", "@babel/runtime@^7.14.0", "@babel/runtime@^7.15.3", "@babel/runtime@^7.19.0", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.0", "@babel/runtime@^7.4.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2":
"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.5", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.13", "@babel/runtime@^7.13.10", "@babel/runtime@^7.19.0", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.0", "@babel/runtime@^7.4.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2":
version "7.22.11"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.11.tgz#7a9ba3bbe406ad6f9e8dd4da2ece453eb23a77a4"
integrity sha512-ee7jVNlWN09+KftVOu9n7S8gQzD/Z6hN/I8VBRXW4P1+Xe7kJGXMwu8vds4aGIMHZnNbdpSWCfZZtinytpcAvA==
Expand Down Expand Up @@ -3039,20 +3039,20 @@
"@sinonjs/commons" "^1.7.0"

"@styled-icons/bootstrap@^10.34.0":
version "10.34.0"
resolved "https://registry.yarnpkg.com/@styled-icons/bootstrap/-/bootstrap-10.34.0.tgz#d9142e9eb70dc437f7ef62ffc40168e1ae13ab12"
integrity sha512-UpzdVUR7r9BNqEfPrMchJdgMZEg9eXQxLQJUXM0ouvbI5o9j21/y1dGameO4PZtYbutT/dWv5O6y24z5JWzd5w==
version "10.47.0"
resolved "https://registry.yarnpkg.com/@styled-icons/bootstrap/-/bootstrap-10.47.0.tgz#c3e363dfe87b732a5da818f320f90f5ab4961b84"
integrity sha512-xpnPdrLhAhpTRE4iljQIEK73twVj7VPglwHSL+8nQdH7EsW5RJIOWsmlkZMyqhQHN0H7fGmT10F3/6OQhSpfGg==
dependencies:
"@babel/runtime" "^7.14.0"
"@styled-icons/styled-icon" "^10.6.3"
"@babel/runtime" "^7.20.7"
"@styled-icons/styled-icon" "^10.7.0"

"@styled-icons/boxicons-regular@^10.38.0":
version "10.38.0"
resolved "https://registry.yarnpkg.com/@styled-icons/boxicons-regular/-/boxicons-regular-10.38.0.tgz#1eb80b4f94a18a9b77b11dee5204aa23378d37ec"
integrity sha512-xjhafoa0/EeYtQOyTw+ohuSlBx599t8l8++JH1tQlM0l73dP4icTpF4znYL+HhZeaUe3D+UhrkfWuBBua2w2Qw==
version "10.47.0"
resolved "https://registry.yarnpkg.com/@styled-icons/boxicons-regular/-/boxicons-regular-10.47.0.tgz#6318dd8ba9bfbf143c3a32c9d1c72479d376bd3a"
integrity sha512-z8KczDp4VArXvOn8i2j66Xs4oX9oiiJEhMoHydY3uC9kdtImcxhZ/xHPrgTJLkbK6f5ikwB4CKVnSqQGzzAJNw==
dependencies:
"@babel/runtime" "^7.15.3"
"@styled-icons/styled-icon" "^10.6.3"
"@babel/runtime" "^7.20.7"
"@styled-icons/styled-icon" "^10.7.0"

"@styled-icons/fa-regular@^10.34.0", "@styled-icons/fa-regular@^10.37.0":
version "10.47.0"
Expand All @@ -3078,7 +3078,7 @@
"@babel/runtime" "^7.19.0"
"@styled-icons/styled-icon" "^10.7.0"

"@styled-icons/styled-icon@^10.6.3", "@styled-icons/styled-icon@^10.7.0":
"@styled-icons/styled-icon@^10.7.0":
version "10.7.0"
resolved "https://registry.yarnpkg.com/@styled-icons/styled-icon/-/styled-icon-10.7.0.tgz#d6960e719b8567c8d0d3a87c40fb6f5b4952a228"
integrity sha512-SCrhCfRyoY8DY7gUkpz+B0RqUg/n1Zaqrr2+YKmK/AyeNfCcoHuP4R9N4H0p/NA1l7PTU10ZkAWSLi68phnAjw==
Expand Down Expand Up @@ -5808,11 +5808,16 @@ class-utils@^0.3.5:
isobject "^3.0.0"
static-extend "^0.1.1"

classnames@^2.2.5, classnames@^2.2.6, classnames@^2.3.1:
classnames@^2.2.5, classnames@^2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.1.tgz#dfcfa3891e306ec1dad105d0e88f4417b8535e8e"
integrity sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA==

classnames@^2.2.6:
version "2.5.1"
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.5.1.tgz#ba774c614be0f016da105c858e7159eae8e7687b"
integrity sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==

clean-css@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.3.tgz#507b5de7d97b48ee53d84adb0160ff6216380f78"
Expand Down Expand Up @@ -8178,7 +8183,7 @@ execa@^5.0.0, execa@^5.1.1:
exenv@^1.2.0, exenv@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/exenv/-/exenv-1.2.2.tgz#2ae78e85d9894158670b03d47bec1f03bd91bb9d"
integrity sha1-KueOhdmJQVhnCwPUe+wfA72Ru50=
integrity sha512-Z+ktTxTwv9ILfgKCk32OX3n/doe+OcLTRtqK9pcL+JsP3J1/VW8Uvl4ZjLlKqeW4rzK4oesDOGMEMRIZqtP4Iw==

exit@^0.1.2:
version "0.1.2"
Expand Down Expand Up @@ -15107,9 +15112,9 @@ react-fast-compare@^2.0.1:
integrity sha512-suNP+J1VU1MWFKcyt7RtjiSWUjvidmQSlqu+eHslq+342xCbGTYmC0mEhPCOHxlW0CywylOC1u2DFAT+bv4dBw==

react-from-dom@^0.6.0:
version "0.6.1"
resolved "https://registry.yarnpkg.com/react-from-dom/-/react-from-dom-0.6.1.tgz#6740f5a3d79e0c354703e5c096b8fdfe0db71b0f"
integrity sha512-7aAZx7LhRnmR51W5XtmTBYHGFl2n1AdEk1uoXLuzHa1OoGXrxOW/iwLcudvgp6BGX/l4Yh1rtMrIzvhlvbVddg==
version "0.6.2"
resolved "https://registry.yarnpkg.com/react-from-dom/-/react-from-dom-0.6.2.tgz#9da903a508c91c013b55afcd59348b8b0a39bdb4"
integrity sha512-qvWWTL/4xw4k/Dywd41RBpLQUSq97csuv15qrxN+izNeLYlD9wn5W8LspbfYe5CWbaSdkZ72BsaYBPQf2x4VbQ==

react-ga@^3.3.0:
version "3.3.0"
Expand All @@ -15124,9 +15129,9 @@ react-hot-toast@^2.4.1:
goober "^2.1.10"

react-indiana-drag-scroll@^2.0.1:
version "2.1.0"
resolved "https://registry.yarnpkg.com/react-indiana-drag-scroll/-/react-indiana-drag-scroll-2.1.0.tgz#37654eae8caced01cdecc8bce55f0382871a021d"
integrity sha512-Tj94Dv9PkmoKqc9nxK/dzwhtE8pP7NTxmeHqkD8KN0zad1NNE+/JsvRcK4EdqE6CdA2nMESzqPMvv1AzRXdBew==
version "2.2.0"
resolved "https://registry.yarnpkg.com/react-indiana-drag-scroll/-/react-indiana-drag-scroll-2.2.0.tgz#657e14bbdf4888cc738e9fa8dc4384d76c348c0b"
integrity sha512-+W/3B2OQV0FrbdnsoIo4dww/xpH0MUQJz6ziQb7H+oBko3OCbXuzDFYnho6v6yhGrYDNWYPuFUewb89IONEl/A==
dependencies:
classnames "^2.2.6"
debounce "^1.2.0"
Expand Down

0 comments on commit 073cdc1

Please sign in to comment.