Skip to content
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

♻️ Homepage improvements #779

Merged
merged 78 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from 75 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
4604555
:sparkles: Create layout components + hero
bjlaa Oct 28, 2024
1cf649c
:sparkles: Add WhatItIs component
bjlaa Oct 28, 2024
f6428ce
:sparkles: Add WhatDoWeMeasure component
bjlaa Oct 28, 2024
0e8a135
:sparkles: Add the DidYouKnowSlider component
bjlaa Oct 28, 2024
7b300f7
:sparkles: Add DailyGesture component
bjlaa Oct 28, 2024
b91d218
:sparkles: Add UnderstandToAct component
bjlaa Oct 28, 2024
54d5cc3
:sparkles: Add motivation section
bjlaa Oct 28, 2024
28de45b
:sparkles: Add FAQ section
bjlaa Oct 28, 2024
af8a01a
:lipstick: Center text
bjlaa Oct 28, 2024
938bf49
:recycle: Create sub components
bjlaa Oct 29, 2024
eaaa710
:lipstick: Improve styling
bjlaa Oct 29, 2024
4337735
:sparkles: Improve Gestures logic
bjlaa Oct 29, 2024
5829b99
:globe_with_meridians: Add translations
bjlaa Oct 29, 2024
33063a5
:bug: Fix HTML / React errors
bjlaa Oct 29, 2024
98bacb5
:lipstick: Slights style adjustments
bjlaa Oct 29, 2024
abca890
:bug: Fix double title
bjlaa Oct 29, 2024
eb69d79
:lipstick: Improve mobile style
bjlaa Oct 29, 2024
de3e0c8
:globe_with_meridians: Add translations
bjlaa Oct 29, 2024
eeb6688
:lipstick: Improve font sizes
bjlaa Oct 29, 2024
2c77d47
:speech_balloon: Modify text
bjlaa Oct 30, 2024
c908486
:speech_balloon: Modify text
bjlaa Oct 30, 2024
bd41490
:sparkles: Add new home page hero
bjlaa Oct 31, 2024
d315411
:lipstick: Mobile version
bjlaa Oct 31, 2024
5a7ac35
:sparkles: Add two footprints section
bjlaa Oct 31, 2024
1fedd98
:sparkles: Add did you know section
bjlaa Oct 31, 2024
d5aeb81
:sparkles: Add mobilise block
bjlaa Oct 31, 2024
f3bc3cc
:sparkles: Add the decrypt challenges section
bjlaa Oct 31, 2024
3048474
:sparkles: Add collectively commit section
bjlaa Oct 31, 2024
4d7c0ac
:sparkles: Add ModelInfo, clean unused files
bjlaa Oct 31, 2024
9a3bcb5
:sparkles: Add sepakers
bjlaa Oct 31, 2024
327fef7
:recycle: Fix typing
bjlaa Oct 31, 2024
85293af
:sparkles: Add InteractiveIllustration component + dots
bjlaa Oct 31, 2024
413d4f1
:sparkles: Create animation for dots
bjlaa Oct 31, 2024
9020042
:sparkles: Add floating elements
bjlaa Oct 31, 2024
5e2bc2c
:sparkles: Handle mobile interaction
bjlaa Oct 31, 2024
843c8fa
:lipstick: Styling
bjlaa Oct 31, 2024
ef63ccc
:bug: Fix wrong scores being displayed
bjlaa Oct 31, 2024
f499f07
:recycle: Update missing translations
bjlaa Nov 4, 2024
1795914
:recycle: Minor fixes and improvements
bjlaa Nov 4, 2024
e478f48
Merge branch 'NGC-1318-1' into NGC-1226
bjlaa Nov 4, 2024
29eee45
:recycle: Use DynamicCTAButton and add missing translations
bjlaa Nov 4, 2024
f01b28a
:recycle: Fixes after review
bjlaa Nov 4, 2024
41caf78
:sparkles: Add part of the new illustrations
bjlaa Nov 5, 2024
04c832d
:lipstick: Modify padding
bjlaa Nov 5, 2024
2df780a
Merge branch 'NGC-1318-1' into NGC-1226
bjlaa Nov 5, 2024
909f626
:sparkles: Add new illustration
bjlaa Nov 5, 2024
68e9c89
Merge branch 'NGC-1318-1' into NGC-1226
bjlaa Nov 5, 2024
38d37d4
:sparkles: Update illustrations
bjlaa Nov 5, 2024
4aaa632
:lipstick: Styling improvements
bjlaa Nov 5, 2024
215331b
:speech_balloon: Remove unused translations
bjlaa Nov 5, 2024
b64a755
:speech_balloon: Fix typo
bjlaa Nov 5, 2024
26c2120
Merge branch 'preprod' into NGC-1318-1
bjlaa Nov 5, 2024
5169693
:recycle: Fixes after review
bjlaa Nov 6, 2024
5776685
:lipstick: Improve mobile styling
bjlaa Nov 12, 2024
6d6abaa
Merge branch 'preprod' into NGC-1318-1
bjlaa Nov 12, 2024
73dc5d9
Merge branch 'NGC-1318-1' into NGC-1226
bjlaa Nov 12, 2024
8bcf063
:lipstick: Fix colorline style
bjlaa Nov 13, 2024
e211fc3
:recycle: Use h3
bjlaa Nov 13, 2024
5364c6b
Merge branch 'NGC-1318-1' into NGC-1226
bjlaa Nov 13, 2024
18e7fe5
:lipstick: Improve mobile styling
bjlaa Nov 13, 2024
2e7f59a
♻️ Fixes after review
bjlaa Nov 18, 2024
5e620dc
♻️ Add missing translations
bjlaa Nov 18, 2024
b041577
Merge branch 'NGC-1318-1' into NGC-1226
bjlaa Nov 18, 2024
4ef0e20
♻️ Improvements after qa
bjlaa Nov 18, 2024
9fe4c14
✨ Add JSONLD
bjlaa Nov 18, 2024
bb5b7b3
Merge branch 'preprod' into NGC-1226
bjlaa Nov 19, 2024
ded2faa
:sparkles: Rename image files + add alt attributes
bjlaa Nov 19, 2024
68dddd1
🐛 Fix lint error + increase pt
bjlaa Nov 19, 2024
2f17dd9
:recycle: Rename image files
bjlaa Nov 19, 2024
23c1fbe
♻️ Improvements on the main LP after QA
bjlaa Nov 27, 2024
3d7d290
Merge branch 'preprod' into NGC-1226
bjlaa Nov 27, 2024
adafe21
✨ Add localized illustrations
bjlaa Nov 27, 2024
242bd7d
♻️ Remove disabling ssr
bjlaa Nov 27, 2024
fac2772
💄 Improve tutorial style on iframe mode
bjlaa Nov 27, 2024
acd2aa7
💄 Remove useless negative space above and below tutorial page
bjlaa Nov 27, 2024
4a0ff19
💬 Add missing translations
bjlaa Dec 2, 2024
a51827e
Merge branch 'preprod' into NGC-1226
bjlaa Dec 2, 2024
61765e9
Merge branch 'preprod' into NGC-1226
bjlaa Dec 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions src/app/(simulation)/tutoriel/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export async function generateMetadata() {
export default async function Tutoriel() {
return (
<ContentLarge>
<div className="mx-auto mt-8 flex h-screen max-w-3xl flex-col overflow-auto md:mt-12">
<div className="mx-auto flex h-screen max-w-3xl flex-col overflow-auto">
<Title
data-cypress-id="tutoriel-title"
className="text-lg md:text-2xl"
Expand All @@ -50,9 +50,10 @@ export default async function Tutoriel() {

<AutresQuestions />

{/* Check if body has the "iframe-mode" class name and if so add the static class to the footer */}
<div
className={twMerge(
'fixed bottom-0 left-0 right-0 z-50 border-t-2 border-primary-200 bg-gray-100 py-3'
'tutorial-footer fixed bottom-0 left-0 right-0 z-50 border-t-2 border-primary-200 bg-gray-100 py-3'
)}>
<div
className={twMerge(
Expand Down
2 changes: 1 addition & 1 deletion src/app/_components/CollectivelyCommit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default async function CollectivelyCommit() {
<Trans>
Chez Nos Gestes Climat, nous croyons au pouvoir de{' '}
<strong className="text-primary-600">l’action collective</strong>{' '}
pour relever les défis environnementaux. Notre mission est de
pour relever les défis environnementaux. Notre mission est de{' '}
<strong className="text-primary-600">sensibiliser</strong> et
d’accompagner chacun, citoyens, entreprises et collectivités, à
mieux comprendre son empreinte écologique, carbone ou eau,{' '}
Expand Down
4 changes: 2 additions & 2 deletions src/app/_components/Mobilise.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ export default async function Mobilise() {
<div className="flex flex-col items-center justify-between gap-6 md:flex-row md:gap-24">
<div className="py-14">
<Image
src="/images/illustrations/reflechir-impacts-de-son-empreinte.svg"
src="/images/illustrations/reflechir-impacts-de-son-empreinte-en-entreprise.svg"
alt={t(
'Un groupe de personnes en train de réfléchir aux impacts de leur empreinte carbone et eau'
'un groupe de personnes en train de réfléchir à leurs impacts et leur bilan carbone et eau'
)}
width={500}
height={500}
Expand Down
2 changes: 1 addition & 1 deletion src/app/_components/ModelInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function ModelInfo() {
l’Agence de l’Environnement et de la Maîtrise de l’Énergie
</strong>{' '}
dans le calculateur de Nos Gestes Climat : données,
perspectives,
perspectives, leviers d'action.
</Trans>
}
link={{
Expand Down
11 changes: 6 additions & 5 deletions src/app/_components/Partners.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Link from '@/components/Link'
import Ademe from '@/components/images/partners/Ademe'
import Marianne from '@/components/images/partners/Marianne'
import { getServerTranslation } from '@/helpers/getServerTranslation'
Expand All @@ -11,18 +10,20 @@ export default async function Partners() {
<div className="flex justify-center md:-mt-10">
<div className="relative flex items-center justify-center gap-6 py-6 md:gap-8 md:px-24 md:py-10">
<Marianne className="h-auto w-12 md:w-auto" />
<Link href="https://ademe.fr" target="_blank">

<div>
<Ademe className="h-auto w-10 md:w-auto" />
</Link>
<Link href="https://abc-transitionbascarbone.fr" target="_blank">
</div>

<div>
<Image
src="/images/misc/logo-abc-web.webp"
alt={t("Logo de l'Association pour la transition Bas Carbone")}
width="90"
height="30"
className="h-auto w-20"
/>
</Link>
</div>
</div>
</div>
)
Expand Down
68 changes: 47 additions & 21 deletions src/app/_components/TwoFootprints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,53 @@ import Link from '@/components/Link'
import Trans from '@/components/translation/Trans'
import ColorLine from '@/design-system/layout/ColorLine'
import Separator from '@/design-system/layout/Separator'
import { getServerTranslation } from '@/helpers/getServerTranslation'
import dynamic from 'next/dynamic'
import Image from 'next/image'

const TwoGraphsIllustration = dynamic(
() => import('./twoFootprints/LocalizedTwoGraphIllustration'),
{
loading: () => (
<Image
src="/images/misc/graphiques-empreinte-carbone-eau-fr.png"
className="hidden md:block"
alt="Deux représentations graphiques de l'empreinte carbone et eau"
width={600}
height={800}
/>
),
}
)

const CarbonGraphIllustration = dynamic(
() => import('./twoFootprints/LocalizedCarbonGraphIllustration'),
{
loading: () => (
<Image
src="/images/misc/graphique-empreinte-carbone.png"
alt="Graphique de l'empreinte carbone"
width={300}
height={300}
/>
),
}
)

const WaterGraphIllustration = dynamic(
() => import('./twoFootprints/LocalizedWaterGraphIllustration'),
{
loading: () => (
<Image
src="/images/misc/graphique-empreinte-eau.png"
alt="Graphique de l'empreinte eau"
width={300}
height={300}
/>
),
}
)

export default async function TwoFootprints() {
const { t } = await getServerTranslation()
return (
<div className="my-16 flex flex-col items-center px-4 md:mx-auto md:my-20 md:max-w-5xl">
<div className="relative mb-16 pb-4 md:mb-20">
Expand All @@ -17,25 +59,14 @@ export default async function TwoFootprints() {
</div>

{/* Displayed on desktop only */}
<Image
src="/images/misc/graphiques-empreinte-carbone-eau.png"
className="hidden md:block"
alt={t("Deux représentations graphiques de l'empreinte carbone et eau")}
width={600}
height={800}
/>
<TwoGraphsIllustration />

<div className="flex flex-col gap-16 md:flex-row md:gap-8">
<div className="flex flex-col">
<div className="flex flex-col">
{/* Displayed on mobile only */}
<div className="-mb-10 flex justify-center md:hidden">
<Image
src="/images/misc/graphique-empreinte-carbone.png"
alt=""
width={300}
height={300}
/>
<CarbonGraphIllustration />
</div>

<h3 className="mb-0 text-xl md:text-2xl">
Expand Down Expand Up @@ -66,12 +97,7 @@ export default async function TwoFootprints() {
<div className="flex flex-col">
{/* Displayed on mobile only */}
<div className="-mb-10 flex justify-center md:hidden">
<Image
src="/images/misc/graphique-empreinte-eau.png"
alt=""
width={300}
height={300}
/>
<WaterGraphIllustration />
</div>

<h3 className="mb-0 text-xl md:text-2xl">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { trackingIframe } from '@/constants/tracking/misc'
import { useIsClient } from '@/hooks/useIsClient'
import { getIsIframe } from '@/utils/getIsIframe'
import { trackEvent } from '@/utils/matomo/trackEvent'
import type { PropsWithChildren} from 'react';
import type { PropsWithChildren } from 'react'
import { createContext, useEffect, useState } from 'react'

export const IframeOptionsContext = createContext<{
Expand Down Expand Up @@ -81,6 +81,13 @@ export const IframeOptionsProvider = ({ children }: PropsWithChildren) => {
setIframeLang(urlParams.get('lang'))
}, [isIframe])

useEffect(() => {
if (isIframe) {
// Add class to body to modify the style of the page on iframe mode
document.body.classList.add('iframe-mode')
}
}, [isIframe])

useEffect(() => {
if (isIframeOnlySimulation) {
// Add class to body that hides the header and the footer
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use client'

import { useClientTranslation } from '@/hooks/useClientTranslation'
import { useLocale } from '@/hooks/useLocale'
import Image from 'next/image'

export default function LocalizedCarbonGraphIllustration() {
const locale = useLocale()
const { t } = useClientTranslation()

return (
<Image
src={`/images/misc/graphique-empreinte-carbone_${locale}.png`}
alt={t("Graphique de l'empreinte carbone")}
width={300}
height={300}
/>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use client'

import { useClientTranslation } from '@/hooks/useClientTranslation'
import { useLocale } from '@/hooks/useLocale'
import Image from 'next/image'

export default function LocalizedTwoGraphsIllustration() {
const locale = useLocale()
const { t } = useClientTranslation()

return (
<Image
src={`/images/misc/graphiques-empreinte-carbone-eau_${locale}.png`}
className="hidden md:block"
alt={t("Deux représentations graphiques de l'empreinte carbone et eau")}
width={600}
height={800}
/>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use client'

import { useClientTranslation } from '@/hooks/useClientTranslation'
import { useLocale } from '@/hooks/useLocale'
import Image from 'next/image'

export default function LocalizedCarbonGraphIllustration() {
const locale = useLocale()
const { t } = useClientTranslation()

return (
<Image
src={`/images/misc/graphique-empreinte-eau_${locale}.png`}
alt={t("Graphique de l'empreinte eau")}
width={300}
height={300}
/>
)
}
20 changes: 16 additions & 4 deletions src/app/documentation/_components/DocumentationLanding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useRules } from '@/hooks/useRules'

import Link from '@/components/Link'
import LightBulbIcon from '@/components/icons/LightBulbIcon'
import SquareImageContainer from '@/components/images/SquareImageContainer'
import { useClientTranslation } from '@/hooks/useClientTranslation'
import type { DottedName } from '@incubateur-ademe/nosgestesclimat'
import Image from 'next/image'
Expand Down Expand Up @@ -42,10 +43,9 @@ export default function DocumentationLanding() {

return (
<div className="mt-4">
<Title title={<Trans>Documentation</Trans>} />

<div className="flex flex-wrap gap-8 md:flex-nowrap">
<div>
<Title title={<Trans>Documentation</Trans>} />
<p>
<Trans>
Le simulateur Nos Gestes Climat est basé sur le modèle de calcul
Expand All @@ -67,16 +67,28 @@ export default function DocumentationLanding() {
</Link>
</div>
</div>

{/* Displayed on mobile only */}
<Image
className="-mt-8 ml-auto w-48 md:-mt-16 md:w-full"
className="ml-auto h-auto w-48 md:hidden md:w-full"
src="/images/illustrations/girl-reading-newspaper.png"
width="400"
height="300"
alt={t(
'Un femme lisant le journal au coin du feu avec un chien assoupi.'
)}
/>
{/* Displayed on desktop only */}
<SquareImageContainer className="hidden max-w-96 md:flex">
<Image
className="ml-auto h-auto w-48 md:w-full"
src="/images/illustrations/girl-reading-newspaper.png"
width="400"
height="300"
alt={t(
'Un femme lisant le journal au coin du feu avec un chien assoupi.'
)}
/>
</SquareImageContainer>
paulsouche marked this conversation as resolved.
Show resolved Hide resolved
</div>

<SearchBar rules={rules} />
Expand Down
2 changes: 1 addition & 1 deletion src/app/empreinte-eau/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default async function WaterFootprintLandingPage() {
{
'@context': 'https://schema.org',
'@type': 'Organization',
url: 'https://nosgestesclimat.fr/',
url: 'https://nosgestesclimat.fr',
name: 'Nos Gestes Climat',
logo: 'https://nosgestesclimat.fr/_next/image?url=%2Fimages%2Fmisc%2Fpetit-logo%403x.png&w=640&q=75',
},
Expand Down
3 changes: 1 addition & 2 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import MainLayoutProviders from './_components/MainLayoutProviders'
import './globals.css'

const ClientErrorContent = dynamic(
() => import('@/components/error/ErrorContent'),
{ ssr: false }
() => import('@/components/error/ErrorContent')
)

export const marianne = localFont({
Expand Down
5 changes: 2 additions & 3 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ import TwoFootprints from './_components/TwoFootprints'
const InteractiveIllustration = dynamic(
() => import('./_components/InteractiveIllustration'),
{
ssr: false,
loading: () => (
<Image
src="/images/illustrations/empreinte-carbone-eau-objets-du-quotidien.svg"
alt={t(
"Une fille tapant sur son ordinateur, entouré d'objets aux empreintes carbone et eau variées."
"Une fille tapant sur son ordinateur, entouré d'objets aux empreintes écologiques variées."
)}
width={580}
height={580}
Expand Down Expand Up @@ -55,7 +54,7 @@ export default async function Homepage() {
{
'@context': 'https://schema.org',
'@type': 'Organization',
url: 'https://nosgestesclimat.fr/',
url: 'https://nosgestesclimat.fr',
name: 'Nos Gestes Climat',
logo: 'https://nosgestesclimat.fr/_next/image?url=%2Fimages%2Fmisc%2Fpetit-logo%403x.png&w=640&q=75',
},
Expand Down
20 changes: 20 additions & 0 deletions src/components/images/SquareImageContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react'
import { twMerge } from 'tailwind-merge'

export default function SquareImageContainer({
children,
className,
}: {
children: React.ReactNode
className?: string
}) {
return (
<div
className={twMerge(
'relative flex aspect-square w-full items-center justify-center',
className
)}>
{children}
</div>
)
}
3 changes: 2 additions & 1 deletion src/components/landing-pages/DidYouKnowSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { ReactNode } from 'react'
import Slider from 'react-slick'
import 'slick-carousel/slick/slick.css'
import DynamicCTAButton from '../cta/DynamicCTAButton'
import Trans from '../translation/Trans'

export default function DidYouKnowSlider({
slides,
Expand Down Expand Up @@ -45,7 +46,7 @@ export default function DidYouKnowSlider({

<div className="w-full flex-1">
<h3 className="text-center text-xl md:text-left md:text-3xl">
Le saviez vous ?
<Trans>Le saviez vous ?</Trans>
</h3>

<Separator className="mx-auto my-4 md:mx-0" />
Expand Down
Loading
Loading