-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add feedback email adress after simulation in stdcm #11031
base: dev
Are you sure you want to change the base?
Conversation
Signed-off-by: Mathieu <[email protected]>
Signed-off-by: Mathieu <[email protected]>
61232fc
to
1f4c658
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## dev #11031 +/- ##
==========================================
+ Coverage 80.69% 80.71% +0.02%
==========================================
Files 1098 1099 +1
Lines 111888 111987 +99
Branches 745 745
==========================================
+ Hits 90290 90395 +105
+ Misses 21555 21549 -6
Partials 43 43
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
1f4c658
to
519cc42
Compare
519cc42
to
d93402c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we open the mail in a new tab?
import { getSelectedSimulation } from 'reducers/osrdconf/stdcmConf/selectors'; | ||
import { dateTimeFormatting } from 'utils/date'; | ||
|
||
const FeedbackCard = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to keep the same name used for the file
const FeedbackCard = () => { | |
const StdcmFeedback = () => { |
const handleEmailClick = () => { | ||
const subject = encodeURIComponent(t('mailFeedback.subject')); | ||
|
||
const trainInfo = encodeURIComponent(` | ||
|
||
******** | ||
|
||
${t('mailFeedback.simulationDetails')}: | ||
|
||
${t('consist.tractionEngine')}: ${trainName} | ||
${t('consist.compositionCode')}: ${consistCode} | ||
${t('consist.tonnage')}: ${consistMass} | ||
${t('consist.length')}: ${consistLength} | ||
${t('consist.maxSpeed')}: ${maxSpeed} | ||
|
||
${t('trainPath.origin')}: ${origin} | ||
${t('trainPath.destination')}: ${destination} | ||
${t('departureTime')}: ${departureTime} | ||
`); | ||
const body = `${trainInfo}${t('mailFeedback.body')}`; | ||
|
||
window.location.href = `mailto:[email protected]?subject=${subject}&body=${body}`; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The email content formatting could be simplified:
const handleEmailClick = () => { | |
const subject = encodeURIComponent(t('mailFeedback.subject')); | |
const trainInfo = encodeURIComponent(` | |
******** | |
${t('mailFeedback.simulationDetails')}: | |
${t('consist.tractionEngine')}: ${trainName} | |
${t('consist.compositionCode')}: ${consistCode} | |
${t('consist.tonnage')}: ${consistMass} | |
${t('consist.length')}: ${consistLength} | |
${t('consist.maxSpeed')}: ${maxSpeed} | |
${t('trainPath.origin')}: ${origin} | |
${t('trainPath.destination')}: ${destination} | |
${t('departureTime')}: ${departureTime} | |
`); | |
const body = `${trainInfo}${t('mailFeedback.body')}`; | |
window.location.href = `mailto:[email protected]?subject=${subject}&body=${body}`; | |
}; | |
const handleEmailClick = () => { | |
const subject = encodeURIComponent(t('mailFeedback.subject')); | |
const separator = '********'; | |
const messageContent = ` | |
${separator} | |
${t('mailFeedback.simulationDetails')}: | |
${t('consist.tractionEngine')}: ${trainName} | |
${t('consist.compositionCode')}: ${consistCode} | |
${t('consist.tonnage')}: ${consistMass} | |
${t('consist.length')}: ${consistLength} | |
${t('consist.maxSpeed')}: ${maxSpeed} | |
${t('trainPath.origin')}: ${origin} | |
${t('trainPath.destination')}: ${destination} | |
${t('departureTime')}: ${departureTime} | |
${separator} | |
${t('mailFeedback.body')} | |
${separator}`; |
This:
- Moves formatting out of translation files
- Layout/formatting is managed in the component
@@ -49,6 +50,14 @@ | |||
"anterior": "Indiquer le sillon antérieur", | |||
"posterior": "Indiquer le sillon postérieur" | |||
}, | |||
"mailFeedback": { | |||
"body": "%0A********%0A%0ANous%20vous%20invitons%20à%20nous%20envoyer%20un%20message.%0ADès%20que%20vous%20avez%20un%20gêne%20ou%20une%20remarque,%0Amême%20si%20vous%20n’y%20mettez%20pas%20la%20forme.%0A%0AMerci%20à%20vous%20par%20avance,%0AL’équipe%20du%20projet%20LMR%0A%0A(vous%20pouvez%20effacer%20ce%20message)%0A%0A********", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The translation key contains formatting that should be handled in the component:
This way:
- Translation file only contains content
- Layout/formatting is managed in the component
- Easier to maintain and update translations
"body": "%0A********%0A%0ANous%20vous%20invitons%20à%20nous%20envoyer%20un%20message.%0ADès%20que%20vous%20avez%20un%20gêne%20ou%20une%20remarque,%0Amême%20si%20vous%20n’y%20mettez%20pas%20la%20forme.%0A%0AMerci%20à%20vous%20par%20avance,%0AL’équipe%20du%20projet%20LMR%0A%0A(vous%20pouvez%20effacer%20ce%20message)%0A%0A********", | |
"body": "Nous vous invitons à nous envoyer un message.\nDès que vous avez une gêne ou une remarque,\nmême si vous n'y mettez pas la forme.\n\nMerci à vous par avance,\nL'équipe du projet LMR\n\n(vous pouvez effacer ce message)" |
See the mockup here : https://www.sketch.com/s/15e0909c-f17d-4200-a770-b9fc1154fa7e/a/L4ZxexL
close #11030