import React, { Component } from 'react'; import i18n from 'i18next'; import './CookieConsent.scss'; /* * Minimal cookie-consent banner replacing selaias:cookie-consent (Blaze, * dead on Meteor 3: its `Cookies` global is gone and it crashed the whole * client bundle at load). Same behavior: informative banner, dismissed once. */ const STORAGE_KEY = 'tcef-cookie-consent'; class CookieConsent extends Component { constructor(props) { super(props); let accepted = false; try { accepted = window.localStorage.getItem(STORAGE_KEY) === 'yes'; } catch (e) { /* storage disabled: show banner every time */ } this.state = { accepted }; this.accept = this.accept.bind(this); } accept() { try { window.localStorage.setItem(STORAGE_KEY, 'yes'); } catch (e) { /* ignore */ } this.setState({ accepted: true }); } render() { if (this.state.accepted) return null; return (