/* ═══════════════════════════════════════════════════════════════ LandingPage — Hero section with GitHub URL input & code paste ═══════════════════════════════════════════════════════════════ */ import { useState } from 'react'; import { useScan } from '../context/ScanContext'; import ParticleBackground from './ParticleBackground'; import './LandingPage.css'; export default function LandingPage() { const { startScan } = useScan(); const [inputMode, setInputMode] = useState('url'); // 'url' or 'code' const [githubUrl, setGithubUrl] = useState(''); const [codeInput, setCodeInput] = useState(''); const [language, setLanguage] = useState('javascript'); const [isStarting, setIsStarting] = useState(false); const canScan = inputMode === 'url' ? githubUrl.trim().length > 0 : codeInput.trim().length > 0; const handleScan = async () => { if (!canScan || isStarting) return; // Request Notification permission on user gesture if ('Notification' in window && Notification.permission === 'default') { Notification.requestPermission(); } setIsStarting(true); const sessionId = `cs-${Math.random().toString(36).substring(2, 11)}-${Date.now()}`; let sourceType = 'github'; if (inputMode === 'url') { if (githubUrl.includes('huggingface.co')) { sourceType = 'huggingface'; } } else { sourceType = 'code'; } const payload = inputMode === 'url' ? { source_type: sourceType, source: githubUrl.trim(), session_id: sessionId } : { source_type: sourceType, source: codeInput.trim(), session_id: sessionId }; await startScan(payload); }; const handleKeyDown = (e) => { if (e.key === 'Enter' && !e.shiftKey && inputMode === 'url') { e.preventDefault(); handleScan(); } }; return (
{/* Header */}
🛡️ CodeSentry
{/* Hero */}
AI-Powered Security Intelligence

Secure Your Code
Before It Ships

3 AI agents analyze your codebase in real-time — detecting vulnerabilities, finding performance issues, and generating fixes. All locally, all privately.

{/* Privacy Banner */}
🔒 Your code never leaves this machine — 100% local inference, zero data retention
{/* Input Section */}
{/* Mode Tabs */}
{/* Input Area */}
{inputMode === 'url' ? (
🔗
setGithubUrl(e.target.value)} onKeyDown={handleKeyDown} autoFocus />
) : (
{codeInput.split('\n').filter(l => l.trim()).length} lines