meteor3: purge dead client packages — web UI renders on 3.1

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).
This commit is contained in:
vjrj 2026-07-14 11:32:19 +02:00
parent 0ff9848cd4
commit eb3aec82ae
16 changed files with 194 additions and 50 deletions

View file

@ -0,0 +1,45 @@
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;

View file

@ -0,0 +1,20 @@
.CookieConsent {
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 2000;
display: flex;
align-items: center;
justify-content: center;
gap: 1em;
padding: 0.75em 1em;
background: rgba(0, 0, 0, 0.85);
color: #fff;
font-size: 0.9em;
button {
margin-left: 1em;
white-space: nowrap;
}
}

View file

@ -9,7 +9,6 @@ import { I18nextProvider } from 'react-i18next';
import { Helmet } from 'react-helmet';
import { Meteor } from 'meteor/meteor';
import { withTracker } from 'meteor/react-meteor-data';
import { Roles } from 'meteor/alanning:roles';
// https://github.com/gadicc/meteor-blaze-react-component/
import Blaze from 'meteor/gadicc:blaze-react-component';
// i18n
@ -48,6 +47,7 @@ import About from '../../pages/About/About';
import Privacy from '../../pages/Privacy/Privacy';
import License from '../../pages/License/License';
import Credits from '../../pages/Credits/Credits';
import CookieConsent from '../../components/CookieConsent/CookieConsent';
import Footer from '../../components/Footer/Footer';
import Feedback from '../../components/Feedback/Feedback';
import ReSendEmail from '../../components/ReSendEmail/ReSendEmail';
@ -151,7 +151,7 @@ const App = props => (
<Footer />
<Reconnect {...props} />
<Feedback {...props} />
{props.i18nReady.get() && <Blaze template="cookieConsent" /> }
{props.i18nReady.get() && <CookieConsent /> }
</div>}
</LocationListener>
</Router>
@ -183,19 +183,16 @@ export default withTracker(() => {
const loggingIn = Meteor.loggingIn();
const user = Meteor.user();
const userId = Meteor.userId();
const loading = !Roles.subscription.ready() || !i18nReady.get();
const loading = !i18nReady.get();
const name = user && user.profile && user.profile.name && getUserName(user.profile.name);
const emailAddress = user && user.emails && user.emails[0].address;
Meteor.autorun(() => {
console.log(`i18n ready?: ${i18nReady.get()}`);
});
return {
loading,
loggingIn,
i18nReady,
authenticated: !loggingIn && !!userId,
name: name || emailAddress,
roles: !loading && Roles.getRolesForUser(userId),
roles: (user && user.roles) || [],
userId,
emailAddress,
emailVerified: user && user.emails ? user && user.emails && user.emails[0].verified : true

View file

@ -8,6 +8,7 @@ import { ButtonGroup, Row, Col, Checkbox } from 'react-bootstrap';
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import { withTracker } from 'meteor/react-meteor-data';
import { Tracker } from 'meteor/tracker';
import { Helmet } from 'react-helmet';
import { Trans, translate } from 'react-i18next';
import { Map } from 'react-leaflet';
@ -408,7 +409,7 @@ export default translate([], { wait: true })(withTracker(() => {
}
// Disable, because this increase the number of fires by one
// Meteor.subscribe('lastFireDetected');
Meteor.autorun(() => {
Tracker.autorun(() => {
if ((centerStored !== [0, 0] || geolocation.get()) && geoInit) {
center.set(centerStored || geolocation.get());
// console.log(`Geolocation ${geolocation.get()}`);