/* Cookie Banner — Rubin */ /* global React, ReactDOM, window */ const CookieBanner = () => { const [visible, setVisible] = React.useState(false); const lang = window.TWEAK_DEFAULTS?.lang || localStorage.rubin_lang || 'en'; React.useEffect(() => { if (!localStorage.getItem('rubin_cookie_v1')) { setVisible(true); } }, []); const save = (val) => { localStorage.setItem('rubin_cookie_v1', val); setVisible(false); }; if (!visible) return null; const content = { en: { msg: "We use a single localStorage entry to remember this choice. No analytics, no tracking. ", link: "Learn more", ok: "Accept", no: "Reject" }, pl: { msg: "Zapisujemy Twoją decyzję w jednym wpisie localStorage. Bez analityki, bez śledzenia. ", link: "Dowiedz się więcej", ok: "Zaakceptuj", no: "Odrzuć" } }[lang] || { msg: "", link: "", ok: "", no: "" }; return (
{content.msg} {content.link}
); }; window.CookieBanner = CookieBanner; // Auto-mount when loaded (Babel-standalone executes this after React is available) (function() { const mount = () => { let el = document.getElementById('cookie-banner-root'); if (!el) { el = document.createElement('div'); el.id = 'cookie-banner-root'; document.body.appendChild(el); } const root = ReactDOM.createRoot(el); root.render(); }; if (document.readyState === 'complete') { mount(); } else { window.addEventListener('load', mount); } })();