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

feat(companions-pane): Add new companions pane to saved trip editor and account settings screen #1289

Merged
merged 37 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ec66a9b
feat(AddEmailForm): Introduce new component.
binh-dam-ibigroup Sep 25, 2024
1fc76aa
feat(CompanionsPane): Add basic companions pane
binh-dam-ibigroup Sep 26, 2024
122428b
improvement(CompanionsPane): Add delete companion, improve adding one.
binh-dam-ibigroup Sep 26, 2024
c8ee71a
improvement(AddEmailForm): Tweak email validation
binh-dam-ibigroup Sep 26, 2024
f41b91a
refactor(SubmitButton): Extract submit button
binh-dam-ibigroup Sep 26, 2024
2f9b299
refactor(StatusBadge): Extract status badge component.
binh-dam-ibigroup Sep 27, 2024
d186fc9
refactor: Add companions pane to acct pages, remove from mob wiz.
binh-dam-ibigroup Sep 27, 2024
cf1c9b1
refactor: Fix types
binh-dam-ibigroup Sep 27, 2024
be648df
feat(saved-trip-editor): add companions pane to editor
josh-willis-arcadis Oct 9, 2024
b5a7c25
refactor(companions-pane): update styling of companions row to match …
josh-willis-arcadis Oct 10, 2024
8b3d4ab
refactor(add-email-form): make input field full width
josh-willis-arcadis Oct 11, 2024
ac4c41f
refactor(add-email-form): don't use control strip component
josh-willis-arcadis Oct 11, 2024
32d87f9
fix(add-email-form): add back form component
josh-willis-arcadis Oct 11, 2024
7496183
feat(companions-pane): make pane collapsible
josh-willis-arcadis Oct 14, 2024
d07b51f
feat(companions-pane): add i18n key/vals
josh-willis-arcadis Oct 15, 2024
600fd50
refactor: address PR feedback
josh-willis-arcadis Oct 21, 2024
7349731
Merge branch 'mobility-profile-routing-2' into trusted-companions
josh-willis-arcadis Oct 23, 2024
b7ef0af
Merge branch 'dev' into trusted-companions
josh-willis-arcadis Oct 23, 2024
186b634
Merge branch 'dev' into trusted-companions
josh-willis-arcadis Oct 23, 2024
6b2da61
refactor(CompanionsPane): Don't pass userId when requesting new compa…
binh-dam-ibigroup Oct 30, 2024
0f57130
feat: Add confirmation and error landing pages.
binh-dam-ibigroup Oct 30, 2024
ba97b8e
refactor(confirmation.html): Merge error and confirmation pages
binh-dam-ibigroup Oct 31, 2024
f039959
Merge pull request #1298 from opentripplanner/trusted-companions-qbd
josh-willis-arcadis Nov 4, 2024
6599af5
address pr feedback
josh-willis-arcadis Nov 4, 2024
3732363
refactor(user/types): add status values
josh-willis-arcadis Nov 4, 2024
a032296
Fix code scanning alert no. 7: Client-side cross-site scripting
josh-willis-arcadis Nov 4, 2024
a0fa2c7
Merge branch 'dev' into trusted-companions
josh-willis-arcadis Nov 4, 2024
c741d54
Merge branch 'dev' into trusted-companions
binh-dam-ibigroup Nov 7, 2024
f07d9bc
chore(i18n): Add FR translations
binh-dam-ibigroup Nov 7, 2024
f937cbd
refactor: use plural travelCompanions
josh-willis-arcadis Nov 7, 2024
574dc91
fix(en-us): fix spelling
josh-willis-arcadis Nov 7, 2024
55a49fa
refactor(status-badge): use implicit return syntax
josh-willis-arcadis Nov 7, 2024
532800a
Merge branch 'dev' into trusted-companions
josh-willis-arcadis Nov 7, 2024
af90e01
refactor(existing-account-display): remove collapsible prop
josh-willis-arcadis Nov 15, 2024
5fbf59d
refactor(saved-trip-editor): remove collapsible prop
josh-willis-arcadis Nov 15, 2024
7c80158
Merge branch 'dev' into trusted-companions
josh-willis-arcadis Nov 15, 2024
994d9f8
Merge branch 'dev' into trusted-companions
josh-willis-arcadis Nov 19, 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
20 changes: 18 additions & 2 deletions i18n/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,19 @@ components:
advancedOptions: Advanced options
groupSize: "Group size:"
intermediateDestination: Enter intermediate destination
CompanionsPane:
addNewCompanion: Add a new travel companion
companionAlreadyAdded: You already have a companion with email {email}
companionExplanation: >
Invite an exiting GMAP user to be a travel companion by entering their
josh-willis-arcadis marked this conversation as resolved.
Show resolved Hide resolved
email. When they accept, their status will change to "verified", and you
can share your trip status and plan trips based on one another's mobility
profile.
confirmDeleteCompanion: Do you want to delete companion {email}?
currentCompanionsLabel: "Current travel companions:"
deleteCompanion: Delete {email}
noCompanions: You do not have any existing travel companions.
submitNewCompanion: Send invitation
DateTimeOptions:
arriveBy: Arrive by
departAt: Depart at
Expand Down Expand Up @@ -417,7 +430,6 @@ components:
changeNumber: Change number
invalidCode: Please enter 6 digits for the validation code.
invalidPhone: Please enter a valid phone number.
pending: Pending
phoneNumberSubmitted: Phone number {phoneNumber} was successfully submitted.
phoneNumberVerified: Phone number {phoneNumber} was successfully verified.
placeholder: Enter your phone number
Expand All @@ -433,7 +445,6 @@ components:
Please check the SMS messaging app on your mobile phone for a text message
with a verification code, and enter the code below (code expires after 10
minutes).
verified: Verified
verify: Verify
verifySms: >-
Please complete the verification process in order to set up SMS
Expand Down Expand Up @@ -511,6 +522,7 @@ components:
deleteSavedTrip: Delete saved trip
editSavedTrip: Edit saved trip
saveNewTrip: Save new trip
travelCompanion: Travel companions
josh-willis-arcadis marked this conversation as resolved.
Show resolved Hide resolved
tripInformation: Trip information
tripNotFound: Trip not found
tripNotFoundDescription: Sorry, the requested trip was not found.
Expand Down Expand Up @@ -543,6 +555,10 @@ components:
usingRealtimeInfo: This trip uses real-time traffic and delay information
StackedPaneDisplay:
savePreferences: Save preferences
StatusBadge:
invalid: Invalid
pending: Pending
verified: Verified
StopScheduleTable:
block: Block
departure: Departure
Expand Down
6 changes: 4 additions & 2 deletions i18n/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,6 @@ components:
changeNumber: Cambiar número de teléfono
invalidCode: Introduzca 6 dígitos para el código de validación.
invalidPhone: Por favor, introduzca un número de teléfono válido.
pending: Pendiente
phoneNumberSubmitted: El número de teléfono {phoneNumber} se ha enviado correctamente.
phoneNumberVerified: El número de teléfono {phoneNumber} se ha verificado correctamente.
placeholder: Introduzca su número de teléfono
Expand All @@ -448,7 +447,6 @@ components:
teléfono móvil si hay un mensaje de texto con un código de verificación, e
introduzca el código que aparece a continuación. El código caduca a los 10
minutos.
verified: Verificado
verify: Verificar
verifySms: >-
Por favor, complete el proceso de verificación para configurar las
Expand Down Expand Up @@ -561,6 +559,10 @@ components:
usingRealtimeInfo: Este viaje utiliza información de tráfico y retrasos en tiempo real
StackedPaneDisplay:
savePreferences: Guardar preferencias
StatusBadge:
invalid: Inválido
pending: Pendiente
verified: Verificado
StopScheduleTable:
block: Bloquear
departure: Salida
Expand Down
6 changes: 4 additions & 2 deletions i18n/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,6 @@ components:
changeNumber: Changer de numéro
invalidCode: Le code de vérification doit comporter 6 chiffres.
invalidPhone: Veuillez entrer un numéro de téléphone valable.
pending: Non vérifié
phoneNumberSubmitted: Le numéro {phoneNumber} a bien été envoyé.
phoneNumberVerified: Le numéro {phoneNumber} a bien été vérifié.
placeholder: Entrez votre numéro
Expand All @@ -455,7 +454,6 @@ components:
verificationInstructions: >
Un SMS vous a été envoyé avec un code de vérification. Veuillez taper ce
code ci-dessous (le code expire après 10 minutes).
verified: Vérifié
verify: Vérifier
verifySms: >-
Veuillez effectuer la vérification de votre numéro de téléphone afin de
Expand Down Expand Up @@ -573,6 +571,10 @@ components:
retards
StackedPaneDisplay:
savePreferences: Enregistrer mes préférences
StatusBadge:
invalid: Non valable
pending: Non vérifié
verified: Vérifié
StopScheduleTable:
block: Bloc
departure: Départ
Expand Down
6 changes: 4 additions & 2 deletions i18n/ko.yml
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ components:
changeNumber: 번호 변경
invalidCode: 확인 코드 6 자리를 입력하세요.
invalidPhone: 유효한 전화번호를 입력하세요.
pending: 보류 중
phoneNumberSubmitted: 전화번호 {phoneNumber} 이/가 성공적으로 제출되었습니다.
phoneNumberVerified: 전화번호 {phoneNumber}가 성공적으로 확인되었습니다.
placeholder: 전화번호를 입력하십시오
Expand All @@ -367,7 +366,6 @@ components:
verificationCode: "확인 코드:"
verificationInstructions: |
휴대폰의 SMS 메시지 앱에서 인증 코드를 확인하고 아래에 코드를 입력하세요(코드는 10분 후에 만료됩니다).
verified: 확인됨
verify: 확인
Place:
deleteThisPlace: 이 장소 삭제
Expand Down Expand Up @@ -465,6 +463,10 @@ components:
usingRealtimeInfo: 이 트립은 실시간 교통 및 지체 정보를 사용합니다
StackedPaneDisplay:
savePreferences: 환경설정 저장
StatusBadge:
invalid: Invalid
pending: 보류 중
verified: 확인됨
StopScheduleTable:
block: 블록
departure: 출발
Expand Down
6 changes: 4 additions & 2 deletions i18n/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ components:
changeNumber: Изменить номер
invalidCode: "Введите проверочный код из 6\_цифр."
invalidPhone: Введите действительный номер телефона.
pending: Ожидание
phoneNumberSubmitted: Номер телефона{phoneNumber} был успешно отправлен.
phoneNumberVerified: Номер телефона{phoneNumber} был успешно проверен.
placeholder: Введите свой номер телефона
Expand All @@ -403,7 +402,6 @@ components:
могут взиматься дополнительные пени.
verificationCode: "Код подтверждения:"
verificationInstructions: "Откройте приложение для обмена SMS на телефоне и найдите текстовое сообщение с кодом подтверждения. Затем введите код ниже (срок действия кода: 10\_минут).\n"
verified: Подтверждено
verify: Подтвердить
Place:
deleteThisPlace: Удалить это место
Expand Down Expand Up @@ -514,6 +512,10 @@ components:
режиме реального времени.
StackedPaneDisplay:
savePreferences: Сохранить параметры
StatusBadge:
invalid: Invalid
pending: Ожидание
verified: Подтверждено
StopScheduleTable:
block: Заблокировать
departure: Отправление
Expand Down
6 changes: 4 additions & 2 deletions i18n/tl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ components:
changeNumber: Baguhin ang numero
invalidCode: Maglagay ng 6 na digit para sa code sa pag-validate.
invalidPhone: Maglagay ng valid na numero ng telepono.
pending: Nakabinbin
phoneNumberSubmitted: Matagumpay na naisumite ang numero ng teleponong {phoneNumber}.
phoneNumberVerified: Matagumpay na na-verify ang numero ng teleponong {phoneNumber} .
placeholder: Ilagay ang numero ng iyong telepono
Expand All @@ -412,7 +411,6 @@ components:
Tingnan ang app sa SMS messaging sa iyong mobile phone para sa isang text
message na may code sa pag-verify, at ilagay ang code sa ibaba
(mag-e-expire ang code pagkalipas ng 10 minuto).
verified: Na-verify
verify: I-verify
Place:
deleteThisPlace: I-delete ang lugar na ito
Expand Down Expand Up @@ -523,6 +521,10 @@ components:
pagkaantala
StackedPaneDisplay:
savePreferences: I-save ang mga kagustuhan
StatusBadge:
invalid: Invalid
pending: Nakabinbin
verified: Na-verify
StopScheduleTable:
block: I-block
departure: Pag-alis
Expand Down
6 changes: 4 additions & 2 deletions i18n/vi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ components:
changeNumber: Thay đổi số điện thoại
invalidCode: Vui lòng nhập 6 chữ số cho mã xác thực.
invalidPhone: Xin vui lòng nhập một số điện thoại hợp lệ.
pending: Chưa xác minh
phoneNumberSubmitted: Gửi thành công số điện thoại {phoneNumber}.
phoneNumberVerified: Số điện thoại {phoneNumber} đã được xác minh thành công.
placeholder: Nhập số điện thoại của bạn
Expand All @@ -407,7 +406,6 @@ components:
Vui lòng kiểm tra ứng dụng nhắn tin SMS trên điện thoại di động của bạn để
thấy tin nhắn với mã xác minh và nhập mã bên dưới (mã hết hạn sau 10
phút).
verified: Đã xác minh
verify: Kiểm chứng
Place:
deleteThisPlace: Xóa nơi này
Expand Down Expand Up @@ -517,6 +515,10 @@ components:
thực
StackedPaneDisplay:
savePreferences: Lưu lại những ưu tiên
StatusBadge:
invalid: Invalid
pending: Chưa xác minh
verified: Đã xác minh
StopScheduleTable:
block: Dãy nhà
departure: Khởi hành
Expand Down
6 changes: 4 additions & 2 deletions i18n/zh_Hans.yml
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ components:
changeNumber: 更改电话号码
invalidCode: 请输入6位数的验证码.
invalidPhone: 请输入一个有效的电话号码.
pending: 待定
phoneNumberSubmitted: 电话号码{phoneNumber}已成功提交。
phoneNumberVerified: 电话号码 {phoneNumber} 已成功验证。
placeholder: 输入你的电话号码
Expand All @@ -367,7 +366,6 @@ components:
verificationCode: "验证码:"
verificationInstructions: |
请检查您手机上的短信应用查看是否有验证码的短信并输入以下代码 (代码在10分钟后失效).
verified: 已验证
verify: 核实
Place:
deleteThisPlace: 删除这个地点
Expand Down Expand Up @@ -464,6 +462,10 @@ components:
usingRealtimeInfo: 这个行程使用实时交通和延迟信息
StackedPaneDisplay:
savePreferences: 保存偏好
StatusBadge:
invalid: Invalid
pending: 待定
verified: 已验证
StopScheduleTable:
block: 堵塞
departure: 出发
Expand Down
6 changes: 4 additions & 2 deletions i18n/zh_Hant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ components:
changeNumber: 變更號碼
invalidCode: 請輸入6位數的驗證碼。
invalidPhone: 請輸入有效的電話號碼。
pending: 待處理
phoneNumberSubmitted: 已順利提交電話號碼 {phoneNumber}。
phoneNumberVerified: 已順利驗證電話號碼 {phoneNumber} 。
placeholder: 輸入您的電話號碼
Expand All @@ -356,7 +355,6 @@ components:
verificationCode: 驗證碼:
verificationInstructions: |
請查看您手機的簡訊應用程式是否收到含有驗證碼的簡訊,並在下方輸入該驗證碼 (驗證碼將在10分鐘後失效)。
verified: 已驗證
verify: 驗證
Place:
deleteThisPlace: 刪除此地點
Expand Down Expand Up @@ -453,6 +451,10 @@ components:
usingRealtimeInfo: 此行程使用即時交通和延誤資訊。
StackedPaneDisplay:
savePreferences: 儲存偏好
StatusBadge:
invalid: Invalid
pending: 待處理
verified: 已驗證
StopScheduleTable:
block: 封鎖
departure: 出發
Expand Down
89 changes: 89 additions & 0 deletions lib/components/user/common/add-email-form.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// @ts-expect-error No TypeScript for yup.
import * as yup from 'yup'
import {
ControlLabel,
FormControl,
FormGroup,
HelpBlock
} from 'react-bootstrap'
import { Field, Form, Formik } from 'formik'
import React, { ReactNode } from 'react'
import styled from 'styled-components'

import { ControlStrip, phoneFieldStyle } from '../styled'
import SubmitButton from '../../util/submit-button'

interface Props {
id: string
label: ReactNode
onSubmit: any
placeholder?: string
submitText: ReactNode
}

// Styles
const InlineInput = styled(FormControl)`
${phoneFieldStyle}
width: 100%;
`

const Controls = styled.span`
display: flex;

input {
margin-right: 10px;
}
`

// The validation schema for email addresses
const emailValidationSchema = yup.object({
newEmail: yup.string().email().required()
})

/**
* Just a form to add an email.
*/
const AddEmailForm = ({
id,
label,
onSubmit,
placeholder,
submitText
}: Props): JSX.Element => {
return (
josh-willis-arcadis marked this conversation as resolved.
Show resolved Hide resolved
<Formik
initialValues={{ newEmail: '' }}
onSubmit={onSubmit}
validateOnBlur
validateOnChange={false}
validationSchema={emailValidationSchema}
>
{({ errors, isSubmitting, touched, values }) => {
const showError =
errors.newEmail && touched.newEmail && values.newEmail?.length > 0
return (
<FormGroup validationState={showError ? 'error' : null}>
<ControlLabel>{label}</ControlLabel>
<Controls>
<Form id={id} noValidate />
<Field
aria-invalid={showError}
aria-required
as={InlineInput}
form={id}
name="newEmail"
placeholder={placeholder}
type="email"
/>

<SubmitButton form={id}>{submitText}</SubmitButton>
</Controls>
<HelpBlock role="alert">{showError && 'Invalid email'}</HelpBlock>
</FormGroup>
)
}}
</Formik>
)
}

export default AddEmailForm
8 changes: 8 additions & 0 deletions lib/components/user/existing-account-display.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import PageTitle from '../util/page-title'
import { EditedUser } from './types'
import A11yPrefs from './a11y-prefs'
import BackToTripPlanner from './back-to-trip-planner'
import CompanionsPane from './mobility-profile/companions-pane'
import DeleteUser from './delete-user'
import FavoritePlaceList from './places/favorite-place-list'
import MobilityPane from './mobility-profile/mobility-pane'
Expand Down Expand Up @@ -48,6 +49,13 @@ const ExistingAccountDisplay = (props: Props) => {
<FormattedMessage id="components.MobilityProfile.MobilityPane.header" />
)
},
{
collapsible: true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is an interesting feature that was in the mockup, although I'm split on whether to have it for this pane. I'll let the other reviewer weigh in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not the biggest fan of it here. I think this is a nice to have feature, but it doesn't make sense if this is the only section that uses it. If all the sections were collapsable I think this would make more sense.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed

hidden: !mobilityProfileEnabled,
pane: CompanionsPane,
props,
title: 'Travel companions'
josh-willis-arcadis marked this conversation as resolved.
Show resolved Hide resolved
},
{
pane: NotificationPrefsPane,
props,
Expand Down
Loading