Ne pas afficher la bannière nouveauté lors de la première visite

pull/843/head
Maxime Quandalle 2020-01-15 15:50:43 +01:00
parent 07adc6c5d6
commit 2e43b6789d
No known key found for this signature in database
GPG Key ID: 428641C03D29CA10
1 changed files with 4 additions and 5 deletions

View File

@ -5,7 +5,6 @@ import emoji from 'react-easy-emoji'
import { useTranslation } from 'react-i18next'
import { Link } from 'react-router-dom'
import { lastRelease } from '../../../data/last-release.json'
import { inIframe } from '../../../utils'
const localStorageKey = 'last-viewed-release'
@ -16,15 +15,15 @@ export default function NewsBanner() {
const sitePaths = useContext(SitePathsContext)
const { i18n } = useTranslation()
const showBanner =
lastViewedRelease !== lastRelease && i18n.language === 'fr' && !inIframe()
// We only want to show the banner to returning visitors, so we initiate the
// local storage value with the last release.
if (showBanner && lastViewedRelease === undefined) {
if (lastViewedRelease === undefined) {
hideNewsBanner()
return null
}
const showBanner = lastViewedRelease !== lastRelease && i18n.language === 'fr'
return showBanner ? (
<div className="ui__ banner news">
<span>