diff --git a/src/shared/components/common/theme-toggle.tsx b/src/shared/components/common/theme-toggle.tsx index e7a44fe..6f6ef48 100644 --- a/src/shared/components/common/theme-toggle.tsx +++ b/src/shared/components/common/theme-toggle.tsx @@ -2,6 +2,7 @@ import { useTheme } from "next-themes"; import { useEffect, useState } from "react"; +import { Sun, Moon } from "lucide-react"; import { cn } from "@/shared/lib/utils"; export function ThemeToggle() { @@ -11,8 +12,7 @@ export function ThemeToggle() { useEffect(() => setMounted(true), []); if (!mounted) { - // Prevent hydration mismatch — render placeholder - return
; + return
; } const isDark = resolvedTheme === "dark"; @@ -25,75 +25,83 @@ export function ThemeToggle() { aria-label="Schimbă tema" onClick={() => setTheme(isDark ? "light" : "dark")} className={cn( - "relative inline-flex h-7 w-14 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors duration-500 ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", + "relative inline-flex h-8 w-16 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-all duration-500 ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", isDark - ? "bg-gradient-to-r from-indigo-900 to-slate-800" - : "bg-gradient-to-r from-sky-300 to-amber-200", + ? "bg-gradient-to-r from-indigo-950 via-indigo-900 to-slate-800" + : "bg-gradient-to-r from-sky-400 via-sky-300 to-amber-200", )} > {/* Stars — visible in dark mode */} - + - {/* Sliding circle (sun/moon) */} - - {/* Sun rays — visible in light mode */} - - {/* Glow */} - - - - {/* Moon craters — visible in dark mode */} - - - - - - - {/* Clouds — visible in light mode */} - - + + + + + {/* Sliding knob with Sun/Moon icon */} + + {/* Sun icon */} + + {/* Moon icon */} + + + {/* Glow ring */} + ); diff --git a/src/shared/components/layout/header.tsx b/src/shared/components/layout/header.tsx index 9473164..f79dcf4 100644 --- a/src/shared/components/layout/header.tsx +++ b/src/shared/components/layout/header.tsx @@ -1,11 +1,6 @@ "use client"; -import { - PanelLeft, - User as UserIcon, - LogOut, - LogIn, -} from "lucide-react"; +import { PanelLeft, User as UserIcon, LogOut, LogIn } from "lucide-react"; import { Button } from "@/shared/components/ui/button"; import { DropdownMenu, diff --git a/src/shared/components/layout/sidebar.tsx b/src/shared/components/layout/sidebar.tsx index 8630786..a3b71a7 100644 --- a/src/shared/components/layout/sidebar.tsx +++ b/src/shared/components/layout/sidebar.tsx @@ -86,8 +86,13 @@ function SidebarLogos() { const [animatingId, setAnimatingId] = useState(null); const [comboProgress, setComboProgress] = useState(0); const [showConfetti, setShowConfetti] = useState(false); + const [mounted, setMounted] = useState(false); const { resolvedTheme } = useTheme(); + useEffect(() => setMounted(true), []); + + const isDark = mounted ? resolvedTheme === "dark" : false; + // Reset combo after 3 seconds of inactivity useEffect(() => { if (comboProgress === 0) return; @@ -130,14 +135,12 @@ function SidebarLogos() { ); return ( -
+
{LOGO_COMPANIES.map((companyId, index) => { const company = COMPANIES[companyId]; - const logoSrc = - resolvedTheme === "dark" - ? (company?.logo?.dark ?? company?.logo?.light) - : company?.logo?.light; - if (!logoSrc) return null; + const lightSrc = company?.logo?.light; + const darkSrc = company?.logo?.dark ?? company?.logo?.light; + if (!lightSrc) return null; const isAnimating = animatingId === companyId; const animation = isAnimating ? ANIMATIONS[index % ANIMATIONS.length] @@ -150,18 +153,34 @@ function SidebarLogos() { type="button" onClick={(e) => handleLogoClick(companyId, e)} className={cn( - "relative shrink-0 rounded-md p-0.5 transition-all duration-200 hover:scale-110 focus:outline-none", + "relative min-w-0 flex-1 rounded-md p-0.5 transition-all duration-200 hover:scale-110 focus:outline-none", glow, isAnimating && animation, )} title={company.shortName} > + {/* Light variant — hidden in dark mode */} {company.shortName} + {/* Dark variant — hidden in light mode */} + {company.shortName}