'use client'; import { useState } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { useRouter } from 'next/navigation'; import { useInterview } from '@/context/InterviewContext'; import { INTERVIEW_ROLES } from '@/lib/roles'; import { InterviewRole } from '@/types/interview'; import { ArrowRight, Gauge, Hash, Sparkles, ChevronRight, Clock, Timer, } from 'lucide-react'; type Difficulty = 'beginner' | 'intermediate' | 'advanced'; const difficultyConfig: Record = { beginner: { label: 'Beginner', description: 'Fundamentals & basic concepts', color: 'var(--success)', icon: '🌱', }, intermediate: { label: 'Intermediate', description: 'Practical application & problem-solving', color: 'var(--warning)', icon: '⚑', }, advanced: { label: 'Advanced', description: 'System design & deep expertise', color: 'var(--danger)', icon: 'πŸ”₯', }, }; const questionCounts = [5, 8, 10, 15]; const timeLimits = [ { value: 0, label: 'No Limit', icon: '♾️' }, { value: 15, label: '15 min', icon: '⏱️' }, { value: 29, label: '29 min', icon: 'πŸ”₯' }, { value: 45, label: '45 min', icon: '⏰' }, ]; export default function InterviewPage() { const router = useRouter(); const { startSession } = useInterview(); const [selectedRole, setSelectedRole] = useState(null); const [difficulty, setDifficulty] = useState('intermediate'); const [questionCount, setQuestionCount] = useState(5); const [timeLimit, setTimeLimit] = useState(29); const [step, setStep] = useState<1 | 2>(1); const handleStartInterview = () => { if (!selectedRole) return; startSession({ role: selectedRole, difficulty, questionCount, timeLimit, }); router.push('/interview/session'); }; return (
{/* Header */}
Step {step} of 2

{step === 1 ? ( <>Choose Your Interview Role ) : ( <>Configure Your Interview )}

{step === 1 ? 'Select the position you want to practice interviewing for' : 'Set your difficulty level and number of questions'}

{step === 1 ? ( /* Step 1: Role Selection */ {INTERVIEW_ROLES.map((role, i) => ( { setSelectedRole(role); setStep(2); }} className="group text-left p-5 rounded-2xl transition-all duration-300 cursor-pointer" style={{ background: selectedRole?.id === role.id ? `${role.color}10` : 'var(--card)', border: `1px solid ${selectedRole?.id === role.id ? role.color : 'var(--border)'}`, }} onMouseEnter={(e) => { e.currentTarget.style.borderColor = role.color; e.currentTarget.style.background = `${role.color}08`; e.currentTarget.style.transform = 'translateY(-4px)'; e.currentTarget.style.boxShadow = `0 8px 30px ${role.color}20`; }} onMouseLeave={(e) => { e.currentTarget.style.borderColor = selectedRole?.id === role.id ? role.color : 'var(--border)'; e.currentTarget.style.background = selectedRole?.id === role.id ? `${role.color}10` : 'var(--card)'; e.currentTarget.style.transform = 'translateY(0)'; e.currentTarget.style.boxShadow = 'none'; }} >
{role.icon}

{role.title}

{role.description}

{role.topics.slice(0, 3).map((topic) => ( {topic} ))} {role.topics.length > 3 && ( +{role.topics.length - 3} )}
))}
) : ( /* Step 2: Configuration */ {/* Selected Role Card */} {selectedRole && (
setStep(1)} > {selectedRole.icon}

{selectedRole.title}

{selectedRole.description}

Change β†’
)} {/* Difficulty Selection */}
{(Object.entries(difficultyConfig) as [Difficulty, typeof difficultyConfig.beginner][]).map(([key, config]) => ( ))}
{/* Question Count */}
{questionCounts.map((count) => ( ))}
{/* Exam Timer */}
{timeLimits.map((tl) => ( ))}
{timeLimit > 0 && (

Interview will auto-submit after {timeLimit} minutes

)}
{/* Start Button */} Start Interview {/* Back button */}
)}
); }