diff --git a/frontend/src/pages/AIInterviewAnswerFollowUpRiskDetector/AIInterviewAnswerFollowUpRiskDetector b/frontend/src/pages/AIInterviewAnswerFollowUpRiskDetector/AIInterviewAnswerFollowUpRiskDetector new file mode 100644 index 00000000..8e64190f --- /dev/null +++ b/frontend/src/pages/AIInterviewAnswerFollowUpRiskDetector/AIInterviewAnswerFollowUpRiskDetector @@ -0,0 +1,1521 @@ +import React, { useMemo, useState } from "react"; +import { + Brain, + ShieldAlert, + AlertTriangle, + CheckCircle2, + Sparkles, + MessageSquare, + TrendingUp, + Target, + BarChart3, + Lightbulb, + RefreshCw, + ArrowRight, + Award, + Search, + HelpCircle, + MessageCircleQuestion, + CircleAlert, + ShieldCheck, + BookOpen, + ChevronDown, + ChevronUp, +} from "lucide-react"; + +const AIInterviewAnswerFollowUpRiskDetector = () => { + const [selectedAnswer, setSelectedAnswer] = useState(0); + const [activeTab, setActiveTab] = useState("analysis"); + const [analyzing, setAnalyzing] = useState(false); + const [expandedQuestion, setExpandedQuestion] = useState(null); + + const answers = [ + { + question: "Tell me about a project where you used machine learning.", + type: "Project Discussion", + difficulty: "Medium", + original: + "I built an AI-based plant disease detection system using a CNN model. I trained the model on a large image dataset and achieved around 95% accuracy. I used data augmentation to improve the model and deployed it using a cloud API. The model was optimized so that it could process images very quickly.", + readinessScore: 68, + riskLevel: "Medium", + challengeableCount: 4, + improved: + "I built a plant disease detection system using a CNN trained on a labeled image dataset. I used data augmentation to improve generalization and evaluated the model using accuracy and validation performance. I exposed the trained model through an API so users could submit images for prediction. I also optimized inference to reduce response time.", + statements: [ + { + statement: + "I trained the model on a large image dataset.", + risk: "Medium", + reason: + "An interviewer may ask about dataset size, source, class distribution, and preprocessing.", + followUps: [ + "How large was the dataset?", + "Where did the dataset come from?", + "How many disease classes did you have?", + ], + preparation: + "Be ready to explain the dataset size, source, class distribution, and preprocessing pipeline.", + }, + { + statement: + "I achieved around 95% accuracy.", + risk: "High", + reason: + "A specific performance claim naturally invites questions about validation, test data, and possible overfitting.", + followUps: [ + "Was the 95% accuracy measured on training, validation, or test data?", + "How did you prevent overfitting?", + "What other evaluation metrics did you use?", + ], + preparation: + "Know exactly how the metric was calculated and be prepared to discuss precision, recall, F1-score, and validation methodology.", + }, + { + statement: + "I used data augmentation to improve the model.", + risk: "Medium", + reason: + "The interviewer may ask which augmentation techniques were used and why they helped.", + followUps: [ + "Which augmentation techniques did you use?", + "Why did augmentation improve performance?", + "Could augmentation introduce unrealistic images?", + ], + preparation: + "Understand techniques such as rotation, flipping, cropping, scaling, and brightness changes.", + }, + { + statement: + "The model was optimized so that it could process images very quickly.", + risk: "High", + reason: + "This is a broad performance claim without a measurable result.", + followUps: [ + "How did you optimize inference?", + "What was the original and final response time?", + "Did you use model quantization or another optimization technique?", + ], + preparation: + "Be prepared to provide actual latency measurements and describe the optimization techniques used.", + }, + ], + strengths: [ + "Clearly explains the main purpose of the project.", + "Mentions relevant machine-learning techniques.", + "Connects model development with deployment.", + ], + recommendations: [ + "Add measurable evidence to performance claims.", + "Review the model evaluation methodology.", + "Prepare deeper explanations for optimization decisions.", + ], + }, + { + question: "How did you design the authentication system for your application?", + type: "System Design", + difficulty: "Hard", + original: + "I implemented JWT authentication because it is secure and scalable. The token is generated after login and stored in the browser. I used refresh tokens to make the system more secure and the API validates the JWT on every request.", + readinessScore: 61, + riskLevel: "High", + challengeableCount: 4, + improved: + "I implemented JWT-based authentication where the server issues an access token after successful authentication. The API validates the token on protected requests, while refresh tokens can be used to obtain new access tokens without requiring the user to log in again. The exact storage strategy and token lifetime are selected based on the application's security requirements.", + statements: [ + { + statement: + "JWT authentication is secure and scalable.", + risk: "High", + reason: + "Security depends on token handling, expiration, storage, signing, and application architecture.", + followUps: [ + "Why did you choose JWT instead of sessions?", + "How did you protect the JWT?", + "How do you handle token expiration?", + ], + preparation: + "Understand JWT signing, expiration, storage risks, refresh tokens, and revocation strategies.", + }, + { + statement: + "The token is stored in the browser.", + risk: "High", + reason: + "An interviewer may challenge where the token is stored and ask about XSS and CSRF risks.", + followUps: [ + "Did you use localStorage or cookies?", + "How did you protect the token from XSS?", + "How did you handle CSRF protection?", + ], + preparation: + "Know the security tradeoffs of HttpOnly cookies, localStorage, sessionStorage, CSRF protection, and XSS.", + }, + { + statement: + "I used refresh tokens to make the system more secure.", + risk: "Medium", + reason: + "Refresh tokens improve session usability but require careful lifecycle and storage management.", + followUps: [ + "Where did you store refresh tokens?", + "How can a refresh token be revoked?", + "How long did refresh tokens remain valid?", + ], + preparation: + "Understand refresh-token rotation, expiration, revocation, and secure storage.", + }, + { + statement: + "The API validates the JWT on every request.", + risk: "Low", + reason: + "This is reasonable, but an interviewer may ask what validation actually includes.", + followUps: [ + "What exactly do you validate in the JWT?", + "How do you verify the signature?", + ], + preparation: + "Review signature verification, expiration, issuer, audience, and authorization checks.", + }, + ], + strengths: [ + "Identifies JWT as an authentication mechanism.", + "Understands the role of access and refresh tokens.", + "Recognizes that protected APIs need authentication validation.", + ], + recommendations: [ + "Review JWT security tradeoffs.", + "Prepare to explain token storage decisions.", + "Understand refresh-token lifecycle management.", + ], + }, + { + question: "Why did you choose React for your frontend project?", + type: "Technology Decision", + difficulty: "Medium", + original: + "I chose React because it is faster than other frontend frameworks and it is the best framework for building modern applications. React also makes everything reusable and automatically improves performance.", + readinessScore: 57, + riskLevel: "High", + challengeableCount: 4, + improved: + "I chose React because its component-based architecture fits the structure of the application. Reusable components helped us maintain consistent UI patterns, while the ecosystem provided libraries and tools that matched our project requirements. The choice was based on our team's familiarity, project needs, and available ecosystem rather than assuming React is universally better.", + statements: [ + { + statement: + "React is faster than other frontend frameworks.", + risk: "High", + reason: + "This is a broad comparative claim without defining the workload or benchmark.", + followUps: [ + "Faster in which scenario?", + "Which frameworks did you compare?", + "What benchmark did you use?", + ], + preparation: + "Avoid unsupported comparisons and be prepared to explain performance based on a specific use case.", + }, + { + statement: + "React is the best framework for modern applications.", + risk: "High", + reason: + "There is no universally best framework; the interviewer may challenge your criteria.", + followUps: [ + "Why React instead of Vue or Angular?", + "What project requirements influenced your decision?", + "What are React's disadvantages?", + ], + preparation: + "Understand the tradeoffs between React and alternative frontend technologies.", + }, + { + statement: + "React makes everything reusable.", + risk: "Medium", + reason: + "React encourages component reuse, but not every part of an application is automatically reusable.", + followUps: [ + "What components did you reuse?", + "How did you structure your components?", + ], + preparation: + "Prepare concrete examples of reusable components from your project.", + }, + { + statement: + "React automatically improves performance.", + risk: "High", + reason: + "React provides mechanisms that can support performance, but performance improvements require appropriate architecture and optimization.", + followUps: [ + "How did React improve your application's performance?", + "Did you use memoization?", + "How did you measure performance?", + ], + preparation: + "Review React rendering, memoization, lazy loading, code splitting, and performance profiling.", + }, + ], + strengths: [ + "Provides a clear reason for selecting React.", + "Recognizes component reusability.", + "Connects technology choice with application development.", + ], + recommendations: [ + "Replace absolute claims with evidence-based reasoning.", + "Prepare comparisons with alternative technologies.", + "Know the limitations of the technology you selected.", + ], + }, + ]; + + const selected = answers[selectedAnswer]; + + const overallReadiness = useMemo(() => { + return Math.round( + answers.reduce( + (sum, answer) => sum + answer.readinessScore, + 0 + ) / answers.length + ); + }, []); + + const highRiskCount = useMemo(() => { + return selected.statements.filter( + (item) => item.risk === "High" + ).length; + }, [selected]); + + const getRiskColor = (risk) => { + if (risk === "High") return "text-red-600"; + if (risk === "Medium") return "text-orange-500"; + return "text-green-600"; + }; + + const getRiskBackground = (risk) => { + if (risk === "High") { + return "bg-red-50 dark:bg-red-900/10 border-red-200 dark:border-red-900/30"; + } + + if (risk === "Medium") { + return "bg-orange-50 dark:bg-orange-900/10 border-orange-200 dark:border-orange-900/30"; + } + + return "bg-green-50 dark:bg-green-900/10 border-green-200 dark:border-green-900/30"; + }; + + const getReadinessLabel = (score) => { + if (score >= 85) return "Follow-Up Ready"; + if (score >= 70) return "Mostly Ready"; + if (score >= 55) return "Needs Practice"; + return "High Follow-Up Risk"; + }; + + const handleAnalyze = () => { + setAnalyzing(true); + + setTimeout(() => { + setAnalyzing(false); + setActiveTab("analysis"); + }, 800); + }; + + const toggleQuestion = (index) => { + setExpandedQuestion( + expandedQuestion === index ? null : index + ); + }; + + return ( +
+ Identify claims that may trigger difficult follow-up + questions and practice defending your answers. +
+ ++ Answers Analyzed +
+ ++ 32 +
+ ++ Follow-Up Risks +
+ ++ 41 +
+ ++ Follow-Up Readiness +
+ ++ {overallReadiness}% +
+ ++ Questions Practiced +
+ ++ 76 +
+ ++ AI identifies statements that naturally invite deeper + questioning. It predicts likely follow-up questions, explains + why an interviewer may challenge the statement, and helps + you practice honest, well-supported responses. +
+ ++ Interview Question +
+ += 70 + ? "text-green-600" + : "text-orange-500" + }`} + > + {selected.readinessScore}% +
+ ++ {getReadinessLabel( + selected.readinessScore + )} +
+ ++ This score estimates how prepared you are to defend the + claims and technical decisions mentioned in your answer. +
+ ++ {selected.challengeableCount} +
+ ++ statements may trigger deeper questioning +
+ ++ {selected.original} +
+ ++ Readiness +
+ ++ {selected.readinessScore}% +
+ ++ Challengeable Statements +
+ ++ {selected.challengeableCount} +
+ ++ Status +
+ ++ Needs Follow-Up Practice +
+ ++ "{item.statement}" +
+ ++ Why could this be challenged? +
+ ++ {item.reason} +
+ ++ {question} +
+ ++ {item.preparation} +
+ + + ++ {item.description} +
+ ++ {selected.improved} +
+ ++ Why this version is stronger +
+ ++ It avoids unsupported absolute claims, provides more + precise technical language, and makes the reasoning + behind important decisions easier to defend. +
+ ++ {strength} +
+ ++ {item.score}% +
+ ++ Risk level +
+ ++ {item.example} +
+ ++ {item.label} +
+ ++ {item.score}% +
+ ++ Current Strength +
+ ++ You explain the main purpose of your projects clearly. + Focus next on defending the technical details behind them. +
+ ++ Biggest Opportunity +
+ ++ Broad statements about performance, security, or technology + choices are the most likely to trigger difficult questions. +
+ ++ Next Practice Goal +
+ ++ For every major project decision, prepare a concise + explanation of why you chose that approach and what + alternatives you considered. +
+ ++ Your answers contain useful technical information, but + several claims could invite deeper questioning. Practice + explaining the evidence, reasoning, and implementation + behind each important statement. +
+ ++ {overallReadiness}% +
+ ++ {getReadinessLabel(overallReadiness)} +
+ ++ The goal is not to avoid every follow-up question. + Strong candidates should be able to explain and defend + the important claims they make. Focus on understanding + your technical decisions, supporting performance claims + with evidence, and being honest about what you personally + implemented or know. +
+ ++ {overallReadiness}% +
+ +