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

Display coachco2 CTA in web and rename flag attributes #2032

Merged
merged 2 commits into from
Nov 8, 2023
Merged
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useState } from 'react'

import flag from 'cozy-flags'
import { isFlagshipApp } from 'cozy-device-helper'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'

import AppHighlightAlert from 'components/AppHighlightAlert/AppHighlightAlert'
Expand All @@ -15,12 +14,12 @@ const isAvailable = () => {
const bikegoalSettings = flag('coachco2.bikegoal.settings')

return (
isFlagshipApp() &&
flag('home.push.coachco2.opencount') &&
flag('home.push.coachco2.opencount') >= 0 &&
(!bikegoalSettings ||
bikegoalSettings.sourceId === null ||
(bikegoalSettings.sourceId !== null && flag('coachco2.bikegoal.enabled')))
bikegoalSettings.sourceOffer === null ||
(bikegoalSettings.sourceOffer !== null &&
flag('coachco2.bikegoal.enabled')))
)
}

Expand Down Expand Up @@ -67,21 +66,21 @@ const onDisplayed = () => {
const getAlertDescription = t => {
const bikegoalSettings = flag('coachco2.bikegoal.settings')

if (bikegoalSettings?.sourceId) {
if (bikegoalSettings.sourceId === 'employer') {
if (bikegoalSettings?.sourceOffer) {
if (bikegoalSettings.sourceOffer === 'employer') {
return t(
'appHighlightAlert.geolocationTracking.bikegoalSourceEmployerDescription',
{
sourceType: bikegoalSettings.sourceType,
sourceIdentity: bikegoalSettings.sourceIdentity
sourceName: bikegoalSettings.sourceName
}
)
} else {
return t(
'appHighlightAlert.geolocationTracking.bikegoalSourceDefaultDescription',
{
sourceType: bikegoalSettings.sourceType,
sourceIdentity: bikegoalSettings.sourceIdentity
sourceName: bikegoalSettings.sourceName
}
)
}
Expand Down
4 changes: 2 additions & 2 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,8 @@
"appHighlightAlert": {
"geolocationTracking": {
"defaultDescription": "Track your travel and carbon footprint with the CO2 Coach",
"bikegoalSourceEmployerDescription": "Your %{sourceType} %{sourceIdentity} invites you to take part in improving the area and benefit from the \"prime vélo\", this application will help you measure its progress, and much more!",
"bikegoalSourceDefaultDescription": "Your %{sourceType} %{sourceIdentity} invites you to play your part in improving the region. Save and analyse your journeys!"
"bikegoalSourceEmployerDescription": "Your %{sourceType} %{sourceName} invites you to take part in improving the area and benefit from the \"prime vélo\", this application will help you measure its progress, and much more!",
"bikegoalSourceDefaultDescription": "Your %{sourceType} %{sourceName} invites you to play your part in improving the region. Save and analyse your journeys!"
}
}
}
4 changes: 2 additions & 2 deletions src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,8 @@
"appHighlightAlert": {
"geolocationTracking": {
"defaultDescription": "Suivez vos déplacements et votre empreinte carbone avec le Coach CO2",
"bikegoalSourceEmployerDescription": "Votre %{sourceType} %{sourceIdentity} vous invite à participer à l’amélioration du territoire et bénéficier de la \"prime vélo\", cette application vous aidera à mesurer son avancement, et bien plus !",
"bikegoalSourceDefaultDescription": "Votre %{sourceType} %{sourceIdentity} vous invite à participer à l'amélioration du territoire, mémorisez et analysez vos déplacements !"
"bikegoalSourceEmployerDescription": "Votre %{sourceType} %{sourceName} vous invite à participer à l’amélioration du territoire et bénéficier de la \"prime vélo\", cette application vous aidera à mesurer son avancement, et bien plus !",
"bikegoalSourceDefaultDescription": "Votre %{sourceType} %{sourceName} vous invite à participer à l'amélioration du territoire, mémorisez et analysez vos déplacements !"
}
}
}
Loading