diff --git a/i18n/en-US.yml b/i18n/en-US.yml index 7d7026bd5..08a39b393 100644 --- a/i18n/en-US.yml +++ b/i18n/en-US.yml @@ -228,6 +228,7 @@ components: deleteCompanion: Delete {email} noCompanions: You do not have any existing travel companions. submitNewCompanion: Send invitation + title: Travel companions DateTimeOptions: arriveBy: Arrive by departAt: Depart at diff --git a/lib/components/user/common/add-email-form.tsx b/lib/components/user/common/add-email-form.tsx index d4ee4c6e9..88e368402 100644 --- a/lib/components/user/common/add-email-form.tsx +++ b/lib/components/user/common/add-email-form.tsx @@ -49,41 +49,39 @@ const AddEmailForm = ({ onSubmit, placeholder, submitText -}: Props): JSX.Element => { - return ( - - {({ errors, isSubmitting, touched, values }) => { - const showError = - errors.newEmail && touched.newEmail && values.newEmail?.length > 0 - return ( - - {label} - -
- +}: Props): JSX.Element => ( + + {({ errors, isSubmitting, touched, values }) => { + const showError = + errors.newEmail && touched.newEmail && values.newEmail?.length > 0 + return ( + + {label} + + + - {submitText} - - {showError && 'Invalid email'} - - ) - }} - - ) -} + {submitText} + + {showError && 'Invalid email'} + + ) + }} + +) export default AddEmailForm diff --git a/lib/components/user/existing-account-display.tsx b/lib/components/user/existing-account-display.tsx index 924ad72ce..98a3e675b 100644 --- a/lib/components/user/existing-account-display.tsx +++ b/lib/components/user/existing-account-display.tsx @@ -54,7 +54,7 @@ const ExistingAccountDisplay = (props: Props) => { hidden: !mobilityProfileEnabled, pane: CompanionsPane, props, - title: 'Travel companions' + title: }, { pane: NotificationPrefsPane, diff --git a/lib/components/user/mobility-profile/companions-pane.tsx b/lib/components/user/mobility-profile/companions-pane.tsx index 91cdbc053..e95c2323d 100644 --- a/lib/components/user/mobility-profile/companions-pane.tsx +++ b/lib/components/user/mobility-profile/companions-pane.tsx @@ -1,5 +1,5 @@ import { ControlLabel, FormGroup } from 'react-bootstrap' -import { FormattedMessage, IntlShape, useIntl } from 'react-intl' +import { FormattedMessage, useIntl } from 'react-intl' import { FormikProps } from 'formik' import { Trash } from '@styled-icons/fa-solid/Trash' import { User as UserIcon } from '@styled-icons/fa-solid/User' @@ -15,12 +15,12 @@ import StatusBadge from '../../util/status-badge' import SubmitButton from '../../util/submit-button' const Companion = styled.li` - list-style-type: none; - display: flex; align-items: center; + display: flex; justify-content: space-between; - width: 100%; + list-style-type: none; margin-top: 20px; + width: 100%; ` const CompanionList = styled.ul` @@ -28,28 +28,27 @@ const CompanionList = styled.ul` ` const LeftGroup = styled.div` - display: flex; align-items: center; + display: flex; gap: 40px; ` const RightGroup = styled.div` - display: flex; align-items: center; + display: flex; gap: 20px; ` interface CompanionRowProps { companionInfo: CompanionInfo - intl: IntlShape onDelete: (email: string) => void } const CompanionRow = ({ companionInfo, - intl, onDelete }: CompanionRowProps): JSX.Element => { + const intl = useIntl() const { email, status } = companionInfo const [disabled, setDisabled] = useState(false) @@ -109,13 +108,13 @@ const CompanionsPane = ({ setFieldValue, values: userData }: FormikProps): JSX.Element => { - const { guardians: companions = [] } = userData + const { relatedUsers: companions = [] } = userData const formId = 'add-companion-form' const intl = useIntl() const updateCompanions = useCallback( async (newCompanions) => { - setFieldValue('guardians', newCompanions) + setFieldValue('relatedUsers', newCompanions) // Register the change (can include a submission). await handleChange({ @@ -176,7 +175,6 @@ const CompanionsPane = ({ {companions.map((companion) => ( diff --git a/lib/components/user/monitored-trip/saved-trip-editor.tsx b/lib/components/user/monitored-trip/saved-trip-editor.tsx index 8134af2ef..d086103c3 100644 --- a/lib/components/user/monitored-trip/saved-trip-editor.tsx +++ b/lib/components/user/monitored-trip/saved-trip-editor.tsx @@ -3,6 +3,7 @@ import React, { ComponentType } from 'react' import { BackButtonContent } from '../back-link' import { MonitoredTrip } from '../types' +import { PaneAttributes } from '../stacked-panes' import { TRIPS_PATH } from '../../../util/constants' import DeleteForm from '../delete-form' import Link from '../../util/link' @@ -31,9 +32,8 @@ const SavedTripEditor = (props: Props): JSX.Element => { const intl = useIntl() if (monitoredTrip) { - const paneSequence = [ + const paneSequence: PaneAttributes[] = [ { - collapsible: false, pane: panes.basics, props, title: ( @@ -41,7 +41,6 @@ const SavedTripEditor = (props: Props): JSX.Element => { ) }, { - collapsible: false, pane: panes.notifications, props, title: ( diff --git a/lib/components/user/monitored-trip/saved-trip-screen.js b/lib/components/user/monitored-trip/saved-trip-screen.js index 073bae627..49728d7d8 100644 --- a/lib/components/user/monitored-trip/saved-trip-screen.js +++ b/lib/components/user/monitored-trip/saved-trip-screen.js @@ -239,7 +239,6 @@ const mapStateToProps = (state, ownProps) => { const pending = activeSearch ? Boolean(activeSearch.pending) : false const itineraries = getActiveItineraries(state) || [] const tripId = ownProps.match.params.id - console.log('state:::: ', state) return { activeSearchId: state.otp.activeSearchId, homeTimezone: state.otp.config.homeTimezone, diff --git a/lib/components/user/standard-panes.tsx b/lib/components/user/standard-panes.tsx index e317f5ba2..405938955 100644 --- a/lib/components/user/standard-panes.tsx +++ b/lib/components/user/standard-panes.tsx @@ -24,7 +24,7 @@ const standardPanes: Record = { companions: { id: 'companions', pane: CompanionsPane, - title: 'Travel Companions' // TODO i18n + title: }, finish: { id: 'finish', diff --git a/lib/components/user/types.ts b/lib/components/user/types.ts index 57ed108c3..01ffaa6eb 100644 --- a/lib/components/user/types.ts +++ b/lib/components/user/types.ts @@ -41,7 +41,6 @@ export interface User { accessibilityRoutingByDefault?: boolean // email always exists per Auth0. email: string - guardians?: CompanionInfo[] hasConsentedToTerms?: boolean id?: string isPhoneNumberVerified?: boolean @@ -50,6 +49,7 @@ export interface User { phoneNumber?: string preferredLocale?: string pushDevices?: number + relatedUsers?: CompanionInfo[] savedLocations?: UserSavedLocation[] storeTripHistory?: boolean }