import PropTypes from 'prop-types'; import { motion, AnimatePresence } from "framer-motion"; import { useTranslation } from "react-i18next"; import { useMemo, useState, useRef, useEffect } from 'react'; import { FiExternalLink, FiGithub, FiX, FiArrowRight, FiZap, FiCpu, FiLayers, FiSmartphone, FiCode, FiShoppingCart, FiBarChart2, FiGlobe, FiShield, FiFolder } from 'react-icons/fi'; import OptimizedImage from './OptimizedImage'; import GlassBackground from "./GlassBackground"; // Importaciones de imágenes import image1 from "/1.webp"; import image2 from "/2.webp"; import image3 from "/3.webp"; import image4 from "/4.webp"; import image5 from "/5.webp"; import image7 from "/7.webp"; import image8 from "/8.webp"; import image9 from "/9.webp"; import image10 from "/10.webp"; import image11 from "/11.webp"; import image12 from "/12.webp"; // Categorías con iconos y colores const categoryConfig = { 'AI/ML': { Icon: FiCpu, textClass: 'text-violet-300 dark:text-violet-300 light:text-violet-700' }, 'IA/ML': { Icon: FiCpu, textClass: 'text-violet-300 dark:text-violet-300 light:text-violet-700' }, 'AI/Expert Systems': { Icon: FiLayers, textClass: 'text-indigo-300 dark:text-indigo-300 light:text-indigo-700' }, 'IA/Sistemas Expertos': { Icon: FiLayers, textClass: 'text-indigo-300 dark:text-indigo-300 light:text-indigo-700' }, 'Mobile/Backend': { Icon: FiSmartphone, textClass: 'text-emerald-300 dark:text-emerald-300 light:text-emerald-700' }, 'Móvil/Backend': { Icon: FiSmartphone, textClass: 'text-emerald-300 dark:text-emerald-300 light:text-emerald-700' }, 'Full Stack': { Icon: FiCode, textClass: 'text-sky-300 dark:text-sky-300 light:text-sky-700' }, 'E-commerce': { Icon: FiShoppingCart, textClass: 'text-amber-300 dark:text-amber-300 light:text-amber-700' }, 'Data Science': { Icon: FiBarChart2, textClass: 'text-pink-300 dark:text-pink-300 light:text-pink-700' }, 'Ciencia Datos': { Icon: FiBarChart2, textClass: 'text-pink-300 dark:text-pink-300 light:text-pink-700' }, 'Web App': { Icon: FiGlobe, textClass: 'text-cyan-300 dark:text-cyan-300 light:text-cyan-700' }, 'App Web': { Icon: FiGlobe, textClass: 'text-cyan-300 dark:text-cyan-300 light:text-cyan-700' }, 'Backend/Security': { Icon: FiShield, textClass: 'text-slate-300 dark:text-slate-300 light:text-slate-700' }, 'Backend/Seguridad': { Icon: FiShield, textClass: 'text-slate-300 dark:text-slate-300 light:text-slate-700' } }; // Modal de proyecto expandido const ProjectModal = ({ project, projectData, onClose, technologies }) => { const { t } = useTranslation(); const hasResults = projectData.results && Array.isArray(projectData.results); const config = categoryConfig[projectData.category] || { Icon: FiFolder, textClass: 'text-adaptive' }; const CategoryIcon = config.Icon; const closeButtonRef = useRef(null); const previouslyFocusedRef = useRef(null); useEffect(() => { const handleKeyDown = (e) => { if (e.key === "Escape") onClose(); }; window.addEventListener("keydown", handleKeyDown); return () => window.removeEventListener("keydown", handleKeyDown); }, [onClose]); useEffect(() => { previouslyFocusedRef.current = document.activeElement; closeButtonRef.current?.focus?.(); return () => { const previous = previouslyFocusedRef.current; if (previous && typeof previous.focus === "function") previous.focus(); }; }, []); return ( {/* Backdrop con blur */}