import { useState, useMemo } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { Users, Tag, X, Mail, Phone, UserCheck, GraduationCap, Info, Atom, Wifi, Printer, Zap, Languages, Calculator, HeartHandshake, Rocket, Camera, Sparkles, Mic, Target, ArrowRight, RotateCcw, MessageCircle, ExternalLink, CheckCircle2, Compass, Globe, BookOpen, Heart, Building2, Search, Cpu, Smartphone, Bot, SlidersHorizontal, Layers, Activity, Brain } from 'lucide-react'; import SectionTitle from '@/components/SectionTitle/SectionTitle'; import { StaggerContainer, StaggerItem } from '@/components/AnimatedContainer/AnimatedContainer'; import AnimatedContainer from '@/components/AnimatedContainer/AnimatedContainer'; import { CLUBS_DATA } from '@/constants'; import type { Club } from '@/types'; const CLUB_CATEGORY_COLORS: Record = { Technical: '#3B82F6', Cultural: '#EC4899', Social: '#10B981', Creative: '#F59E0B', 'Center of Excellence': '#8B5CF6', }; const CLUB_ICON_MAP: Record> = { Atom, Wifi, Printer, Zap, Languages, Calculator, HeartHandshake, Rocket, Camera, Sparkles, Mic, BookOpen, Globe, Users, Cpu, Smartphone, Bot, Brain, Activity, }; // ─── Inline Brand SVG Icons ────────────────────────────────────────────────────── const InstagramIcon = ({ className = 'w-4 h-4' }: { className?: string }) => ( ); const LinkedinIcon = ({ className = 'w-4 h-4' }: { className?: string }) => ( ); const YoutubeIcon = ({ className = 'w-4 h-4' }: { className?: string }) => ( ); // ─── Quiz Questions Data (Supporting Clubs, Centers, and Hybrid Matching) ─────── const QUIZ_QUESTIONS_ALL = [ { id: 'domain', title: '1. What technology or activity domain excites you the most?', options: [ { label: '🤖 AI, Machine Learning, Neural Networks & Data Science', clubIds: ['center_ai', 'center_data_science', 'wistem'] }, { label: '⚡ Semiconductor VLSI, Microchip Architecture & Hardware', clubIds: ['center_semiconductor', 'steam'] }, { label: '📱 Apple iOS, SwiftUI & Mobile Ecosystem', clubIds: ['center_apple_tech', 'techspark'] }, { label: '🕶️ AR/VR, Metaverse, Spatial Computing & 3D Interactive Media', clubIds: ['center_ar_vr', 'mediastic'] }, { label: '🔒 Cybersecurity, Ethical Hacking & Cryptography', clubIds: ['center_cybersecurity', 'techspark'] }, { label: '🏥 Healthcare AI, RADAR Medical Diagnostics & Patient Care', clubIds: ['center_radar_healthcare', 'yrc'] }, { label: '📡 IoT, Smart Automation & Embedded Sensors', clubIds: ['center_iot', 'steam'] }, { label: '🚗 Electric Vehicles, Battery Systems & Autonomous Tech', clubIds: ['center_ev_energy', 'center_zf_transportation'] }, { label: '☁️ Cloud Architecture, DevOps & Distributed Systems', clubIds: ['center_cloud_computing', 'techspark'] }, { label: '🚀 Aerospace, Satellite Tech & Space Robotics', clubIds: ['center_space', 'steam'] }, { label: '⚛️ Quantum Computing, Quantum Search & Grover Algorithms', clubIds: ['grover_center_quantum', 'infinitus'] }, { label: '🎙️ Radio, Podcasting, Live Media & Content Creation', clubIds: ['podx', 'mediastic', 'helios'] }, { label: '🤝 Community Service, Village Adoption & NSS Drives', clubIds: ['nss', 'unnat_bharat', 'rotaract'] }, { label: '🎭 Cultural Arts, Dance, Music, Band & Drama', clubIds: ['artist_league', 'vaarithi', 'fusion'] }, ], }, { id: 'skill', title: '2. What practical skill do you want to master at RIT?', options: [ { label: '📊 Predictive Analytics, Python ML Pipelines & Data Modeling', clubIds: ['center_data_science', 'center_ai', 'center_zf_transportation'] }, { label: '💻 Microchip IC Layout, Verilog/VHDL & FPGA Prototyping', clubIds: ['center_semiconductor', 'steam'] }, { label: '🍎 Native iOS SwiftUI Coding & macOS Enterprise Apps', clubIds: ['center_apple_tech', 'techspark'] }, { label: '🥽 Unity 3D, Spatial Audio & Metaverse Experience Design', clubIds: ['center_ar_vr', 'mediastic'] }, { label: '🛡️ Network Security Audit, Cyber Threat Defense & Ethical Hacking', clubIds: ['center_cybersecurity'] }, { label: '🩺 Medical Signal Processing & AI Diagnosis Tools', clubIds: ['center_radar_healthcare', 'center_image_processing'] }, { label: '🔌 Smart Sensors, ESP32/Arduino, Edge Computing & CAN Bus', clubIds: ['center_iot', 'center_ev_energy'] }, { label: '🎙️ Voice Recording, Public Speaking & Event Management', clubIds: ['podx', 'yuva', 'artist_league'] }, { label: '🌱 Sustainable Rural Development & Eco-System Restoration', clubIds: ['unnat_bharat', 'nss', 'rotaract'] }, ], }, { id: 'goal', title: '3. What is your primary career aspiration during college?', options: [ { label: '🔬 Lead innovative research in a specialized Future Tech Center (CoE)', clubIds: ['center_ai', 'center_semiconductor', 'grover_center_quantum', 'center_apple_tech', 'center_space'] }, { label: '🏆 Win technical hackathons & build product prototypes', clubIds: ['steam', 'wistem', 'techspark', 'center_data_science'] }, { label: '🌟 Build a strong personal brand, public speaking & media portfolio', clubIds: ['podx', 'mediastic', 'helios'] }, { label: '🤝 Drive impactful social initiatives & community leadership', clubIds: ['nss', 'rotaract', 'yuva', 'wec'] }, { label: '💼 Connect with industry leaders, CII, and top startup networks', clubIds: ['yuva', 'wec', 'center_cloud_computing'] }, ], }, ]; export default function Events() { const [selectedClub, setSelectedClub] = useState(null); const [searchQuery, setSearchQuery] = useState(''); const [selectedCategory, setSelectedCategory] = useState('All'); const [selectedType, setSelectedType] = useState<'All' | 'Club' | 'Center'>('All'); // Compute counts dynamically const { totalCount, centersCount, clubsCount } = useMemo(() => { let centers = 0; let clubs = 0; CLUBS_DATA.forEach((item) => { const isCenter = item.type === 'Center' || item.category === 'Center of Excellence' || item.id.startsWith('center_') || item.id.includes('grover_center'); if (isCenter) centers++; else clubs++; }); return { totalCount: CLUBS_DATA.length, centersCount: centers, clubsCount: clubs }; }, []); // ─── Interactive Like System ───────────────────────────────────────────── const [likedClubs, setLikedClubs] = useState>(() => { try { localStorage.removeItem('rit_freshers_liked_clubs'); const saved = localStorage.getItem('rit_freshers_liked_clubs_v3'); return saved ? new Set(JSON.parse(saved)) : new Set(); } catch { return new Set(); } }); const [likesMap, setLikesMap] = useState>(() => { const initialMap: Record = {}; CLUBS_DATA.forEach((c) => { initialMap[c.id] = 0; }); return initialMap; }); const toggleLike = (clubId: string) => { const isCurrentlyLiked = likedClubs.has(clubId); const next = new Set(likedClubs); if (isCurrentlyLiked) { next.delete(clubId); setLikesMap((l) => ({ ...l, [clubId]: Math.max(0, (l[clubId] || 1) - 1) })); } else { next.add(clubId); setLikesMap((l) => ({ ...l, [clubId]: (l[clubId] || 0) + 1 })); } setLikedClubs(next); try { localStorage.setItem('rit_freshers_liked_clubs_v3', JSON.stringify(Array.from(next))); } catch {} }; // ─── Quiz Matcher State ────────────────────────────────────────────────── const [isQuizOpen, setIsQuizOpen] = useState(false); const [matcherTarget, setMatcherTarget] = useState<'All' | 'Club' | 'Center'>('All'); const [quizStep, setQuizStep] = useState(0); const [selectedAnswers, setSelectedAnswers] = useState([]); const [quizResults, setQuizResults] = useState<{ club: Club; score: number }[] | null>(null); const handleSelectOption = (optionIdx: number) => { const updated = [...selectedAnswers]; updated[quizStep] = optionIdx; setSelectedAnswers(updated); if (quizStep < QUIZ_QUESTIONS_ALL.length - 1) { setQuizStep(quizStep + 1); } else { calculateQuizResults(updated); } }; const calculateQuizResults = (answers: number[]) => { const scoreMap: Record = {}; CLUBS_DATA.forEach((c) => (scoreMap[c.id] = 0)); answers.forEach((ansIdx, qIdx) => { const option = QUIZ_QUESTIONS_ALL[qIdx].options[ansIdx]; if (option && option.clubIds) { option.clubIds.forEach((clubId, idx) => { scoreMap[clubId] = (scoreMap[clubId] || 0) + (5 - idx); }); } }); const pool = CLUBS_DATA.filter((c) => { const isCenter = c.type === 'Center' || c.category === 'Center of Excellence' || c.id.startsWith('center_') || c.id.includes('grover_center'); if (matcherTarget === 'Club') return !isCenter; if (matcherTarget === 'Center') return isCenter; return true; }); const ranked = pool .map((club) => ({ club, score: scoreMap[club.id] || 0, })) .sort((a, b) => b.score - a.score); setQuizResults(ranked.slice(0, 3)); }; const resetQuiz = () => { setQuizStep(0); setSelectedAnswers([]); setQuizResults(null); }; // ─── Filter Selection Handlers ─────────────────────────────────────────── const handleTypeSelect = (type: 'All' | 'Club' | 'Center') => { setSelectedType(type); setSelectedCategory('All'); }; const handleCategorySelect = (cat: string) => { setSelectedCategory(cat); if (cat === 'Center of Excellence') { setSelectedType('Center'); } else if (cat !== 'All') { setSelectedType('Club'); } else { setSelectedType('All'); } }; // ─── Robust Filter Logic ────────────────────────────────────────────────── const filteredData = useMemo(() => { return CLUBS_DATA.filter((item) => { const isCenter = item.type === 'Center' || item.category === 'Center of Excellence' || item.id.startsWith('center_') || item.id.includes('grover_center'); // 1. Type Filter check if (selectedType === 'Club' && isCenter) return false; if (selectedType === 'Center' && !isCenter) return false; // 2. Category Filter check if (selectedCategory !== 'All') { if (selectedCategory === 'Center of Excellence' && !isCenter) return false; if (selectedCategory !== 'Center of Excellence' && item.category !== selectedCategory) return false; } // 3. Search Query check const q = searchQuery.toLowerCase().trim(); if (q) { const matchesSearch = item.name.toLowerCase().includes(q) || item.description.toLowerCase().includes(q) || (item.details && item.details.toLowerCase().includes(q)) || (item.presidentName && item.presidentName.toLowerCase().includes(q)) || (item.coordinatorName && item.coordinatorName.toLowerCase().includes(q)); if (!matchesSearch) return false; } return true; }); }, [searchQuery, selectedCategory, selectedType]); const categoriesList = ['All', 'Center of Excellence', 'Technical', 'Social', 'Creative']; return (
{/* Header */}
RIT Official Directory

Student Clubs &{' '} Centers of Excellence

Explore official RIT student clubs, societies, and 15 Future Tech Centers of Excellence (CoEs), including faculty coordinators, research domains, and contact channels.

{/* ─── Interactive Matcher Banner ─────────────────────────────────── */}
{/* Background Glow */}
AI-Powered Matcher Quiz

Find Your Ideal Club or Future Tech Center!

Take our 3-step Matcher quiz to discover which of the 18 Student Clubs or 15 Future Tech Centers best match your skills, technology interests, and career goals!

{ setMatcherTarget('Center'); resetQuiz(); setIsQuizOpen(true); }} className="w-full sm:w-auto px-5 py-3 rounded-2xl bg-purple-600 hover:bg-purple-700 text-white font-semibold text-xs flex items-center justify-center gap-2 shadow-md cursor-pointer border border-purple-400/40" style={{ fontFamily: 'Poppins, sans-serif' }} > Match Centers (CoEs) { setMatcherTarget('All'); resetQuiz(); setIsQuizOpen(true); }} className="w-full sm:w-auto px-5 py-3 rounded-2xl text-white font-semibold text-xs flex items-center justify-center gap-2 shadow-md cursor-pointer" style={{ background: 'linear-gradient(135deg, #F97316, #FB923C)', fontFamily: 'Poppins, sans-serif' }} > Match All Directory
{/* ─── Search & Category Filters Bar ───────────────────────────────── */}
{/* Search & Type Toggle Controls */}
{/* Search Input */}
setSearchQuery(e.target.value)} className="w-full pl-10 pr-4 py-2.5 rounded-xl border border-slate-200 text-xs font-medium text-slate-800 focus:outline-none focus:border-[#F97316] transition-colors" style={{ fontFamily: 'Inter, sans-serif' }} /> {searchQuery && ( )}
{/* Type Pills Toggle (All / Clubs / Centers) */}
{[ { label: `All (${totalCount})`, value: 'All' }, { label: `Clubs (${clubsCount})`, value: 'Club' }, { label: `Centers of Excellence (${centersCount})`, value: 'Center' }, ].map((t) => ( ))}
{/* Category Filter Tabs */}
Filter: {categoriesList.map((cat) => ( ))}
{/* ─── Directory Grid ──────────────────────────────────────────────── */} {filteredData.length === 0 ? (

No matching items found

Try adjusting your search terms or filter selections.

) : (
{filteredData.map((club) => { const IconComponent = (club.icon && CLUB_ICON_MAP[club.icon]) || Atom; const isCenter = club.type === 'Center' || club.category === 'Center of Excellence' || club.id.startsWith('center_') || club.id.includes('grover_center'); const categoryColor = CLUB_CATEGORY_COLORS[club.category] || (isCenter ? '#8B5CF6' : '#F97316'); const isLiked = likedClubs.has(club.id); const likesCount = likesMap[club.id] || 0; return ( setSelectedClub(club)} className="bg-white rounded-2xl border border-[#E5E7EB] p-5 cursor-pointer hover:border-[#F97316] transition-all flex flex-col justify-between h-full group relative overflow-hidden" style={{ boxShadow: '0 2px 15px -3px rgba(0,0,0,0.07)' }} >
{/* Top Row: Icon/Logo + Badge + Heart Like Button */}
{club.logoUrl ? (
{club.name}
) : (
)}
{/* Type Badge */} {isCenter ? ( CENTER OF EXCELLENCE ) : ( CLUB )} {/* Like Button */} { e.stopPropagation(); toggleLike(club.id); }} className={`flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-semibold transition-all cursor-pointer border ${ isLiked ? 'bg-rose-50 border-rose-200 text-rose-600 shadow-2xs' : 'bg-slate-50 border-slate-200 text-slate-500 hover:border-rose-300 hover:text-rose-500' }`} > {likesCount}
{/* Title & Description */}

{club.name}

{club.description}

{/* Bottom Row: Category/Coordinator Tag & View Details Button */}
{isCenter ? : } {isCenter && club.coordinatorName ? club.coordinatorName : club.category} View Details
); })}
)}
{/* ─── Matcher Quiz Modal ────────────────────────────────────────────── */} {isQuizOpen && (
{/* Close Button */} {!quizResults ? (
{/* Quiz Target Selector Header */}
{matcherTarget === 'Center' ? 'Future Tech Center Matcher' : matcherTarget === 'Club' ? 'Student Club Matcher' : 'Interactive Directory Matcher'}
{/* Quiz Progress */}
Question {quizStep + 1} of {QUIZ_QUESTIONS_ALL.length} Step {quizStep + 1} / {QUIZ_QUESTIONS_ALL.length}
{/* Question Header */}

{QUIZ_QUESTIONS_ALL[quizStep].title}

{/* Options List */}
{QUIZ_QUESTIONS_ALL[quizStep].options.map((opt, idx) => ( ))}
{quizStep > 0 && ( )}
) : ( /* Results Screen */

Your Recommended Matches!

Based on your selections, here are your top recommended RIT entities:

{/* Top 3 Matches */}
{quizResults.map((item, i) => { const IconComponent = (item.club.icon && CLUB_ICON_MAP[item.club.icon]) || Atom; const isCenter = item.club.type === 'Center' || item.club.category === 'Center of Excellence' || item.club.id.startsWith('center_') || item.club.id.includes('grover_center'); const catColor = CLUB_CATEGORY_COLORS[item.club.category] || (isCenter ? '#8B5CF6' : '#F97316'); const matchPercent = i === 0 ? '98%' : i === 1 ? '92%' : '85%'; return (
{ setIsQuizOpen(false); setSelectedClub(item.club); }} className="p-4 rounded-2xl border border-slate-200 hover:border-[#F97316] bg-slate-50 hover:bg-white cursor-pointer transition-all flex items-center justify-between gap-3" >
{item.club.logoUrl ? (
{item.club.name}
) : (
)}
{item.club.name} {i === 0 && Top Match 🏆}
{isCenter ? (item.club.coordinatorName ? `CoE Lead: ${item.club.coordinatorName}` : 'Center of Excellence') : `${item.club.category} Club`}
{matchPercent}
); })}
)}
)} {/* ─── Detailed View Modal ───────────────────────────────────────────── */} {selectedClub && (
{/* Close Button */} {/* Modal Header */} {(() => { const IconComponent = (selectedClub.icon && CLUB_ICON_MAP[selectedClub.icon]) || Atom; const isCenter = selectedClub.type === 'Center' || selectedClub.category === 'Center of Excellence' || selectedClub.id.startsWith('center_') || selectedClub.id.includes('grover_center'); const categoryColor = CLUB_CATEGORY_COLORS[selectedClub.category] || (isCenter ? '#8B5CF6' : '#F97316'); const isLiked = likedClubs.has(selectedClub.id); const likesCount = likesMap[selectedClub.id] || 0; return (
{selectedClub.logoUrl ? (
{selectedClub.name}
) : (
)}
{selectedClub.category} {isCenter && ( CENTER OF EXCELLENCE )}

{selectedClub.name}

{/* Interactive Like Button */} toggleLike(selectedClub.id)} className={`px-4 py-2 rounded-xl text-xs font-bold flex items-center gap-2 transition-all cursor-pointer shadow-xs border shrink-0 ${ isLiked ? 'bg-rose-500 text-white border-rose-600 shadow-rose-200' : 'bg-rose-50 text-rose-600 border-rose-200 hover:bg-rose-100' }`} > {isLiked ? 'Liked' : 'Like'} ({likesCount})
); })()} {/* Detailed Description */}
About {selectedClub.type === 'Center' || selectedClub.category === 'Center of Excellence' ? 'the Center of Excellence' : 'the Club'}

{selectedClub.details || selectedClub.description}

{/* Leadership & Contact Cards */}
{/* Faculty Coordinator Card */} {selectedClub.coordinatorName && (
{selectedClub.type === 'Center' || selectedClub.category === 'Center of Excellence' ? 'Faculty Co-ordinator' : 'Faculty Coordinator'} {selectedClub.coordinatorName}
)} {/* President / Student Lead Card */} {selectedClub.presidentName && (
{selectedClub.type === 'Center' || selectedClub.category === 'Center of Excellence' ? 'Research / Student Lead' : 'President / Student Lead'} {selectedClub.presidentName}
)} {/* Vice President Card */} {selectedClub.vicePresidentName && (
Vice President {selectedClub.vicePresidentName}
)} {/* Contact Email */} {selectedClub.contactEmail && ( )}
{/* Social & Community Links */} {Boolean( selectedClub.socialLinks?.instagram || selectedClub.socialLinks?.linkedin || selectedClub.socialLinks?.whatsapp || selectedClub.socialLinks?.youtube ) && (
Social & Community Links
✓ Verified RIT Entity
{selectedClub.socialLinks?.instagram && ( Instagram )} {selectedClub.socialLinks?.linkedin && ( LinkedIn )} {selectedClub.socialLinks?.whatsapp && ( WhatsApp Group )} {selectedClub.socialLinks?.youtube && ( YouTube Channel )}
)} {/* Close Button */}
)}
); }