'use client'; import { motion } from 'framer-motion'; import { User, Globe, Network, Server, Shield, ArrowDown, ArrowRight, CheckCircle } from 'lucide-react'; const steps = [ { id: 1, title: 'User Request', description: 'User types domain', icon: User, color: 'blue', }, { id: 2, title: 'DNS Query', description: 'P2NS DNS Server', icon: Globe, color: 'purple', }, { id: 3, title: 'P2P Network', description: 'Find Domain Hash', icon: Network, color: 'green', }, { id: 4, title: 'Virtual Interface', description: 'Assign Local IP', icon: Server, color: 'orange', }, { id: 5, title: 'Holesail Client', description: 'Establish Tunnel', icon: Shield, color: 'red', }, { id: 6, title: 'HTTPS Proxy', description: 'Route Request', icon: Server, color: 'indigo', }, { id: 7, title: 'Service Response', description: 'Back to User', icon: CheckCircle, color: 'blue', }, ]; const colorClasses = { blue: 'bg-blue-100 dark:bg-blue-900 text-blue-600 dark:text-blue-400 border-blue-200 dark:border-blue-700', purple: 'bg-purple-100 dark:bg-purple-900 text-purple-600 dark:text-purple-400 border-purple-200 dark:border-purple-700', green: 'bg-green-100 dark:bg-green-900 text-green-600 dark:text-green-400 border-green-200 dark:border-green-700', orange: 'bg-orange-100 dark:bg-orange-900 text-orange-600 dark:text-orange-400 border-orange-200 dark:border-orange-700', red: 'bg-red-100 dark:bg-red-900 text-red-600 dark:text-red-400 border-red-200 dark:border-red-700', indigo: 'bg-indigo-100 dark:bg-indigo-900 text-indigo-600 dark:text-indigo-400 border-indigo-200 dark:border-indigo-700', }; export default function P2NSFlowDiagram() { // Group steps into rows of 2 (last row may have 1 item) const rows: (typeof steps)[] = []; for (let i = 0; i < steps.length; i += 2) { rows.push(steps.slice(i, i + 2)); } return (
{rows.map((row, rowIndex) => { const isLastRow = rowIndex === rows.length - 1; const isSingleItemRow = row.length === 1; return (
{/* Use a centered single column for the very last step */} {isLastRow && isSingleItemRow ? (
{row.map((step) => { const Icon = step.icon; const globalIndex = steps.indexOf(step); return (

{step.title}

{step.description}

); })}
) : ( /* Normal 2-column rows */
{row.map((step, stepIndex) => { const Icon = step.icon; const globalIndex = rowIndex * 2 + stepIndex; const isLastInRow = stepIndex === row.length - 1; return (

{step.title}

{step.description}

{!isLastInRow && ( )}
); })}
)} {/* Down arrow between rows */} {!isLastRow && ( )}
); })}
); }