"use client"; import { useState, useEffect, useRef } from "react"; import { Button } from "@/components/ui/button"; import { Switch } from "@/components/ui/switch"; import { motion, Variants } from "framer-motion"; import { Shield, EyeOff } from "lucide-react"; import { useTheme } from "next-themes"; import dynamic from "next/dynamic"; // ИМПОРТИРУЕМ DYNAMIC import { Dictionary } from "@/lib/IDict"; // ДИНАМИЧЕСКИЙ ИМПОРТ МАТРИЦЫ (ОТКЛЮЧАЕМ SSR) const MatrixBackground = dynamic(() => import("./MatrixBackground"), { ssr: false, }); // --- КОМПОНЕНТ ГЛАЗ --- function WatcherEyes({ isClosed }: { isClosed: boolean }) { // ... (весь твой код WatcherEyes остается без изменений, // он абсолютно безопасен для SSR) const [mousePos, setMousePos] = useState({ x: 0, y: 0 }); const [isBlinking, setIsBlinking] = useState(false); const blinkTimerRef = useRef(null); const unblinkTimerRef = useRef(null); useEffect(() => { const handleMouseMove = (e: MouseEvent) => { const x = (e.clientX / window.innerWidth) * 2 - 1; const y = (e.clientY / window.innerHeight) * 2 - 1; setMousePos({ x, y }); }; if (!isClosed) window.addEventListener("mousemove", handleMouseMove); return () => window.removeEventListener("mousemove", handleMouseMove); }, [isClosed]); useEffect(() => { if (isClosed) { if (blinkTimerRef.current) clearTimeout(blinkTimerRef.current); if (unblinkTimerRef.current) clearTimeout(unblinkTimerRef.current); return; } const scheduleNextBlink = () => { const delay = Math.random() * 4000 + 1500; blinkTimerRef.current = setTimeout(() => { setIsBlinking(true); unblinkTimerRef.current = setTimeout(() => { setIsBlinking(false); scheduleNextBlink(); }, 150); }, delay); }; scheduleNextBlink(); return () => { if (blinkTimerRef.current) clearTimeout(blinkTimerRef.current); if (unblinkTimerRef.current) clearTimeout(unblinkTimerRef.current); }; }, [isClosed]); const maxOffset = 16; const eyeVariants: Variants = { open: { height: "48px", transition: { type: "spring", stiffness: 300, damping: 15, mass: 0.5 }, }, closed: { height: "0px", transition: { duration: 0.08, ease: "circIn" } }, }; const shouldBeClosed = isClosed || isBlinking; return (
{[1, 2].map((i) => (
{!isClosed && (
)} ))}
); } // --- ГЛАВНЫЙ КОМПОНЕНТ HERO --- export function Hero({ dict }: { dict: Dictionary["hero"] }) { const [isVpnOn, setIsVpnOn] = useState(false); const { resolvedTheme } = useTheme(); return (
{/* МАТРИЦА ГРУЗИТСЯ ТОЛЬКО НА КЛИЕНТЕ */} {/* Градиент */}
{isVpnOn ? ( ) : ( )} {isVpnOn ? dict.badgeSecure : dict.badge}

{dict.titleStart}{" "} {dict.titleHighlight}

{dict.subtitle}

Netrunner VPN
); }