Skip to content

Commit

Permalink
refactor(MobilityPane): Fix types and text for no devices.
Browse files Browse the repository at this point in the history
  • Loading branch information
binh-dam-ibigroup committed Dec 11, 2023
1 parent a3a0a85 commit f558897
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/components/user/mobility-profile/mobility-pane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,22 @@ const MobilityPane = ({ routeTo, values: userData }: Props): JSX.Element => {
const handleClick = useCallback(() => {
routeTo('/account/mobilityProfile/')
}, [routeTo])
const { isMobilityLimited, mobilityDevices, visionLimitation } =
userData.mobilityProfile || {}
const {
isMobilityLimited,
mobilityDevices = [],
visionLimitation
} = userData.mobilityProfile || {}
const devices = mobilityDevices.length ? mobilityDevices : ['none']
return (
<div>
<p>
<FormattedMessage id="components.MobilityProfile.MobilityPane.mobilityDevices" />
<FormattedList
// `style` below is a react-intl-specific prop.
// `style` below is a react-intl -specific prop.
// eslint-disable-next-line react/style-prop-object
style="narrow"
style="narrow" // Should suppress the ending "and" in "a, b, and c".
type="conjunction"
value={mobilityDevices?.map((dv) => (
value={devices.map((dv) => (
<FormattedMessage
id={`components.MobilityProfile.DevicesPane.devices.${dv}`}
key={dv}
Expand Down

0 comments on commit f558897

Please sign in to comment.