Skip to content

feat: add new transports#887

Merged
desoindx merged 1 commit into
developfrom
feat/transport
Jun 1, 2026
Merged

feat: add new transports#887
desoindx merged 1 commit into
developfrom
feat/transport

Conversation

@desoindx
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 19, 2026 07:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 deplacements for 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 campingcar est à 0.17 (gCO2e/km), ce qui ne correspond pas aux données deplacements (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 avec deplacements (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 van est à 0.17 (gCO2e/km), mais deplacements donne 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 thread src/utils/Equivalent/values.json Outdated
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}`))) ||
Comment thread src/hooks/useTransportations.tsx Outdated
? 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³)'
}
Comment thread src/scripts/getPublicodeValues.ts Outdated
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')
Comment thread src/providers/locales/fr.json Outdated
"voiturethermique": "Moyenne - Diesel",
"voitureelectrique": "Moyenne",
"voiturehybride": "Moyenne - Non rechargeable",
"moto": "moto de cylindrée supérieure à 250 cm³",
@desoindx desoindx force-pushed the feat/transport branch 5 times, most recently from c7d6a7b to 78dbe26 Compare May 26, 2026 14:29
@desoindx desoindx merged commit 2d15480 into develop Jun 1, 2026
6 checks passed
@desoindx desoindx deleted the feat/transport branch June 1, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants