import { useState, useEffect, useRef } from 'react' import { motion, AnimatePresence } from 'framer-motion' import { FiTerminal, FiX, FiMinus, FiMaximize2 } from 'react-icons/fi' import resumePDF from '../assets/Resume.pdf' const PROFILE = { name: 'Parthib Karak', title: 'Software & AI Engineer', location: 'West Bengal, India', college: 'IEM Kolkata (B.Tech CSE)', cgpa: '8.9', email: 'parthibkarak2004@gmail.com', github: 'https://github.com/babaiii07', linkedin: 'https://www.linkedin.com/in/parthib-karak', leetcode: 'https://leetcode.com/u/Parthib_007', } const COMMANDS = { help: { desc: 'Show all available commands', run: () => [ { type: 'title', text: '๐Ÿ“‹ Available Commands' }, { type: 'divider' }, { type: 'cmd', text: 'whoami โ†’ Who is Parthib?' }, { type: 'cmd', text: 'skills โ†’ Technical skill stack' }, { type: 'cmd', text: 'projects โ†’ Featured AI projects' }, { type: 'cmd', text: 'experience โ†’ Work experience' }, { type: 'cmd', text: 'education โ†’ Academic background' }, { type: 'cmd', text: 'contact โ†’ Get in touch' }, { type: 'cmd', text: 'resume โ†’ Download resume' }, { type: 'cmd', text: 'leetcode โ†’ DSA stats' }, { type: 'cmd', text: 'hire โ†’ Why hire Parthib?' }, { type: 'cmd', text: 'clear โ†’ Clear terminal' }, { type: 'cmd', text: 'help โ†’ Show this menu' }, { type: 'divider' }, { type: 'info', text: '๐Ÿ’ก Tip: Use โ†‘ โ†“ arrow keys for command history' }, ], }, whoami: { desc: 'Who is Parthib?', run: () => [ { type: 'title', text: '๐Ÿ‘ค Parthib Karak' }, { type: 'divider' }, { type: 'kv', key: 'Role ', value: 'Software & AI Engineer' }, { type: 'kv', key: 'Location', value: 'West Bengal, India' }, { type: 'kv', key: 'College ', value: 'IEM Kolkata โ€” B.Tech CSE' }, { type: 'kv', key: 'CGPA ', value: '8.9 / 10.0' }, { type: 'kv', key: 'Status ', value: '๐ŸŸข Open to Opportunities' }, { type: 'divider' }, { type: 'text', text: 'Building production-grade AI systems that don\'t break in the' }, { type: 'text', text: 'real world. Specialising in RAG, multi-agent systems, and LLM' }, { type: 'text', text: 'engineering with LangChain, LangGraph, and Groq.' }, ], }, skills: { desc: 'Technical skill stack', run: () => [ { type: 'title', text: '๐Ÿ› ๏ธ Technical Skills' }, { type: 'divider' }, { type: 'category', text: 'AI / ML / LLMs' }, { type: 'tags', items: ['LangChain', 'LangGraph', 'Groq', 'RAG', 'AutoGen', 'HuggingFace', 'Transformers'] }, { type: 'category', text: 'Backend' }, { type: 'tags', items: ['FastAPI', 'Django', 'Go / Gin', 'REST APIs', 'WebSockets'] }, { type: 'category', text: 'Databases & Vector Stores' }, { type: 'tags', items: ['MongoDB', 'MySQL', 'FAISS', 'ChromaDB', 'Pinecone'] }, { type: 'category', text: 'Languages' }, { type: 'tags', items: ['Python', 'JavaScript', 'TypeScript', 'Go', 'C++'] }, { type: 'category', text: 'Tools & DevOps' }, { type: 'tags', items: ['Docker', 'Git', 'GitHub', 'Postman', 'VS Code'] }, ], }, projects: { desc: 'Featured AI projects', run: () => [ { type: 'title', text: '๐Ÿš€ Featured Projects' }, { type: 'divider' }, { type: 'proj', num: '01', name: 'Healthcare Chatbot', tech: 'RAG ยท Pinecone ยท LangChain ยท Groq', url: 'https://parthib07-multiagent-healthcare-chatbot.hf.space' }, { type: 'proj', num: '02', name: 'AI Virtual Dev POD', tech: 'Multi-Agent ยท LangGraph ยท ChromaDB', url: 'https://agnik28-ai-virtual-pod.hf.space/' }, { type: 'proj', num: '03', name: 'Virtual Research Assistant', tech: 'AutoGen ยท Groq ยท MySQL', url: 'https://parthib07-virtual-research-paper-assistant.hf.space/' }, { type: 'proj', num: '04', name: 'OwnGPT', tech: 'FastAPI ยท LangGraph ยท MongoDB ยท Google Auth', url: 'https://parthib07-owngpt-v2.hf.space' }, { type: 'proj', num: '05', name: 'CodeFusion', tech: 'DeepSeek AI ยท FastAPI ยท React', url: 'https://codefusion-v2-parthib.onrender.com' }, { type: 'proj', num: '06', name: 'AnySITE', tech: 'FastAPI ยท React ยท AI Models', url: 'https://anysite-vibecoding-parthib.onrender.com' }, { type: 'divider' }, { type: 'info', text: '๐Ÿ”— Run "contact" to connect or visit GitHub for source code' }, ], }, experience: { desc: 'Work experience', run: () => [ { type: 'title', text: '๐Ÿ’ผ Work Experience' }, { type: 'divider' }, { type: 'kv', key: 'Company ', value: 'BAAR Technologies' }, { type: 'kv', key: 'Role ', value: 'Jr. Automation Engineer' }, { type: 'kv', key: 'Type ', value: 'Full-time' }, { type: 'kv', key: 'Period ', value: 'Feb 2026 โ€“ Mar 2026 ยท 2 mos' }, { type: 'kv', key: 'Location', value: 'Kolkata, West Bengal ยท On-site' }, { type: 'text', text: '' }, { type: 'text', text: 'โ†’ Built automation-driven backend systems using Python & Django' }, { type: 'text', text: 'โ†’ Managed high-performance databases with Microsoft SQL Server' }, { type: 'text', text: 'โ†’ Developed scalable APIs and optimised SQL queries & procedures' }, { type: 'text', text: 'โ†’ Collaborated cross-functionally to deliver reliable automation solutions' }, ], }, education: { desc: 'Academic background', run: () => [ { type: 'title', text: '๐ŸŽ“ Education' }, { type: 'divider' }, { type: 'kv', key: 'Degree ', value: 'B.Tech โ€” Computer Science & Engineering' }, { type: 'kv', key: 'College ', value: 'Institute of Engineering & Management, Kolkata' }, { type: 'kv', key: 'CGPA ', value: '8.9 / 10.0' }, { type: 'kv', key: 'Year ', value: '2021 โ€“ 2025' }, { type: 'divider' }, { type: 'kv', key: 'Class XII', value: '93.6% โ€” Kapsit High School (2021)' }, { type: 'kv', key: 'Class X ', value: '84.5% โ€” Kamarpukur RKM School (2019)' }, ], }, contact: { desc: 'Get in touch', run: () => [ { type: 'title', text: '๐Ÿ“ฌ Contact Parthib' }, { type: 'divider' }, { type: 'link', label: 'Email ', value: 'parthibkarak2004@gmail.com', href: 'mailto:parthibkarak2004@gmail.com' }, { type: 'link', label: 'LinkedIn', value: 'linkedin.com/in/parthib-karak', href: 'https://www.linkedin.com/in/parthib-karak' }, { type: 'link', label: 'GitHub ', value: 'github.com/babaiii07', href: 'https://github.com/babaiii07' }, { type: 'link', label: 'LeetCode', value: 'leetcode.com/u/Parthib_007', href: 'https://leetcode.com/u/Parthib_007' }, { type: 'divider' }, { type: 'info', text: '๐Ÿ’Œ Available for freelance, internship & full-time roles' }, ], }, resume: { desc: 'Download resume', run: () => { setTimeout(() => { window.open(resumePDF, '_blank') }, 300) return [ { type: 'title', text: '๐Ÿ“„ Resume' }, { type: 'divider' }, { type: 'success', text: 'โœ… Opening resume in a new tab...' }, { type: 'info', text: '๐Ÿ“ฅ Download will start automatically' }, ] }, }, leetcode: { desc: 'DSA stats', run: () => [ { type: 'title', text: 'โšก LeetCode Stats' }, { type: 'divider' }, { type: 'kv', key: 'Profile ', value: 'leetcode.com/u/Parthib_007' }, { type: 'kv', key: 'Solved ', value: '500+ Problems' }, { type: 'kv', key: 'Strength', value: 'Arrays ยท DP ยท Graphs ยท Trees ยท Strings' }, { type: 'divider' }, { type: 'text', text: 'โ†’ Strong DSA foundation for system design & optimization' }, { type: 'text', text: 'โ†’ Active in competitive programming contests' }, ], }, hire: { desc: 'Why hire Parthib?', run: () => [ { type: 'title', text: '๐ŸŒŸ Why Hire Parthib?' }, { type: 'divider' }, { type: 'text', text: 'โœฆ Builds production-ready AI โ€” not just demos' }, { type: 'text', text: 'โœฆ Specialised in RAG, Agents, LangChain & LangGraph' }, { type: 'text', text: 'โœฆ 500+ LeetCode โ€” strong algorithmic foundations' }, { type: 'text', text: 'โœฆ CGPA 8.9 โ€” academic excellence under real workload' }, { type: 'text', text: 'โœฆ End-to-end: from LLM to Docker to production deploy' }, { type: 'text', text: 'โœฆ Fast learner, self-driven, ships things that work' }, { type: 'divider' }, { type: 'success', text: '๐Ÿš€ Ready to contribute from day one โ€” run "contact" to connect!' }, ], }, clear: { desc: 'Clear terminal', run: () => null, }, } function renderLine(line, i) { const base = { fontSize: '0.78rem', lineHeight: 1.7, fontFamily: 'var(--font-mono)' } switch (line.type) { case 'title': return
{line.text}
case 'divider': return
{'โ”€'.repeat(44)}
case 'kv': return (
{line.key} {line.value}
) case 'text': return
{line.text || '\u00A0'}
case 'info': return
{line.text}
case 'success': return
{line.text}
case 'cmd': return
{line.text}
case 'category': return
{line.text}
case 'tags': return (
{line.items.map((t, j) => ( {t} ))}
) case 'proj': return (
{line.num} {line.name} {line.tech} {line.url && ( โ†— live )}
) case 'link': return (
{line.label} e.target.style.textDecoration = 'underline'} onMouseLeave={e => e.target.style.textDecoration = 'none'}> {line.value}
) default: return null } } export default function Terminal() { const [open, setOpen] = useState(false) const [input, setInput] = useState('') const [history, setHistory] = useState([]) const [cmdHistory, setCmdHistory] = useState([]) const [histIdx, setHistIdx] = useState(-1) const inputRef = useRef(null) const bottomRef = useRef(null) // Welcome message on first open useEffect(() => { if (open && history.length === 0) { setHistory([{ type: 'welcome', lines: [ { type: 'title', text: 'โšก Parthib\'s Portfolio Terminal' }, { type: 'divider' }, { type: 'text', text: 'Welcome, recruiter! Type "help" to see all commands.' }, { type: 'text', text: 'Explore my profile interactively below.' }, { type: 'divider' }, { type: 'info', text: 'โ†’ Try: whoami ยท skills ยท projects ยท hire ยท resume' }, ], }]) } }, [open]) useEffect(() => { if (open) { setTimeout(() => inputRef.current?.focus(), 80) } }, [open]) useEffect(() => { bottomRef.current?.scrollIntoView({ behavior: 'smooth' }) }, [history]) const runCommand = (raw) => { const cmd = raw.trim().toLowerCase() if (!cmd) return setCmdHistory(prev => [cmd, ...prev]) setHistIdx(-1) if (cmd === 'clear') { setHistory([]) return } const def = COMMANDS[cmd] const outputLines = def ? def.run() : [ { type: 'text', text: `bash: ${cmd}: command not found` }, { type: 'info', text: 'Type "help" to see available commands.' }, ] setHistory(prev => [ ...prev, { type: 'entry', cmd, lines: outputLines || [] }, ]) } const handleKey = (e) => { if (e.key === 'Enter') { runCommand(input) setInput('') } else if (e.key === 'ArrowUp') { e.preventDefault() const next = Math.min(histIdx + 1, cmdHistory.length - 1) setHistIdx(next) setInput(cmdHistory[next] ?? '') } else if (e.key === 'ArrowDown') { e.preventDefault() const next = Math.max(histIdx - 1, -1) setHistIdx(next) setInput(next === -1 ? '' : cmdHistory[next] ?? '') } } return ( <> {/* Floating Toggle Button */} setOpen(v => !v)} style={{ position: 'fixed', bottom: 28, right: 28, zIndex: 9998, width: 52, height: 52, borderRadius: '50%', background: 'linear-gradient(135deg, #6366f1, #06b6d4)', border: 'none', cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#fff', fontSize: '1.25rem', boxShadow: '0 8px 32px rgba(99,102,241,0.55), 0 2px 8px rgba(0,0,0,0.4)', }} whileHover={{ scale: 1.1, boxShadow: '0 12px 40px rgba(99,102,241,0.7)' }} whileTap={{ scale: 0.95 }} title="Open Portfolio Terminal" aria-label="Open terminal" > {open ? : } {/* Terminal Window */} {open && ( inputRef.current?.focus()} > {/* Title Bar */}
{['#f43f5e', '#f59e0b', '#4ade80'].map((c, i) => (
setOpen(false) : undefined} /> ))}
parthib@portfolio ~ zsh
{/* Output Area */}
{history.map((entry, ei) => (
{entry.type === 'entry' && (
parthib @portfolio ~ $ {entry.cmd}
)} {entry.lines?.map((line, li) => renderLine(line, li))}
))}
{/* Input Row */}
parthib @portfolio ~ $ setInput(e.target.value)} onKeyDown={handleKey} placeholder="type a command..." autoComplete="off" spellCheck={false} style={{ flex: 1, background: 'none', border: 'none', outline: 'none', fontFamily: 'var(--font-mono)', fontSize: '0.78rem', color: '#e2e8f0', caretColor: '#a78bfa', }} />
)} ) }