Skip to content

Commit

Permalink
review from Clémence
Browse files Browse the repository at this point in the history
  • Loading branch information
desoindx committed Nov 25, 2024
1 parent 658a751 commit 535485b
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/components/shareable/overScreens/AlimentationIntegrate.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'

import { useTranslations } from 'next-intl'
import React, { useEffect, useMemo, useState } from 'react'
import { useEffect, useMemo, useState } from 'react'
import useParamContext from 'src/providers/ParamProvider'
import ClipboardBox from 'components/base/ClipboardBox'
import AlimentationListParam from './AlimentationListParam'
Expand All @@ -14,7 +14,7 @@ const AlimentationIntegrate = () => {
const t = useTranslations('alimentation.integrate')
const { theme, language, alimentation: alimentationParams } = useParamContext()

const [hideButtons, setHideButtons] = useState(false)
const [showButtons, setShowButtons] = useState(true)
const [category, setCategory] = useState(alimentationParams.category)
const [customList, setCustomList] = useState(alimentationParams.customList)
const [equivalents, setEquivalents] = useState(alimentationParams.equivalents)
Expand All @@ -25,12 +25,12 @@ const AlimentationIntegrate = () => {

const search = useMemo(() => {
const result = `&theme=${theme}&language=${language}`
const hideButtonsParam = hideButtons ? '&hideButtons=true' : ''
const hideButtonsParam = showButtons ? '' : '&hideButtons=true'
if (customList) {
return `alimentationEquivalents=${equivalents.join(',')}${hideButtonsParam}${result}`
}
return `alimentationCategory=${category}${hideButtonsParam}${result}`
}, [category, customList, equivalents, hideButtons, theme, language])
}, [category, customList, equivalents, showButtons, theme, language])

return (
<>
Expand Down Expand Up @@ -63,7 +63,7 @@ const AlimentationIntegrate = () => {
slug='hideButtons'
integration
visible
param={{ value: hideButtons, setter: setHideButtons } as CustomParamValue}
param={{ value: showButtons, setter: setShowButtons } as CustomParamValue}
/>
</fieldset>
</form>
Expand Down
4 changes: 2 additions & 2 deletions src/data/categories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ export const categories: Category[] = [
synonyms: ['manger', 'alimenter'],
sources: [
{
label: 'Base Empreinte ADEME',
href: 'https://base-empreinte.ademe.fr/donnees/jeu-donnees',
label: 'Agribalyse 3.1.1 - Mise à jour le 10/08/2023',
href: 'https://agribalyse.ademe.fr/app',
},
],
description: 'Pour aborder l’impact carbone de l’alimentation',
Expand Down
36 changes: 36 additions & 0 deletions src/data/categories/repas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,61 @@ export const repas = [
unit: 'repas',
category: 2,
total: 7.26,
sources: [
{
label: 'Base Empreinte ADEME',
href: 'https://base-empreinte.ademe.fr/donnees/jeu-donnees',
},
],
},
{
id: 20683,
slug: 'repasvegetarien',
unit: 'repas',
category: 2,
total: 0.51,
sources: [
{
label: 'Base Empreinte ADEME',
href: 'https://base-empreinte.ademe.fr/donnees/jeu-donnees',
},
],
},
{
slug: 'repasvegetalien',
unit: 'repas',
category: 2,
total: 0.39,
sources: [
{
label: 'Base Empreinte ADEME',
href: 'https://base-empreinte.ademe.fr/donnees/jeu-donnees',
},
],
},
{
slug: 'repasavecdupoissonblanc',
unit: 'repas',
category: 2,
total: 1.98,
sources: [
{
label: 'Base Empreinte ADEME',
href: 'https://base-empreinte.ademe.fr/donnees/jeu-donnees',
},
],
},
{
slug: 'repasavecdupoissongras',
unit: 'repas',
category: 2,
total: 1.11,
sources: [
{
label: 'Base Empreinte ADEME',
href: 'https://base-empreinte.ademe.fr/donnees/jeu-donnees',
},
],
},
{
id: 20688,
Expand All @@ -39,5 +69,11 @@ export const repas = [
unit: 'repas',
category: 2,
total: 1.58,
sources: [
{
label: 'Base Empreinte ADEME',
href: 'https://base-empreinte.ademe.fr/donnees/jeu-donnees',
},
],
},
]
2 changes: 1 addition & 1 deletion src/providers/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@
"poissons": "Fish and seafood",
"laitier": "Eggs and dairy products",
"cereales": "Cereals and legumes",
"autres": "Prepared dishes",
"plats": "Prepared dishes",
"encas": "Snacks",
"fruits": "Fruits and vegetables",
"boucherie": "Butchery",
Expand Down
2 changes: 1 addition & 1 deletion src/providers/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@
"poissons": "Pescados y mariscos",
"laitier": "Huevos y productos lácteos",
"cereales": "Cereales y legumbres",
"autres": "Platos preparados",
"plats": "Platos preparados",
"encas": "Aperitivos",
"fruits": "Frutas y verduras",
"boucherie": "Carnicería",
Expand Down
2 changes: 1 addition & 1 deletion src/providers/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@
"poissons": "Poissons et fruits de mer",
"laitier": "Oeufs et produits laitiers",
"cereales": "Céréales et légumineuses",
"autres": "Plats préparés",
"plats": "Plats préparés",
"encas": "En-cas",
"fruits": "Fruits et légumes",
"boucherie": "Boucherie",
Expand Down
2 changes: 1 addition & 1 deletion src/utils/alimentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const slugByCategory: Record<AlimentationCategories, { name: string; equivalents
equivalents: ['quinoa', 'riz', 'pates', 'ble', 'boulgour', 'poischiches', 'haricotsrouges', 'lentilles', 'mais'],
},
{
name: 'autres',
name: 'plats',
logos: ['cheeseburger', 'sushis'],
equivalents: ['cheeseburger', 'kebab', 'burgerpoulet', 'pizza', 'sushis', 'burgervegetarien', 'frites', 'tofu'],
},
Expand Down

0 comments on commit 535485b

Please sign in to comment.