alanning:roles removed (client crashed the whole bundle; plain user.roles checks instead), selaias:cookie-consent replaced by in-repo React banner, publish-performant-counts vendored with countAsync, Meteor.autorun dropped (App)/Tracker.autorun (FiresMap), and the map publications not covered by the REST smoke (activefiresmyloc, activefiresunionmyloc, fireAlerts, oauth.verifyConfiguration) converted to async APIs. Verified in browser: / and /fires render with map + cookie banner, zero uncaught exceptions. REST smoke byte-identical (12/12).
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
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 (
|
|
<div className="CookieConsent">
|
|
<span>
|
|
{i18n.t('Utilizamos cookies para asegurar un mejor uso de nuestra web. Si continúas navegando, consideramos que aceptas su uso')}
|
|
</span>
|
|
<button type="button" className="btn btn-primary btn-sm" onClick={this.accept}>
|
|
{i18n.t('Aceptar')}
|
|
</button>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default CookieConsent;
|