diff --git a/messages/en/components.json b/messages/en/components.json index f1a978f47..6acb05e80 100644 --- a/messages/en/components.json +++ b/messages/en/components.json @@ -16,6 +16,11 @@ "chart": { "loading": "Loading data.." }, + "calculator": { + "intro": "Here are the impacts of the salmon industry around the world since you opened this web page.", + "seconds": "seconds", + "second": "second" + }, "join": { "title": "Be the change.", "intro": "There are alternatives to salmon in our way of eating, selling, and producing.", diff --git a/messages/en/layout.json b/messages/en/layout.json index 6a9be4fdc..f9e9ff768 100644 --- a/messages/en/layout.json +++ b/messages/en/layout.json @@ -1,5 +1,6 @@ { "layout": { + "top": "Back to top", "nav": { "title": "main", "story": "Story", diff --git a/messages/en/pages/dashboard.json b/messages/en/pages/dashboard.json index 4a170ff55..35f6770cf 100644 --- a/messages/en/pages/dashboard.json +++ b/messages/en/pages/dashboard.json @@ -1,5 +1,73 @@ { "dashboard": { - "title": "Dashboard" + "meta": { + "title": "Dashboard" + }, + "title": "The numbers behind the story", + "summary": { + "intro": { + "title": "Intro", + "sublinks": { + "salmon-collapse-block": "Wild Altantic salmon collapse", + "hyper-growth-block": "Hyper-growth in salmon farming", + "top-10-block": "Main countries producing farmed salmon", + "intro-consumption-block": "Consumption" + } + }, + "company": { + "title": "Companies", + "sublinks": { + "top-comp-block": "Main producers of open-net salmon", + "top-land-block": "The new threat: on land-based aquaculture farms", + "future-land-based-block": "The future of land-based aquaculture farms", + "companies-consumption-block": "Consumption" + } + }, + "biodiversity": { + "title": "Biodiversity", + "sublinks": { + "deforestation-block": "Deforestation", + "escapes-rates-block": "Escapes" + } + }, + "health": { + "title": "Human health", + "sublinks": { + "antibiotic-conso-block": "Antibiotic consumption", + "microplastics-block": "Microplastic" + } + }, + "animals": { + "title": "Animal welfare", + "sublinks": { + "stress-onshore-block": "Stress in land-based facilities", + "mortality-rates-block": "Mortality rate" + } + }, + "climate": { + "title": "Climate", + "sublinks": { + "carbon-bomb-block": "Carbon impact" + } + }, + "social": { + "title": "Social", + "sublinks": { + "social-carbon-block": "Carbon impact" + } + }, + "alternative": { + "title": "Alternatives", + "sublinks": { + "alternatives-block": "Nutrition matrix" + } + } + }, + "calculator": { + "salmon": "slaughtered salmon", + "fish": "forage fish caught to feed salmon", + "companies": "tonnes of CO2 emitted by industry", + "money": "Euros of turnover for market leading companies" + } } } diff --git a/messages/fr/components.json b/messages/fr/components.json index e3fc6aa87..5a017d066 100644 --- a/messages/fr/components.json +++ b/messages/fr/components.json @@ -16,6 +16,11 @@ "chart": { "loading": "Chargement des données en cours..." }, + "calculator": { + "intro": "Voici les impacts de l'industrie du saumon dans le monde depuis que vous avez ouvert cette page web.", + "seconds": "secondes", + "second": "seconde" + }, "join": { "title": "Be the change.", "intro": "Il existe des alternatives au saumon dans notre manière de manger, de vendre et de produire.", diff --git a/messages/fr/layout.json b/messages/fr/layout.json index 8778d516c..d4632ee3c 100644 --- a/messages/fr/layout.json +++ b/messages/fr/layout.json @@ -1,5 +1,6 @@ { "layout": { + "top": "Haut de page", "nav": { "title": "principale", "story": "Story", diff --git a/messages/fr/pages/dashboard.json b/messages/fr/pages/dashboard.json index 4a170ff55..6faaf4a62 100644 --- a/messages/fr/pages/dashboard.json +++ b/messages/fr/pages/dashboard.json @@ -1,5 +1,73 @@ { "dashboard": { - "title": "Dashboard" + "meta": { + "title": "Dashboard" + }, + "title": "Les chiffres derrière l’histoire", + "summary": { + "intro": { + "title": "Intro", + "sublinks": { + "salmon-collapse-block": "Effondrement du saumon sauvage de l'Atlantique", + "hyper-growth-block": "Hyper-croissance de l’élevage du saumon", + "top-10-block": "Principaux pays producteurs de saumon d'élevage", + "intro-consumption-block": "Consommation" + } + }, + "company": { + "title": "Entreprises", + "sublinks": { + "top-comp-block": "Principaux producteurs de saumon en filet ouvert", + "top-land-block": "La nouvelle menace : sur fermes aquacoles terrestres", + "future-land-based-block": "Le futur des fermes aquacoles terrestres", + "companies-consumption-block": "Consommation" + } + }, + "biodiversity": { + "title": "Biodiversité", + "sublinks": { + "deforestation-block": "Déforestation", + "escapes-rates-block": "Les évasions" + } + }, + "health": { + "title": "Human health", + "sublinks": { + "antibiotic-conso-block": "Consommation d'antibiotiques", + "microplastics-block": "Microplastique" + } + }, + "animals": { + "title": "Bien être animal", + "sublinks": { + "stress-onshore-block": "Densité / stress dans usine à terre", + "mortality-rates-block": "Taux de mortalité" + } + }, + "climate": { + "title": "Climat", + "sublinks": { + "carbon-bomb-block": "Impact carbone" + } + }, + "social": { + "title": "Social", + "sublinks": { + "social-carbon-block": "Impact carbone" + } + }, + "alternative": { + "title": "Alternatives", + "sublinks": { + "alternatives-block": "Matrice de nutrition" + } + } + }, + "calculator": { + "salmon": "saumons abattus", + "fish": "poissons fourrages pêchés pour alimenter les saumons", + "companies": "tonnes de CO2 émis par l'industrie", + "money": "Euros de chiffre d'affaire pour les entreprises leadeurs du marché" + } } } diff --git a/src/app/[locale]/dashboard/dashboard.tsx b/src/app/[locale]/dashboard/dashboard.tsx index 480f6ec6a..eff6c81d7 100644 --- a/src/app/[locale]/dashboard/dashboard.tsx +++ b/src/app/[locale]/dashboard/dashboard.tsx @@ -12,153 +12,152 @@ import { SummaryLinksProps } from "@/components/Summary"; import TitleBlock from "@/components/TitleBlock"; import { fetchData } from "@/pages/api/chart"; +import { useTranslations } from "next-intl"; const Chart = dynamic(() => import("@/components/Chart"), { ssr: false, }); -const summary: SummaryLinksProps = [ - { - id: "intro", - title: "Intro", - sublinks: [ - { - label: "Effondrement du saumon sauvage de l'Atlantique", - targetId: "salmon-collapse-block", - }, - { - label: "Hyper-croissance de l’élevage du saumon", - targetId: "hyper-growth-block", - }, - { - label: "Principaux pays producteurs de saumon d'élevage", - targetId: "top-10-block", - }, - { - label: "Consommation", - targetId: "intro-consumption-block", - }, - ], - }, - { - id: "company", - title: "Entreprises", - sublinks: [ - { - label: "Principaux producteurs de saumon en filet ouvert", - targetId: "top-comp-block", - }, - { - label: "La nouvelle menace: sur fermes aquacoles terrestres", - targetId: "top-land-block", - }, - { - label: "Le futur des fermes aquacoles terrestres", - targetId: "future-land-based-block", - }, - { - label: "Consommation", - targetId: "companies-consumption-block", - }, - ], - }, - { - id: "biondiversity", - title: "Biodiversité", - sublinks: [ - { - label: "Deforestation", - targetId: "deforestation-block", - }, - { - label: "Les évasions", - targetId: "escapes-rates-block", - }, - ], - }, - { - id: "health", - title: "Human health", - sublinks: [ - { - label: "Consommation d'antibiotiques", - targetId: "antibiotic-conso-block", - }, - { - label: "Microplastique", - targetId: "microplastics-block", - }, - ], - }, - { - id: "animals", - title: "Bien être animal", - sublinks: [ - { - label: "Densité / stress dans usine à terre", - targetId: "stress-onshore-block", - }, - { - label: "Taux de mortalité", - targetId: "mortality-rates-block", - }, - ], - }, - { - id: "climate", - title: "Climat", - sublinks: [ - { - label: "Impact carbone", - targetId: "carbon-bomb-block", - }, - ], - }, - { - id: "social", - title: "Social", - sublinks: [ - { - label: "Impact carbone", - targetId: "social-carbon-block", - }, - ], - }, - { - id: "alternative", - title: "Alternatives", - sublinks: [ - { - label: "Matrice de nutrition", - targetId: "alternatives-block", - }, - ], - }, -]; - const Dashboard = () => { + const t = useTranslations("dashboard"); + const summary: SummaryLinksProps = [ + { + id: "intro", + title: t("summary.intro.title"), + sublinks: [ + { + label: t("summary.intro.sublinks.salmon-collapse-block"), + targetId: "salmon-collapse-block", + }, + { + label: t("summary.intro.sublinks.hyper-growth-block"), + targetId: "hyper-growth-block", + }, + { + label: t("summary.intro.sublinks.top-10-block"), + targetId: "top-10-block", + }, + /*{ + label: t("summary.intro.sublinks.intro-consumption-block"), + targetId: "intro-consumption-block", + },*/ + ], + }, + { + id: "company", + title: t("summary.company.title"), + sublinks: [ + { + label: t("summary.company.sublinks.top-comp-block"), + targetId: "top-comp-block", + }, + { + label: t("summary.company.sublinks.top-land-block"), + targetId: "top-land-block", + }, + { + label: t("summary.company.sublinks.future-land-based-block"), + targetId: "future-land-based-block", + }, + /*{ + label: t("summary.company.sublinks.companies-consumption-block"), + targetId: "companies-consumption-block", + },*/ + ], + }, + { + id: "biodiversity", + title: t("summary.biodiversity.title"), + sublinks: [ + { + label: t("summary.biodiversity.sublinks.deforestation-block"), + targetId: "deforestation-block", + }, + { + label: t("summary.biodiversity.sublinks.escapes-rates-block"), + targetId: "escapes-rates-block", + }, + ], + }, + { + id: "health", + title: t("summary.health.title"), + sublinks: [ + { + label: t("summary.health.sublinks.antibiotic-conso-block"), + targetId: "antibiotic-conso-block", + }, + { + label: t("summary.health.sublinks.microplastics-block"), + targetId: "microplastics-block", + }, + ], + }, + { + id: "animals", + title: t("summary.animals.title"), + sublinks: [ + { + label: t("summary.animals.sublinks.stress-onshore-block"), + targetId: "stress-onshore-block", + }, + { + label: t("summary.animals.sublinks.mortality-rates-block"), + targetId: "mortality-rates-block", + }, + ], + }, + { + id: "climate", + title: t("summary.climate.title"), + sublinks: [ + { + label: t("summary.climate.sublinks.carbon-bomb-block"), + targetId: "carbon-bomb-block", + }, + ], + }, + { + id: "social", + title: t("summary.social.title"), + sublinks: [ + { + label: t("summary.social.sublinks.social-carbon-block"), + targetId: "social-carbon-block", + }, + ], + }, + { + id: "alternative", + title: t("summary.alternative.title"), + sublinks: [ + { + label: t("summary.alternative.sublinks.alternatives-block"), + targetId: "alternatives-block", + }, + ], + }, + ]; + return ( <> - +
- + @@ -166,37 +165,37 @@ const Dashboard = () => {
- + {/* */}
- +
- +
- +
- +
- +
@@ -252,16 +251,18 @@ const TopCountriesSection = () => { ); }; -// const SalmonConsumptionSection = () => { -// return ( -// -// ); -// }; +/* +const SalmonConsumptionSection = () => { + return ( + + ); +}; +*/ const MainProductionSection = () => { return ( @@ -313,7 +314,7 @@ const LandPlantsSection = () => { hasChart />
@@ -383,18 +384,20 @@ const LandPlantsSection = () => { ); }; -// const SalmonConsumptionBisSection = () => { -// return ( -// -// ); -// }; +/* +const SalmonConsumptionBisSection = () => { + return ( + + ); +}; +*/ const DeforestationSection = () => { return ( diff --git a/src/app/[locale]/dashboard/page.tsx b/src/app/[locale]/dashboard/page.tsx index bc96b760a..21f9b1da2 100644 --- a/src/app/[locale]/dashboard/page.tsx +++ b/src/app/[locale]/dashboard/page.tsx @@ -14,7 +14,7 @@ export async function generateMetadata({ const t = await getTranslations({ locale, namespace: "dashboard" }); return { - title: t("title"), + title: t("meta.title"), }; } diff --git a/src/app/[locale]/layout.tsx b/src/app/[locale]/layout.tsx index 5d9ec79a9..1a6ba3c32 100644 --- a/src/app/[locale]/layout.tsx +++ b/src/app/[locale]/layout.tsx @@ -4,6 +4,7 @@ import Image from "next/image"; import { NextIntlClientProvider } from "next-intl"; import { getMessages } from "next-intl/server"; import { getTranslations } from "next-intl/server"; +import { useTranslations } from "next-intl"; import * as React from "react"; const barlow = Barlow_Condensed({ @@ -74,6 +75,7 @@ export default async function LocaleLayout({ params: { locale: string }; }) { const messages = await getMessages(); + const t = await getTranslations({ locale, namespace: "layout" }); return ( Haut de page { const [seconds, setSeconds] = useState(0); + const locale = useLocale(); + const t = useTranslations("components"); useEffect(() => { const timer = setInterval(() => { @@ -32,23 +35,21 @@ const Calculator = ({ data, className, ...rest }: CalculatorProps) => { )} {...rest} > -

- Voici les impacts de l'industrie du saumon dans le monde depuis que vous - avez ouvert cette page web. -

+

{t("calculator.intro")}

- {seconds} {seconds > 1 ? "secondes" : "seconde"} + {seconds}{" "} + {seconds > 1 ? t("calculator.seconds") : t("calculator.second")}
    {data.map((element, key) => (
  • - {new Intl.NumberFormat("fr").format( + {new Intl.NumberFormat(locale).format( element.multiplicator * (seconds + 1), )} - {element.label} + {element.label}
  • ))}
diff --git a/src/components/DashboardSection.tsx b/src/components/DashboardSection.tsx index 716f9a571..fea607f98 100644 --- a/src/components/DashboardSection.tsx +++ b/src/components/DashboardSection.tsx @@ -110,7 +110,7 @@ const DashboardSection = ({

{title}

-

{mainContent}

+

{mainContent}

{content}

{cta &&
{cta}
} @@ -129,7 +129,7 @@ const DashboardSection = ({ {hasChart ? : null} {meta ? ( -
    +
      {Object.keys(meta).map((data, key) => (
    • diff --git a/src/components/TitleBlock.tsx b/src/components/TitleBlock.tsx index 412f7668f..9af19890f 100644 --- a/src/components/TitleBlock.tsx +++ b/src/components/TitleBlock.tsx @@ -19,10 +19,7 @@ const TitleBlock = ({

      {title}