feat(config, layout): add analytics proxy and improve type handling

- Implemented a rewrite rule in the Next.js configuration to proxy analytics requests, bypassing adblockers for Rybbit Analytics.
- Enhanced the RootLayout component by correcting the typing of the children prop and improving the structure for better type safety.
This commit is contained in:
Evandro Fonseca Junior committed 2026-01-20 19:55:06 -03:00
1 parent 0a63c3ada0
commit 8f096b9400
2 files changed
+21 -8

No files matched your search

+11 -8
View File
@@ -1,6 +1,8 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import Script from "next/script";
// Importação necessária para corrigir o erro de namespace e tipagem do children
import { ReactNode } from "react";
import "./globals.css";
const geistSans = Geist({
@@ -69,11 +71,12 @@ export const metadata: Metadata = {
},
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
// Interface tipada corretamente
interface RootLayoutProps {
children: ReactNode;
}
export default function RootLayout({ children }: Readonly<RootLayoutProps>) {
return (
<html lang="pt-BR">
<head>
@@ -87,7 +90,6 @@ export default function RootLayout({
<link rel="preconnect" href="https://wa.me" />
<link rel="preconnect" href="https://www.linkedin.com" />
<link rel="preconnect" href="https://github.com" />
<link rel="preconnect" href="https://analytics.evandro.dev.br" />
{/* DNS prefetch for additional performance */}
<link rel="dns-prefetch" href="//fonts.googleapis.com" />
@@ -126,11 +128,12 @@ export default function RootLayout({
>
{children}
<Script
src="https://analytics.evandro.dev.br/api/script.js"
src="/analytics/api/script.js"
data-site-id="1"
data-debounce="100"
strategy="afterInteractive"
/>
</body>
</html>
);
}
}