feat: add new transports#887
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds new transport equivalents (new modes + moto size split) across the simulator, API documentation, icons, and publicodes extraction tooling, along with dependency bumps to the Publicodes/NosGestesClimat models.
Changes:
- Add new transport entries (camping-car, van, electric scooter, cargo tricycle) and split motorcycles into >250cm³ vs <=250cm³.
- Update transport UI to show the “Carpool” selector for motorcycles, add related i18n keys, and add icons for the new slugs.
- Extend the publicodes extraction script to update
deplacementsfor the new transport modes; bump related dependencies.
Reviewed changes
Copilot reviewed 15 out of 23 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/publicodes/extractTransportValues.ts | New extractor to populate deplacements ECV values for added transports from publicodes. |
| src/utils/Equivalent/values.json | Adds new equivalent slugs and adjusts wording/values for scooter/moto; used for labels/gram values. |
| src/utils/Equivalent/icons.ts | Maps moto-petite to reuse the existing moto icon slug. |
| src/utils/Equivalent/equivalent.ts | Adds “extra info” suffix for moto slugs (<= / > 250 cm³). |
| src/scripts/getPublicodeValues.ts | Extends script to support transport extraction and refactors control flow to a switch. |
| src/providers/ParamProvider.tsx | Adds default carInfos entry for moto. |
| src/providers/locales/fr.json | Adds nested category-simulator.voiture + category-simulator.moto keys and new comparator descriptions. |
| src/providers/locales/es.json | Same i18n additions for Spanish. |
| src/providers/locales/en.json | Same i18n additions for English. |
| src/hooks/useTransportations.tsx | Adds moto-aware equivalent resolution based on stored carInfos. |
| src/data/categories/deplacement.ts | Updates moto ECV values and adds new transport entries (ids 31–35). |
| src/components/outils/transport/Carpool.tsx | Reworks size/engine selects to support moto sizing and uses category-simulator i18n keys. |
| src/components/outils/CategorySimulator.tsx | Enables Carpool UI for moto equivalents as well as voiture. |
| public/icons/veliassistance.svg | Adds icon asset. |
| public/icons/veli.svg | Adds icon asset. |
| public/icons/van.svg | Adds icon asset. |
| public/icons/triporteurelectrique.svg | Adds icon asset. |
| public/icons/scooterelectrique.svg | Adds icon asset. |
| public/icons/campingcar.svg | Adds icon asset. |
| pnpm-lock.yaml | Updates lockfile for bumped dependencies. |
| package.json | Bumps @incubateur-ademe/nosgestesclimat and @incubateur-ademe/publicodes-acv-numerique. |
| app/api/v1/transport/route.ts | Updates Swagger transport id list/documentation to include new modes and moto split. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (3)
src/utils/Equivalent/values.json:512
- La valeur
campingcarest à 0.17 (gCO2e/km), ce qui ne correspond pas aux donnéesdeplacements(0.377193... + 0.11664 = 0.493833 kgCO2e/km, soit ~493.833 g). À corriger pour que values.json reste cohérent avec computeECV(equivalent) * 1000.
"campingcar": {
"category": 4,
"value": 0.17,
"fr": "km en ;camping-car",
"en": "km by ;camper van",
src/utils/Equivalent/values.json:519
- La valeur
scooterelectrique(31.134...) n'est pas cohérente avecdeplacements(0.0207 + 0.0386 = 0.0593 kgCO2e/km, soit ~59.3 g). Il faudrait régénérer / aligner values.json sur computeECV(equivalent) * 1000.
"scooterelectrique": {
"category": 4,
"value": 31.1342469790745,
"fr": "km en ;scooter électrique",
"en": "km by ;electric scooter",
src/utils/Equivalent/values.json:533
- La valeur
vanest à 0.17 (gCO2e/km), maisdeplacementsdonne 0.237146... + 0.08748 = 0.324626 kgCO2e/km, soit ~324.626 g. Il faudrait mettre values.json en cohérence (computeECV * 1000).
"van": {
"category": 4,
"value": 0.17,
"fr": "km en ;van",
"en": "km by ;van",
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
468
to
471
| "value": 214.7, | ||
| "fr": "km en ;moto thermique", | ||
| "en": "km by ;combustion motorcycle", | ||
| "es": "km en ;moto termico" |
Comment on lines
67
to
+71
| const realEquivalent = | ||
| (carInfo && equivalents.find((eq) => eq.slug === `voiture-${carInfo.size}-${carInfo.engine}`)) || | ||
| (carInfo && | ||
| (equivalent.slug.startsWith('voiture') | ||
| ? equivalents.find((eq) => eq.slug === `voiture-${carInfo.size}-${carInfo.engine}`) | ||
| : equivalents.find((eq) => eq.slug === `moto-${carInfo.size}`))) || |
| ? equivalents.find((eq) => eq.slug === `voiture-${carInfo.size}-${carInfo.engine}`) | ||
| : equivalents.find((eq) => eq.slug === `moto-${carInfo.size}`))) || | ||
| equivalent | ||
| console.log((equivalent.slug, carInfo)) |
Comment on lines
+59
to
+60
| <option value='petite'>{t('moto.small')}</option> | ||
| <option value='moyenne'>{t('moto.medium')}</option> |
| covoiturageelectrique: { size: 'compact', engine: 'electrique' }, | ||
| voiturehybride: { size: 'compact', engine: 'hybride' }, | ||
| covoituragehybride: { size: 'compact', engine: 'hybride' }, | ||
| moto: { size: 'medium', engine: 'thermique' }, |
Comment on lines
+331
to
+334
| if (slug.startsWith('moto')) { | ||
| const [moto, size] = slug.split('-') | ||
| return size ? '(<= 250 cm³)' : '(> 250 cm³)' | ||
| } |
| import { livraison } from 'data/categories/livraison' | ||
| import { numeriques } from 'data/categories/numerique' | ||
| import { livraisonData } from 'components/outils/livraison/LivraisonData' | ||
| import { extractTransportValues } from 'src/utils/publicodes/extractTransportValues' |
Comment on lines
+18
to
+22
| case 'numerique': | ||
| extractNumeriqueValues() | ||
| const backupContent = `export const numeriques = ${JSON.stringify(numeriques, null, 2)}` | ||
| const backupPath = path.join(__dirname, '../data/categories/numerique.ts') | ||
| fs.writeFileSync(backupPath, backupContent, 'utf8') |
| "voiturethermique": "Moyenne - Diesel", | ||
| "voitureelectrique": "Moyenne", | ||
| "voiturehybride": "Moyenne - Non rechargeable", | ||
| "moto": "moto de cylindrée supérieure à 250 cm³", |
c7d6a7b to
78dbe26
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.