feat: hide all demo badges when demo mode is disabled
All checks were successful
Staging Build / build (push) Successful in 2m36s

This commit is contained in:
DanielS
2026-06-24 13:19:00 +02:00
parent 3c60889e2a
commit fe1d15090a
4 changed files with 55 additions and 24 deletions

View File

@@ -0,0 +1,34 @@
"use client";
import { useEffect, useState } from "react";
interface DemoWrapperProps {
children: React.ReactNode;
}
export function DemoWrapper({ children }: DemoWrapperProps) {
const [showDemo, setShowDemo] = useState<boolean>(true);
const [isMounted, setIsMounted] = useState<boolean>(false);
useEffect(() => {
setIsMounted(true);
const checkDemo = () => {
const disabled = localStorage.getItem('demo_banner_disabled') === 'true';
setShowDemo(!disabled);
};
checkDemo();
window.addEventListener('storage_demo_changed', checkDemo);
return () => window.removeEventListener('storage_demo_changed', checkDemo);
}, []);
if (!isMounted) {
return <>{children}</>;
}
if (!showDemo) {
return null;
}
return <>{children}</>;
}