feat: update doc
This commit is contained in:
@@ -12,13 +12,15 @@ import LabPython from "./pages/LabPython/LabPython";
|
||||
import ScrollToTop from "./components/ScrollToTop";
|
||||
import { getAnalytics, usePageTracking } from "./services/analytics";
|
||||
import { initializeAnalytics, analyticsConfig } from "./services/analytics";
|
||||
import { ConsentManager } from "./services/consent";
|
||||
|
||||
// Inline CookieBanner para evitar bloqueio do Brave
|
||||
function CookieBanner() {
|
||||
const [visible, setVisible] = useState(false);
|
||||
const enableBanner = import.meta.env.VITE_ENABLE_CONSENT_BANNER === 'true';
|
||||
|
||||
useEffect(() => {
|
||||
if (!enableBanner) return;
|
||||
|
||||
try {
|
||||
const stored = localStorage.getItem('decoda_consent');
|
||||
if (!stored) {
|
||||
@@ -27,7 +29,7 @@ function CookieBanner() {
|
||||
} catch (e) {
|
||||
console.error('Consent check failed:', e);
|
||||
}
|
||||
}, []);
|
||||
}, [enableBanner]);
|
||||
|
||||
const handleAccept = () => {
|
||||
try {
|
||||
@@ -57,7 +59,7 @@ function CookieBanner() {
|
||||
}
|
||||
};
|
||||
|
||||
if (!visible) return null;
|
||||
if (!visible || !enableBanner) return null;
|
||||
|
||||
return (
|
||||
<div className="fixed bottom-0 left-0 right-0 z-50 p-4 md:p-6" role="dialog" aria-label="Consentimento de cookies">
|
||||
@@ -212,11 +214,10 @@ export default function App() {
|
||||
const [analyticsReady, setAnalyticsReady] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const hasConsent = ConsentManager.hasConsent();
|
||||
initializeAnalytics({
|
||||
providerType: analyticsConfig.providerType,
|
||||
measurementId: analyticsConfig.measurementId,
|
||||
hasConsent,
|
||||
hasConsent: true,
|
||||
debugMode: analyticsConfig.debugMode,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user