Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const eslintConfig = [
"react/no-unescaped-entities": "off",
// Allow Math.random() in useMemo - intentionally memoized for client-side randomization
"react-hooks/purity": "off",
// Allow setState in useEffect for legitimate hydration patterns
"react-hooks/set-state-in-effect": "off",
// Unused vars as warnings instead of errors
"@typescript-eslint/no-unused-vars": ["warn", {
"argsIgnorePattern": "^_",
Expand Down
15 changes: 7 additions & 8 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,28 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
const [isClient, setIsClient] = useState(false)
const [analyticsAllowed] = useState(() => {
// Initialize from localStorage on mount (only runs once)
if (typeof window === 'undefined') return false;
const [analyticsAllowed, setAnalyticsAllowed] = useState(false);

useEffect(() => {
// Read cookie consent from localStorage after component mounts
try {
const consent = localStorage.getItem('cookie_consent');
if (consent) {
const parsedConsent = JSON.parse(consent);
return parsedConsent.analytics === true;
setAnalyticsAllowed(parsedConsent.analytics === true);
}
} catch (e) {
console.error("Error parsing cookie consent:", e);
}
return false;
});
}, []);

useEffect(() => {
// This is a legitimate hydration pattern - set client flag after mount
// eslint-disable-next-line react-hooks/set-state-in-effect
setIsClient(true)
}, [])

return (
<html lang="en" suppressHydrationWarning className="!scroll-smooth">
<html lang="en" className="!scroll-smooth">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, maximum-scale=5, user-scalable=yes" />
<meta name="mobile-web-app-capable" content="yes" />
Expand Down
Loading