'use client' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { useAppStore } from '@/lib/store' import { getToolByDirectory } from '@/lib/data' import { formatNumber, formatBytes } from '@/lib/utils' import { X, FileText, Code, Package } from 'lucide-react' import Link from 'next/link' export default function ComparePage() { const { comparison, removeFromComparison, clearComparison } = useAppStore() const tools = comparison.map((dir) => getToolByDirectory(dir)).filter(Boolean) if (tools.length === 0) { return (

No Tools Selected

Add tools to comparison from the browse page to see side-by-side comparison

) } const comparisonData = [ { label: 'Company', getValue: (tool: any) => tool.company, }, { label: 'Category', getValue: (tool: any) => tool.category, }, { label: 'Type', getValue: (tool: any) => {tool.type}, }, { label: 'Files', getValue: (tool: any) => tool.file_count, }, { label: 'Total Lines', getValue: (tool: any) => formatNumber(tool.total_lines), }, { label: 'Models', getValue: (tool: any) => (
{tool.models.length > 0 ? ( tool.models.slice(0, 3).map((model: string) => ( {model} )) ) : ( None specified )}
), }, { label: 'Website', getValue: (tool: any) => tool.website ? ( Visit ) : ( N/A ), }, ] return (
{/* Header */}

Compare Tools

{tools.length > 0 && ( )}

Comparing {tools.length} of 4 maximum tools

{/* Comparison Table */}
{/* Header Row */}
Tool
{tools.map((tool) => (
{tool!.name}
))} {/* Description Row */}
Description
{tools.map((tool) => (

{tool!.description}

))} {/* Comparison Rows */} {comparisonData.map((row, index) => (
{row.label}
{tools.map((tool) => (
{row.getValue(tool)}
))}
))} {/* Files Row */}
Files
{tools.map((tool) => (
{tool!.files.slice(0, 5).map((file) => (
{file.name}
))} {tool!.files.length > 5 && (
+{tool!.files.length - 5} more files
)}
))} {/* Actions Row */}
Actions
{tools.map((tool) => (
))}
{/* Add More */} {tools.length < 4 && (

You can compare up to {4 - tools.length} more tool{tools.length < 3 ? 's' : ''}

)}
) }