feat: add user authentication UI to header component

Add login and register dialogs, user dropdown menu with profile link and logout option, and integrate with session management hook. Prevent hydration mismatches by conditionally rendering auth elements after mount. Update package-lock.json with new @esbuild dependencies for build tooling.
This commit is contained in:
Evandro Fonseca Junior committed 2025-11-04 02:33:29 -03:00
1 parent e641138887
commit 55eebde0ba
55 files changed
+7353 -7

No files matched your search

+17
View File
@@ -1,5 +1,6 @@
"use client";
import { useEffect, useState } from "react";
import { Moon, Sun, Monitor } from "lucide-react";
import { useTheme } from "next-themes";
import { Button } from "@/components/ui/button";
@@ -14,6 +15,22 @@ import { useTranslations } from "next-intl";
export function ThemeToggle() {
const { setTheme, theme } = useTheme();
const t = useTranslations("header.theme");
const [mounted, setMounted] = useState(false);
// Evitar hidratação mismatch
useEffect(() => {
setMounted(true);
}, []);
if (!mounted) {
// Renderizar um placeholder durante SSR para manter layout consistente
return (
<Button variant="outline" size="icon" disabled>
<Sun className="h-[1.2rem] w-[1.2rem]" />
<span className="sr-only">Toggle theme</span>
</Button>
);
}
return (
<DropdownMenu>