Skip to content

Commit

Permalink
Release 1.5.2
Browse files Browse the repository at this point in the history
Changelog:
* Ajoute l'affichage auteur ect dans les articles du blog [NGC-258] #582
*  pkg!: upgrade ngc model to 2.5.1 #581 
* fix: add useFixedRegion in MainHooks (NGC-906) #580 
* Ajout de score de missing variable pour les mosaiques + refacto everyMosaicChildrenWithParent (NGC-853) #579 
* Ajoute l'affichage auteur ect dans les articles du blog [NGC-258] #582
*  feat: consider question as md #578
* Cache éléments + retirer url campagne inexistante [NGC-898] #575 
* Create pasterze-nouveautes-mai24.mdx #573 
* Fix assistance #572 
* [Hotfix] Réinitialise le state local de l'orga à chaque essai de connexion [NGC-901] #571 
* Passe l'email de l'admin #570 
* Ajoute trads manquantes #569 
* Modifie la page paramètres d'orga [NGC-805] #568 
* Ajoute la page paramètres de campagne [NGC-871] #567 
* Ajoute la page campagne [NGC-870] #566 
* Ajoute la page de création de campagne [NGC-807] #565 
* Improve sorting (NGC-853 NGC-897 NGC-560) #562 
* Ajoute la liste de campagnes dans le dashboard orga [NGC-686] #560
  • Loading branch information
bjlaa authored Jun 6, 2024
1 parent 4251959 commit e4a47f2
Show file tree
Hide file tree
Showing 165 changed files with 2,919 additions and 1,420 deletions.
6 changes: 6 additions & 0 deletions config/redirects.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ const redirects = [
destination: '/tutoriel/?poll=:poll&organisation=:organisation',
permanent: true,
},
{
source: '/organisations/:orgaSlug/resultats-detailles',
destination:
'/organisations/:orgaSlug/campagnes/campagne-1?isRedirectFromLegacy=true',
permanent: true,
},
]

module.exports = redirects
5 changes: 3 additions & 2 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.4.5",
"version": "1.5.2",
"description": "The leading open source climate footprint calculator",
"repository": {
"type": "git",
Expand Down Expand Up @@ -31,12 +31,13 @@
},
"dependencies": {
"@babel/runtime": "^7.23.1",
"@incubateur-ademe/nosgestesclimat": "2.4.1",
"@incubateur-ademe/nosgestesclimat": "2.5.1",
"@mdx-js/loader": "^3.0.0",
"@mdx-js/react": "^3.0.0",
"@next/bundle-analyzer": "^14.1.0",
"@next/mdx": "^14.0.2",
"@publicodes/react-ui": "^1.2.0",
"@publicodes/tools": "^1.1.2",
"@sentry/nextjs": "^7.80.0",
"@sentry/react": "^7.80.0",
"@tanstack/react-query": "^5.28.4",
Expand Down
3 changes: 2 additions & 1 deletion public/demo-iframeSimulation.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ <h2>
id="nosgestesclimat"
src="/iframeSimulation.js"
data-only-simulation="true"
data-lang="en"></script>
data-lang="en"
region="CH"></script>
</main>
</body>
</html>
3 changes: 3 additions & 0 deletions public/images/icons/download.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default async function ActionPlus({
</ButtonLink>
) : null}
</div>
{action ? <Markdown>{action}</Markdown> : <Route404 />}
{action ? <Markdown>{action?.content}</Markdown> : <Route404 />}
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function PollsList({ organisation }: Props) {
{polls && polls.length > 0 && (
<>
<h3 className="mb-0 text-base">
<Trans>Mes sondages</Trans>
<Trans>Mes campagnes</Trans>
</h3>

{polls?.map((poll) => <PollItem key={poll.slug} poll={poll} />)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Trans from '@/components/translation/Trans'
import { classementClickOrganisation } from '@/constants/tracking/pages/classements'
import ChevronRight from '@/design-system/icons/ChevronRight'
import Badge from '@/design-system/layout/Badge'
import { getLinkToPollDashboard } from '@/helpers/navigation/pollPages'
import { Organisation } from '@/types/organisations'
import { trackEvent } from '@/utils/matomo/trackEvent'

Expand All @@ -16,7 +15,7 @@ export default function OrganisationItem({
}) {
return (
<Link
href={getLinkToPollDashboard({ orgaSlug: organisation?.slug })}
href={`/organisations/${organisation?.slug}`}
className="mb-6 rounded-xl bg-gray-100 px-5 py-2 no-underline decoration-auto transition-colors hover:bg-primary-100"
onClick={() => trackEvent(classementClickOrganisation)}>
<div className="flex items-center justify-between py-4">
Expand All @@ -28,7 +27,7 @@ export default function OrganisationItem({
</div>

<div className="flex gap-1 text-sm text-violet-900">
<Badge className="text-secondary-700 ml-2 inline border-pink-100 bg-pink-200 text-xs font-bold">
<Badge className="ml-2 inline border-secondary-300 text-xs font-bold text-secondary-700">
<Trans>Administrateur·ice</Trans>
</Badge>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@ type Props = {
export default function PollItem({ poll }: Props) {
return (
<Link
href={getLinkToPollDashboard({ orgaSlug: poll.organisationInfo.slug })}
href={getLinkToPollDashboard({
orgaSlug: poll.organisationInfo.slug,
pollSlug: poll.slug,
})}
className="rounded-xl bg-gray-100 px-5 py-2 no-underline decoration-auto transition-colors hover:bg-primary-100"
onClick={() => trackEvent(classementClickOrganisation)}>
<div className="flex items-center justify-between py-4">
<div className="flex w-full items-center">
<div>
<div className="text-md font-bold text-gray-900">
{poll.organisationInfo?.name}
<div className="text-md text-gray-900">
<strong>{poll.organisationInfo?.name}</strong>
{poll.name && ` - ${poll.name}`}
</div>

<div className="flex gap-1 text-sm text-violet-900">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ export default function GetResultsByEmail({
label={
<span>
<Emoji>☀️</Emoji>{' '}
<Trans>
<strong>Infolettre saisonnière de Nos Gestes Climat</strong>
</Trans>
<strong>
<Trans>Infolettre saisonnière de</Trans> Nos Gestes Climat
</strong>
</span>
}
{...register('newsletter-saisonniere')}
Expand All @@ -189,10 +189,10 @@ export default function GetResultsByEmail({
<CheckboxInputGroup
label={
<span>
<Emoji>🚗</Emoji>{' '}
<Emoji>🚗</Emoji> <strong>Nos Gestes Transports</strong>
<Trans>
<strong>Nos Gestes Transports</strong> : maîtrisez l'impact
carbone de vos transports avec nos 4 infolettres
 : maîtrisez l'impact carbone de vos transports avec nos 4
infolettres
</Trans>
</span>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { endClickPoll } from '@/constants/tracking/pages/end'
import ButtonLink from '@/design-system/inputs/ButtonLink'
import Card from '@/design-system/layout/Card'
import { getLinkToPollDashboard } from '@/helpers/navigation/pollPages'
import { usePoll } from '@/hooks/organisations/usePoll'
import { usePollPublicInfo } from '@/hooks/organisations/usePollPublicInfo'
import { useCurrentSimulation } from '@/publicodes-state'
import { useContext, useEffect } from 'react'

Expand All @@ -15,7 +15,7 @@ export default function Poll() {

const lastPollSlug = polls?.[polls?.length - 1]

const { data: poll, isLoading } = usePoll({
const { data: poll, isLoading } = usePollPublicInfo({
pollSlug: lastPollSlug,
})

Expand Down Expand Up @@ -47,6 +47,7 @@ export default function Poll() {
<ButtonLink
href={getLinkToPollDashboard({
orgaSlug: poll?.organisationInfo.slug || '', // TODO: handle this better
pollSlug: lastPollSlug || '',
})}
trackingEvent={endClickPoll}
className="flex h-10 w-10 items-center justify-center rounded-full p-0 leading-none">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Trans from '@/components/translation/Trans'
import { endClickShare } from '@/constants/tracking/pages/end'
import CopyInput from '@/design-system/inputs/CopyInput'
import Title from '@/design-system/layout/Title'
Expand All @@ -9,7 +10,9 @@ export default function ShareBlock() {

return (
<div id="share-block" className="">
<Title tag="h2">Partager mon résultat</Title>
<Title tag="h2">
<Trans>Partager mon résultat</Trans>
</Title>

<CopyInput
textToCopy={sharedUrl}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function TargetBlock() {
return (
<div className="relative">
<Hedgehog setIsHedgehog={setIsHedgehog} />
<div className="short:py-2 relative rounded-xl border-2 border-primary-50 bg-gray-100 px-4 py-6">
<div className="relative rounded-xl border-2 border-primary-50 bg-gray-100 px-4 py-6 short:py-2">
{isHedgehog ? (
<HedgehogAwareness />
) : (
Expand Down Expand Up @@ -78,7 +78,7 @@ export default function TargetBlock() {
className="text-sm"
href="/empreinte-climat"
target="_blank">
En savoir plus{' '}
<Trans>En savoir plus</Trans>{' '}
<ExternalLinkIcon className="stroke-primary-700" />
</Link>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Trans from '@/components/translation/Trans'
import Emoji from '@/design-system/utils/Emoji'
import {
getBorderColor,
Expand Down Expand Up @@ -33,7 +34,7 @@ export default function Subcategory({ subcategory, index }: Props) {
</h3>
<div className="text-xl lg:text-2xl">
<span className="font-black text-secondary-700">{percent} %</span>{' '}
de votre empreinte
<Trans>de votre empreinte</Trans>
</div>
</div>
<Emoji className="text-4xl lg:text-6xl">{icons?.slice(0, 2)}</Emoji>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function Actions({ subcategory, shouldHideLink }: Props) {
onClick={() => trackEvent(endClickActions)}
href="/actions"
className="text-center text-xs">
<Trans>Voir tous les gestes {title}</Trans>
<Trans>Voir tous les gestes</Trans> : {title}
</Link>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import TextInputGroup from '@/design-system/inputs/TextInputGroup'
import Title from '@/design-system/layout/Title'
import { useInfosPage } from '@/hooks/navigation/useInfosPage'
import { useOrganisationQueryParams } from '@/hooks/organisations/useOrganisationQueryParams'
import { usePoll } from '@/hooks/organisations/usePoll'
import { usePollPublicInfo } from '@/hooks/organisations/usePollPublicInfo'
import { useParams, useRouter } from 'next/navigation'
import { useContext } from 'react'
import { useForm as useReactHookForm } from 'react-hook-form'
Expand All @@ -29,7 +29,7 @@ export default function CustomQuestion() {

const { pollSlug } = useOrganisationQueryParams()

const { data: poll, isLoading } = usePoll({ pollSlug })
const { data: poll, isLoading } = usePollPublicInfo({ pollSlug })

const { addCustomAnswer } = useContext(InfosContext)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
'use client'

import Trans from '@/components/translation/Trans'
import Button from '@/design-system/inputs/Button'
import Select from '@/design-system/inputs/Select'
import Title from '@/design-system/layout/Title'
import { OrganisationPoll } from '@/types/organisations'
import { useMemo, useState } from 'react'
import AddPollCard from './myPolls/AddPollCard'
import PollCard from './myPolls/PollCard'

type Props = {
polls: OrganisationPoll[]
}

export default function MyPolls({ polls }: Props) {
const [sort, setSort] = useState('date-old')
const [isMinified, setIsMinified] = useState(true)

const pollsSorted = useMemo(
() =>
polls.sort((a, b) => {
if (sort === 'date-new') {
return (
new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
)
}

if (sort === 'date-old') {
return (
new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()
)
}

if (sort === 'alphabetical') {
return (a.name ?? '').localeCompare(b.name ?? '')
}

if (sort === 'anti-alphabetical') {
return (b.name ?? '').localeCompare(a.name ?? '')
}

return 0
}),
[polls, sort]
)

return (
<section className="mb-12">
<div className="flex items-center justify-between">
<Title tag="h2">
<Trans>Mes campagnes</Trans>
</Title>

{pollsSorted.length > 0 && (
<Select
onChange={(e) => {
setSort(e.target.value)
}}
className="p-2 text-sm"
name="sortOrder">
<option value="date-old">
<Trans>Date (anciennes &gt; récentes)</Trans>
</option>
<option value="date-new">
<Trans>Date (récentes &gt; anciennes)</Trans>
</option>
<option value="alphabetical">
<Trans>Nom (A &gt; Z)</Trans>
</option>
<option value="anti-alphabetical">
<Trans>Nom (Z &gt; A)</Trans>
</option>
</Select>
)}
</div>

<ul className="mt-8 grid gap-8 sm:grid-cols-2 md:grid-cols-3">
{(isMinified ? pollsSorted.slice(0, 2) : pollsSorted).map(
(poll, index) => (
<li key={poll._id} className="col-span-1">
<PollCard poll={poll} index={index} />
</li>
)
)}

<AddPollCard hasNoPollsYet={polls.length === 0} />
</ul>

{pollsSorted.length > 2 && (
<Button
className="mt-6"
onClick={() => setIsMinified((prevState) => !prevState)}
color="link">
{isMinified ? (
<span>
+ <Trans>Voir toutes les campagnes</Trans>
</span>
) : (
<span>
- <Trans>Masquer les autres campagnes</Trans>
</span>
)}
</Button>
)}
</section>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function OurTools() {
<div className="col-span-1 mt-8 grid grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-3">
<CTACard
className="border-2 border-gray-200 px-8"
overLabel={<Trans>Partagez Nos Gestes Climat</Trans>}
overLabel={<Trans>Communiquez sur la campagne</Trans>}
title={<Trans>Kit de diffusion</Trans>}
description={
<Trans>
Expand All @@ -40,15 +40,15 @@ export default function OurTools() {
href="https://drive.google.com/drive/folders/1ppvieBBNCSSkvREGIAAK44PmPNy9CRz9?usp=drive_link"
target="_blank"
aria-label={t('Télécharger le kit, ouvrir dans un nouvel onglet')}>
<Trans>Télécharger le kit</Trans>
<Trans>Accéder au kit</Trans>
<ExternalLinkIcon className="ml-2 stroke-primary-700" />
</ButtonLink>
</CTACard>

<CTACard
className="relative overflow-hidden border-2 border-gray-200 px-8"
overLabel={<Trans>Animez un atelier</Trans>}
title={<Trans>Les ateliers de l'ABC</Trans>}
title={<Trans>Les ressources de l'ABC</Trans>}
description={
<Trans>
Organisez des temps d’animation et d’échanges physiques autour de
Expand All @@ -65,7 +65,7 @@ export default function OurTools() {
aria-label={t(
'Découvrez les ateliers de l’ABC, ouvrir dans un nouvel onglet'
)}>
<Trans>Accéder au kit</Trans>
<Trans>Accéder aux ressources</Trans>
<ExternalLinkIcon className="ml-2 stroke-primary-700" />
</ButtonLink>
</CTACard>
Expand Down
Loading

0 comments on commit e4a47f2

Please sign in to comment.