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

Page reutilisateurs #1262

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion nosgestesclimat
Binary file added source/images/Grandpoitiers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/Grenoble.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/La Poste.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/TF1 info.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/Voixdunord.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/bfntv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/bnpp.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/bon pote.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/chaville.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/fr3régions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/gpso.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/greenly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/la rochelle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/neon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/reutilisateurs/CNED.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/reutilisateurs/Grandpoitiers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/reutilisateurs/Grenoble.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/reutilisateurs/La Poste.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/reutilisateurs/TF1 info.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/reutilisateurs/Voixdunord.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/reutilisateurs/ac.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/reutilisateurs/acaclimat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/reutilisateurs/bfntv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/reutilisateurs/bnpp.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/reutilisateurs/bon pote.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/reutilisateurs/bpce.png
Binary file added source/images/reutilisateurs/chaville.png
Binary file added source/images/reutilisateurs/climates.png
Binary file added source/images/reutilisateurs/cyril.jpg
Binary file added source/images/reutilisateurs/fr3régions.png
Binary file added source/images/reutilisateurs/gpso.png
Binary file added source/images/reutilisateurs/greenly.png
Binary file added source/images/reutilisateurs/la rochelle.png
Binary file added source/images/reutilisateurs/m&s.jpg
Binary file added source/images/reutilisateurs/mk.png
Binary file added source/images/reutilisateurs/mpp.png
Binary file added source/images/reutilisateurs/neon.png
Binary file not shown.
Binary file added source/images/reutilisateurs/radiofrance.webp
Binary file not shown.
Binary file added source/images/reutilisateurs/silicet.png
Binary file added source/images/reutilisateurs/sleud.png
Binary file added source/images/reutilisateurs/sogood.png
Binary file added source/images/reutilisateurs/ucl.png
Binary file added source/images/reutilisateurs/vendredi.png
Binary file added source/images/reutilisateurs/vert.jpg
Binary file added source/images/vendredi.png
Binary file added source/images/vert.jpg
86 changes: 86 additions & 0 deletions source/locales/reutilisateurs/fr/reutilisateurs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
Médias:
- title: 'Empreinte carbone : qu’est-ce que c’est et comment calculer la sienne ?'
image: Voixdunord.jpg
link: https://www.lavoixdunord.fr/1343379/article/2023-06-21/empreinte-carbone-qu-est-ce-que-c-est-et-comment-calculer-la-sienne
- title: 'Comment s’engager pour le climat au quotidien ?'
image: neon.png
link: https://www.neonmag.fr/planete-environnement/comment-sengager-pour-le-climat-au-quotidien-560944
- title: 'Réduire sa consommation de viande est-il le geste écologique individuel "le plus efficace" ?'
image: TF1 info.jpg
link: https://www.tf1info.fr/environnement-ecologie/environnement-reduire-la-consommation-de-viande-est-il-le-geste-ecologique-individuel-le-plus-efficace-2258749.html
- title: 'Les Français·es émettent encore dix tonnes de CO2 par an, cinq fois trop pour le climat'
image: vert.jpg
link: https://vert.eco/articles/les-francais%C2%B7es-emettent-encore-10-tonnes-de-co2-par-an-cinq-fois-trop-pour-le-climat
- title: 'À quel point contribuez-vous au réchauffement climatique ? Calculez votre empreinte carbone'
image: bfntv.png
link: https://www.bfmtv.com/environnement/climat/2050-le-grand-defi-climatique-calculez-votre-empreinte-carbone_AN-202211070002.html
Personnalités et influenceurs:
- title: 'Cyril Dion'
image: cyril.jpg
link: https://www.instagram.com/cyril_dion/?hl=fr
- title: 'Mango & Salt'
image: m&s.jpg
link: https://www.instagram.com/mangoandsalt/?hl=fr
- title: 'Sleud'
image: sleud.png
link: https://www.youtube.com/watch?v=nU-PdtTcwTk
Entreprises:
- title: 'BNP Paribas'
image: bnpp.jpg
- title: 'La Poste'
image: La Poste.jpg
link: https://www.laposte.fr/entreprise-collectivites/politique-rse
- title: 'BPCE'
image: bpce.png
- title: 'Vendredi'
image: vendredi.png
link: https://www.vendredi.cc/
- title: 'Greenly'
image: greenly.png
link: https://greenly.earth/fr-fr/blog/guide-entreprise/empreinte-carbone-definition-methode-calcul
Collectivités:
- title: 'Ville de Grenoble'
image: Grenoble.png
link: https://www.grenoble.fr/2294-nos-gestes-climat.htm
- title: 'Grand Paris Seine-Ouest'
image: gpso.png
link: https://www.seineouest.fr/nos-gestes-climat
- title: 'La Rochelle'
image: la rochelle.png
link: https://www.larochelle-zerocarbone.fr/s-engager/la-boite-a-outils-du-zero-carbone/nos-gestes-climat
- title: 'Chaville'
image: chaville.png
link: https://www.ville-chaville.fr/actualites-evenements/toute-l-actualite-77/calculez-votre-empreinte-carbone-6016.html?cHash=c7b2eca484cafc033d891ea10c3d03f8
- title: 'Grand Poitiers'
image: Grandpoitiers.png
link: https://www.grandpoitiers.fr/grands-projets/actions-pour-le-climat/plan-climat
Associations:
- title: 'Avenir Climatique'
image: ac.png
link: https://avenirclimatique.org/calculer-empreinte-carbone/
- title: 'Makesense'
image: mk.png
link: https://france.makesense.org/citoyens/s-engager/reaction-dehors/
- title: 'Ma Petite Planète'
image: mpp.png
link: https://mapetiteplanete.org/
- title: 'Climates'
image: climates.png
link: https://www.weareclimates.org/
Education:
- title: 'Université Catholique de Lyon'
image: ucl.png
link: https://www.ucly.fr/
- title: 'L’académie du climat'
image: acaclimat.png
link: https://www.academieduclimat.paris/
- title: 'CNED'
image: CNED.png
link: https://www.cned.fr/transition-ecologique/ba-ba-du-climat-et-de-la-biodiversite
Lieux et événements:
- title: 'Silicet'
image: silicet.png
link: https://scilicet.fr/
- title: 'SoGood Festival'
image: sogood.png
link: https://www.sogoodfestival.com/
12 changes: 9 additions & 3 deletions source/pages/creer-groupe/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function CreerGroupe() {
const [errorPrenom, setErrorPrenom] = useState('')
const [email, setEmail] = useState(emailFromState || '')
const [errorEmail, setErrorEmail] = useState('')

const [fetching, setFetching] = useState(false)
const { trackEvent } = useMatomo()

const { t } = useTranslation()
Expand All @@ -51,6 +51,7 @@ export default function CreerGroupe() {
const groupBaseURL = `${window.location.origin}/groupes`

const handleSubmit = async (event) => {
setFetching(true)
// Avoid reloading page
if (event) {
event.preventDefault()
Expand All @@ -59,6 +60,7 @@ export default function CreerGroupe() {
// Inputs validation
if (!prenom) {
setErrorPrenom(t('Veuillez renseigner un prénom ou un pseudonyme.'))
setFetching(false)
return
}
if (
Expand All @@ -68,6 +70,7 @@ export default function CreerGroupe() {
)
) {
setErrorEmail(t('Veuillez renseigner un email valide.'))
setFetching(false)
return
}

Expand Down Expand Up @@ -97,6 +100,7 @@ export default function CreerGroupe() {
const group: Group = await response.json()

if (!response.ok) {
setFetching(false)
throw new Error(JSON.stringify(group))
}

Expand All @@ -106,6 +110,7 @@ export default function CreerGroupe() {
// The user will be redirected to the test in order to take it
if (!currentSimulation) {
dispatch(setGroupToRedirectTo(group))
setFetching(false)
navigate('/simulateur/bilan')
return
}
Expand All @@ -127,9 +132,10 @@ export default function CreerGroupe() {
}),
})
}

setFetching(false)
navigate(`/groupes/resultats?groupId=${group._id}`)
} catch (e) {
setFetching(false)
captureException(e)
}
}
Expand Down Expand Up @@ -167,7 +173,7 @@ export default function CreerGroupe() {
type="submit"
data-cypress-id="button-create-group"
onClick={handleSubmit}
aria-disabled={!prenom}
aria-disabled={!prenom && !fetching}
>
{currentSimulation ? (
<Trans>Créer le groupe</Trans>
Expand Down
105 changes: 105 additions & 0 deletions source/pages/groupe-dashboard/components/FeedbackBlock.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import { Trans } from 'react-i18next'

export default function FeedbackBlock() {
return (
<div className="border-solid border-[1px] border-grey-200 rounded-md p-4 flex gap-3 items-top justify-between mt-4">
<Flask />
<div>
<p className="mb-0">
<Trans>
Cette nouvelle fonctionnalité est en expérimentation ! Vous
rencontrez un bug ou avez une idée d’amélioration ?
</Trans>
</p>
<a
className="font-bold"
href="https://tally.so/r/meDdDJ"
target="_blank"
>
Donnez votre avis !
</a>
</div>
</div>
)
}

const Flask = () => (
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className="flex-none mt-1"
>
<path
d="M6.72601 0.75H17.226"
stroke="#5758BB"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M15.726 8.25V0.75H8.226V8.25L1.489 18.615C1.19487 19.0675 1.02825 19.5909 1.0067 20.1302C0.985142 20.6694 1.10945 21.2045 1.36652 21.679C1.62359 22.1535 2.0039 22.5499 2.46737 22.8264C2.93085 23.1029 3.46032 23.2492 4 23.25H19.948C20.488 23.2499 21.018 23.1041 21.482 22.8279C21.9461 22.5517 22.327 22.1554 22.5845 21.6808C22.8421 21.2061 22.9667 20.6708 22.9453 20.1312C22.9239 19.5916 22.7573 19.0678 22.463 18.615L15.726 8.25Z"
stroke="#5758BB"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M5.30099 12.75H18.651"
stroke="#5758BB"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M14.226 17.25H17.226"
stroke="#5758BB"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M15.726 15.75V18.75"
stroke="#5758BB"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M15.726 3.75H12.726"
stroke="#5758BB"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M15.726 6.75H12.726"
stroke="#5758BB"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M6.72601 19.875C6.62656 19.875 6.53117 19.8355 6.46085 19.7652C6.39052 19.6948 6.35101 19.5995 6.35101 19.5C6.35101 19.4005 6.39052 19.3052 6.46085 19.2348C6.53117 19.1645 6.62656 19.125 6.72601 19.125"
stroke="#5758BB"
strokeWidth="1.5"
/>
<path
d="M6.72601 19.875C6.82547 19.875 6.92085 19.8355 6.99118 19.7652C7.0615 19.6948 7.10101 19.5995 7.10101 19.5C7.10101 19.4005 7.0615 19.3052 6.99118 19.2348C6.92085 19.1645 6.82547 19.125 6.72601 19.125"
stroke="#5758BB"
strokeWidth="1.5"
/>
<path
d="M9.72601 16.875C9.62656 16.875 9.53117 16.8355 9.46085 16.7652C9.39052 16.6948 9.35101 16.5995 9.35101 16.5C9.35101 16.4005 9.39052 16.3052 9.46085 16.2348C9.53117 16.1645 9.62656 16.125 9.72601 16.125"
stroke="#5758BB"
strokeWidth="1.5"
/>
<path
d="M9.72601 16.875C9.82547 16.875 9.92085 16.8355 9.99118 16.7652C10.0615 16.6948 10.101 16.5995 10.101 16.5C10.101 16.4005 10.0615 16.3052 9.99118 16.2348C9.92085 16.1645 9.82547 16.125 9.72601 16.125"
stroke="#5758BB"
strokeWidth="1.5"
/>
</svg>
)
2 changes: 1 addition & 1 deletion source/pages/groupe-dashboard/components/InviteBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function InviteBlock({ group }: { group: Group }) {
const isShareDefined =
typeof navigator !== 'undefined' && navigator.share !== undefined

const sharedURL = `${window.location.origin}/groupes/invitation?groupId=${group?._id}`
const sharedURL = `${window.location.origin}/groupes/invitation?groupId=${group?._id}&mtm_campaign=challenge-amis`

const handleShare = async () => {
// TODO: replace with new tracking event
Expand Down
21 changes: 21 additions & 0 deletions source/pages/groupe-dashboard/components/SondagesBlock.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Separator from '@/components/groupe/Separator'
import { Link } from 'react-router-dom'

export default function SondagesBlock() {
return (
<div>
<Separator className="mb-4 mt-8" />
<h3 className="text-md font-bold mb-1">
Entreprises, collectivités, écoles
</h3>
<p>
Les <strong>sondages</strong> et <strong>conférences</strong> vous
permettent de comparer votre empreinte en direct ou en groupes de plus
de 20 personnes
</p>
<Link className="font-bold" to="/groupe">
Commencer
</Link>
</div>
)
}
14 changes: 9 additions & 5 deletions source/pages/groupe-dashboard/hooks/useGetGroupStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ export type Results = {
export const useGetGroupStats = ({
groupMembers,
userId,
synced,
}: {
groupMembers: Member[] | undefined
userId: string | null
synced: boolean
}) => {
const engine: Engine<DottedName> = useEngine()

const rules = engine.getParsedRules()

if (!groupMembers || !userId) return null
if (!groupMembers || !userId || !synced) return null

const results = {
currentMemberAllFootprints: {} as Record<string, ValueObject>,
Expand All @@ -52,8 +54,10 @@ export const useGetGroupStats = ({
pointsFaibles: {} as Points[],
}

const { groupCategoriesFootprints, currentMemberAllFootprints } =
groupMembers.reduce(
const { groupCategoriesFootprints, currentMemberAllFootprints } = groupMembers
// We sort the members to have the current user as last to set the engine
.sort((a) => (a.userId === userId ? 1 : -1))
.reduce(
(
{ groupCategoriesFootprints, currentMemberAllFootprints },
groupMember: Member
Expand Down Expand Up @@ -154,8 +158,8 @@ export const useGetGroupStats = ({
(results?.groupCategoriesFootprints?.[key]?.mean || 0)) /
(results?.groupCategoriesFootprints?.[key]?.mean || 1)) *
100
/*
console.log(key, results.currentMemberAllFootprints[key].variation) */

//console.log(key, results.currentMemberAllFootprints)
})

const sortedCurrentMemberByVariation = Object.entries(
Expand Down
Loading