Skip to content

Commit

Permalink
Release 1.5.6
Browse files Browse the repository at this point in the history
Changelog : 
- ✨ linux magic key shortcut (NGC-1082) #651
- Personas et paramètre PR (NGC-848) #650
- Petites pétouilles #649
- fix: currentSimulationId now correctly initialized #646
- Corrige Select restant bloqué sur la valeur par défaut qui lui est passée [NGC-1058] #645
- fix: test e2e with quiz #644
- Update wording repas (NGC-962) #643
- Retire lien mort #642
- Corrige la sélection de langue via l'URL #641
- Active la modification de l'email administrateur orga [NGC-1058, NGC-912] #639
- Retire le bouton Partagez le test au niveau du parcours orga #638
- Ajoute une couleur de thème VSCode #637
- Version mobile : Pavé numérique iOS [NGC-997] #636
- Réactiver Sentry une fois fonctionnel [NGC-1004] #635
  • Loading branch information
florianpanchout authored Jul 30, 2024
1 parent ab718bd commit 3771d6e
Show file tree
Hide file tree
Showing 53 changed files with 741 additions and 306 deletions.
37 changes: 36 additions & 1 deletion cypress/e2e/integration/pages/groupes.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ describe('The Group creation page /amis/creer', () => {
// Check that we can create our first group
cy.get('[data-cypress-id="button-create-first-group"]').click()
cy.get('input[data-cypress-id="group-input-owner-name"]').type('Jean-Marc')
cy.get('input[data-cypress-id="group-input-owner-name"]').type(
'[email protected]'
)

cy.wait(2000)

Expand All @@ -35,6 +38,22 @@ describe('The Group creation page /amis/creer', () => {

recursivelyFillSimulation(null, 'group')

cy.wait(2000)

cy.get('h1').then(($el) => {
if (
$el
.text()
.includes(
Cypress.env('testLangURL') === 'en'
? "Let's finish with a riddle!"
: 'Une devinette pour finir !'
)
) {
cy.get('[data-cypress-id="button-skip-quiz"]').click()
}
})

cy.wait(4000)

cy.get('[data-cypress-id="group-name"]')
Expand Down Expand Up @@ -94,7 +113,23 @@ describe('The Group creation page /amis/creer', () => {
clickSkipTutorialButton()
recursivelyFillSimulation(null, 'group')

cy.wait(3000)
cy.wait(2000)

cy.get('h1').then(($el) => {
if (
$el
.text()
.includes(
Cypress.env('testLangURL') === 'en'
? "Let's finish with a riddle!"
: 'Une devinette pour finir !'
)
) {
cy.get('[data-cypress-id="button-skip-quiz"]').click()
}
})

cy.wait(4000)

cy.get('[data-cypress-id="group-name"]')

Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nosgestesclimat-site-nextjs",
"license": "MIT",
"version": "1.5.5",
"version": "1.5.6",
"description": "The leading open source climate footprint calculator",
"repository": {
"type": "git",
Expand Down Expand Up @@ -32,7 +32,7 @@
"dependencies": {
"@babel/runtime": "^7.23.1",
"@incubateur-ademe/legal-pages-react": "^0.2.0",
"@incubateur-ademe/nosgestesclimat": "2.5.4",
"@incubateur-ademe/nosgestesclimat": "2.5.6",
"@mdx-js/loader": "^3.0.0",
"@mdx-js/react": "^3.0.0",
"@next/bundle-analyzer": "^14.1.0",
Expand All @@ -53,7 +53,7 @@
"i18next-parser": "^8.13.0",
"i18next-resources-to-backend": "^1.2.0",
"markdown-to-jsx": "^7.3.2",
"next": "^14.2.3",
"next": "^14.2.5",
"next-i18n-router": "^4.1.1",
"postcss": "8.4.36",
"process": "^0.11.10",
Expand All @@ -68,6 +68,7 @@
"react-i18next": "^14.0.5",
"react-modal": "^3.16.1",
"react-select": "^5.8.0",
"react-toastify": "^10.0.5",
"react-tooltip": "^5.26.3",
"react-verification-input": "^4.1.0",
"react-wavify": "^1.11.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function generateMetadata() {
export default async function International() {
const { t } = await getServerTranslation()

const supportedRegions = await getSupportedRegions()
const supportedRegions = getSupportedRegions()

// TODO: add back full width somehow
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import EmailInput from '@/design-system/inputs/EmailInput'
import PrenomInput from '@/design-system/inputs/PrenomInput'
import { useClientTranslation } from '@/hooks/useClientTranslation'
import { useUser } from '@/publicodes-state'
import { formatEmail } from '@/utils/format/formatEmail'
import { trackEvent } from '@/utils/matomo/trackEvent'
import { useRouter } from 'next/navigation'
import { useForm as useReactHookForm } from 'react-hook-form'
Expand Down Expand Up @@ -40,12 +41,14 @@ export default function GroupCreationForm() {
function onSubmit({ administratorName, administratorEmail }: Inputs) {
trackEvent(amisCreationEtapeVotreGroupeSuivant)

const formattedAdministratorEmail = formatEmail(administratorEmail)

// Update user info
updateName(administratorName ?? '')
updateEmail(administratorEmail ?? '')
updateEmail(formattedAdministratorEmail ?? '')

router.push(
`/amis/creer/votre-groupe?administratorName=${administratorName}&administratorEmail=${administratorEmail ?? ''}`
`/amis/creer/votre-groupe?administratorName=${administratorName}&administratorEmail=${formattedAdministratorEmail ?? ''}`
)
}

Expand All @@ -62,6 +65,7 @@ export default function GroupCreationForm() {

<div className="my-4">
<EmailInput
data-cypress-id="group-input-owner-email"
error={errors.administratorEmail?.message}
value={user.email ?? ''}
label={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import { useEndPage } from '@/hooks/navigation/useEndPage'
import { useSimulateurPage } from '@/hooks/navigation/useSimulateurPage'
import { useClientTranslation } from '@/hooks/useClientTranslation'
import { useCurrentSimulation, useUser } from '@/publicodes-state'
import { formatEmail } from '@/utils/format/formatEmail'
import { trackEvent } from '@/utils/matomo/trackEvent'
import { captureException } from '@sentry/react'
import { useSearchParams } from 'next/navigation'
import { useEffect, useState } from 'react'
import { useForm as useReactHookForm } from 'react-hook-form'
Expand Down Expand Up @@ -68,7 +70,9 @@ export default function NameForm() {

async function onSubmit({ name, emoji }: Inputs) {
try {
const administratorEmail = searchParams.get('administratorEmail')
const administratorEmail = formatEmail(
searchParams.get('administratorEmail')
)
const administratorName = searchParams.get('administratorName')

const group = await createGroup({
Expand All @@ -91,7 +95,7 @@ export default function NameForm() {

setShouldNavigate(group._id)
} catch (e) {
// captureException(e)
captureException(e)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useSimulateurPage } from '@/hooks/navigation/useSimulateurPage'
import { useClientTranslation } from '@/hooks/useClientTranslation'
import { useCurrentSimulation, useUser } from '@/publicodes-state'
import { Group } from '@/types/groups'
import { formatEmail } from '@/utils/format/formatEmail'
import { useEffect, useState } from 'react'
import { useForm as useReactHookForm } from 'react-hook-form'

Expand Down Expand Up @@ -59,9 +60,11 @@ export default function InvitationForm({ group }: { group: Group }) {
return
}

const formattedQuestEmail = formatEmail(guestEmail)

// Update user info
updateName(guestName)
updateEmail(guestEmail)
updateEmail(formattedQuestEmail)

// Update current simulation with group id (to redirect after test completion)
currentSimulation.update({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { useClientTranslation } from '@/hooks/useClientTranslation'
import { useLocale } from '@/hooks/useLocale'
import { useNumberSubscribers } from '@/hooks/useNumberSubscriber'
import { useCurrentSimulation, useEngine, useUser } from '@/publicodes-state'
import { formatEmail } from '@/utils/format/formatEmail'
import { trackEvent } from '@/utils/matomo/trackEvent'
import { captureException } from '@sentry/react'
import { useEffect, useRef } from 'react'
Expand Down Expand Up @@ -111,7 +112,9 @@ export default function GetResultsByEmail({

const listIds = getSaveSimulationListIds(data)

updateEmail(data.email ?? '')
const formattedEmail = formatEmail(data.email)

updateEmail(formattedEmail)

if (currentSimulation?.computedResults?.bilan === 0) {
// Send an error to Sentry
Expand Down
6 changes: 2 additions & 4 deletions src/app/(layout-with-navigation)/(simulation)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import Providers from '@/components/providers/Providers'
import { getSupportedRegions } from '@/helpers/modelFetching/getSupportedRegions'
import { PropsWithChildren } from 'react'

export default async function SimulateurLayout({
children,
}: PropsWithChildren) {
const supportedRegions = await getSupportedRegions()
export default function SimulateurLayout({ children }: PropsWithChildren) {
const supportedRegions = getSupportedRegions()

return <Providers supportedRegions={supportedRegions}>{children}</Providers>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
'use client'

import VerificationCodeInput from '@/components/organisations/VerificationCodeInput'
import Trans from '@/components/translation/Trans'
import InlineLink from '@/design-system/inputs/InlineLink'
import Modal from '@/design-system/modals/Modal'
import { useClientTranslation } from '@/hooks/useClientTranslation'

type Props = {
closeModal: () => void
onSubmit: (verificationCode: string) => void
error: Error | null
isSuccess: boolean
isPending: boolean
isErrorSendCode: boolean
}

export default function EmailVerificationModal({
closeModal,
onSubmit,
error,
isSuccess,
isPending,
isErrorSendCode,
}: Props) {
const { t } = useClientTranslation()

return (
<Modal isOpen closeModal={closeModal}>
<form>
<h3>
<Trans>Vous devez valider votre changement d'adresse e-mail.</Trans>
</h3>

<p>
<Trans>
Vous allez recevoir sous peu un e-mail de notre part contenant un{' '}
<strong className="text-secondary-700">code de vérification</strong>{' '}
à entrer dans cette fenêtre.
</Trans>
</p>

<label htmlFor="code" className="mb-4 block font-bold">
<Trans>Entrez votre code de vérification pour continuer</Trans>
</label>

<VerificationCodeInput
inputError={error ? t("Le code n'est pas valide.") : undefined}
isSuccessValidate={isSuccess}
isPendingValidate={isPending}
handleValidateVerificationCode={onSubmit}
/>

{isErrorSendCode && (
<p className="mt-8 text-red-700">
<Trans>
Oups ! Une erreur s'est produite au moment d'envoyer votre code de
vérification par email. Vérifiez si votre nouvel e-mail est bien
valide et si le problème persiste, n'hésitez pas à{' '}
<InlineLink href="/contact">nous contacter</InlineLink>
</Trans>
</p>
)}
</form>
</Modal>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ export default function PersonalInfoFields({ organisation, register }: Props) {
/>

<TextInputGroup
disabled
helperText={<Trans>Ce champ n'est pas modifiable</Trans>}
label={<Trans>Votre e-mail</Trans>}
value={organisation?.administrators?.[0]?.email}
{...register('email')}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { getServerTranslation } from '@/helpers/getServerTranslation'
import { getMetadataObject } from '@/helpers/metadata/getMetadataObject'
import { PropsWithChildren } from 'react'
import { ToastContainer } from 'react-toastify'

export async function generateMetadata() {
const { t } = await getServerTranslation()

return getMetadataObject({
title: t('Organisations, mon espace - Nos Gestes Climat'),
description: t(
'Accédez à des services sur mesure pour sensibiliser vos partenaires au sein de votre organisation.'
),
alternates: {
canonical: '/',
},
})
}

export default function Layout({ children }: PropsWithChildren) {
return (
<>
{children}
<ToastContainer />
</>
)
}
Loading

0 comments on commit 3771d6e

Please sign in to comment.