feat: Add Vercel Analytics integration and update dependencies

This commit is contained in:
2025-06-09 00:29:48 -03:00
parent 1278ac3efe
commit 486ce640b8
3 changed files with 44 additions and 30 deletions

View File

@@ -47,6 +47,7 @@
"@supabase/supabase-js": "^2.50.0", "@supabase/supabase-js": "^2.50.0",
"@types/react": "^18.3.10", "@types/react": "^18.3.10",
"@types/react-dom": "^18.3.0", "@types/react-dom": "^18.3.0",
"@vercel/analytics": "^1.5.0",
"ai": "^4.3.16", "ai": "^4.3.16",
"astro": "^5.9.0", "astro": "^5.9.0",
"class-variance-authority": "^0.7.0", "class-variance-authority": "^0.7.0",

3
pnpm-lock.yaml generated
View File

@@ -116,6 +116,9 @@ importers:
'@types/react-dom': '@types/react-dom':
specifier: ^18.3.0 specifier: ^18.3.0
version: 18.3.7(@types/react@18.3.23) version: 18.3.7(@types/react@18.3.23)
'@vercel/analytics':
specifier: ^1.5.0
version: 1.5.0(react@18.3.1)
ai: ai:
specifier: ^4.3.16 specifier: ^4.3.16
version: 4.3.16(react@18.3.1)(zod@3.23.8) version: 4.3.16(react@18.3.1)(zod@3.23.8)

View File

@@ -1,4 +1,5 @@
--- ---
import Analytics from "@vercel/analytics/astro";
interface Props { interface Props {
title: string; title: string;
} }
@@ -8,36 +9,45 @@ const { title } = Astro.props;
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="description" content="Astro description" /> <meta name="description" content="Astro description" />
<meta name="viewport" content="width=device-width" /> <meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="generator" content={Astro.generator} /> <meta name="generator" content={Astro.generator} />
<title>{title}</title> <title>{title}</title>
<script is:inline> <script is:inline>
// shadcn dark mode script for Astro // shadcn dark mode script for Astro
const themeKey = 'theme'; const themeKey = "theme";
function getThemePreference() { function getThemePreference() {
if (typeof localStorage !== 'undefined' && localStorage.getItem(themeKey)) { if (
return localStorage.getItem(themeKey); typeof localStorage !== "undefined" &&
} localStorage.getItem(themeKey)
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; ) {
} return localStorage.getItem(themeKey);
const isDark = getThemePreference() === 'dark'; }
document.documentElement.classList[isDark ? 'add' : 'remove']('dark'); return window.matchMedia("(prefers-color-scheme: dark)").matches
if (typeof localStorage !== 'undefined') { ? "dark"
const observer = new MutationObserver(() => { : "light";
const isDark = document.documentElement.classList.contains('dark'); }
localStorage.setItem(themeKey, isDark ? 'dark' : 'light'); const isDark = getThemePreference() === "dark";
}); document.documentElement.classList[isDark ? "add" : "remove"]("dark");
observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] }); if (typeof localStorage !== "undefined") {
} const observer = new MutationObserver(() => {
</script> const isDark = document.documentElement.classList.contains("dark");
</head> localStorage.setItem(themeKey, isDark ? "dark" : "light");
<body> });
<slot /> observer.observe(document.documentElement, {
</body> attributes: true,
attributeFilter: ["class"],
});
}
</script>
</head>
<body>
<slot />
<Analytics />
</body>
</html> </html>
<style is:global> <style is:global>
:root { :root {