'use client'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
import { Badge } from '@/components/ui/badge'
import { getAllTools, getStats, getCategoryIcon, getCategoryColor } from '@/lib/data'
import { formatNumber } from '@/lib/utils'
import { BarChart3, TrendingUp, Package, FileText, Code } from 'lucide-react'
export default function StatsPage() {
const stats = getStats()
const tools = getAllTools()
// Calculate additional stats
const topByLines = [...tools].sort((a, b) => b.total_lines - a.total_lines).slice(0, 10)
const topByFiles = [...tools].sort((a, b) => b.file_count - a.file_count).slice(0, 10)
// Get max values for scaling
const maxByCategory = Math.max(...Object.values(stats.by_category))
return (
{/* Header */}
Statistics & Analytics
Comprehensive insights into AI tools and their configurations
{/* Overview Stats */}
Total AI Tools
{stats.total_tools}
Across {Object.keys(stats.by_category).length} categories
Total Files
{stats.total_files}
Configuration & prompt files
Total Lines
{formatNumber(stats.total_lines)}
Of system prompts & configs
Average per Tool
{Math.round(stats.total_lines / stats.total_tools)}
Lines per tool
{/* Category Distribution */}
Tools by Category
Distribution across all categories
{Object.entries(stats.by_category)
.sort(([, a], [, b]) => b - a)
.map(([category, count]) => {
const percentage = (count / maxByCategory) * 100
return (
{getCategoryIcon(category)}
{category}
{count} tools
)
})}
{/* Top by Lines */}
Most Complex (by lines)
Tools with the most lines of code
{topByLines.map((tool, index) => (
{index + 1}
{tool.name}
{tool.company}
{formatNumber(tool.total_lines)} lines
))}
{/* Top by Files */}
Most Files
Tools with the most configuration files
{topByFiles.map((tool, index) => (
{index + 1}
{tool.name}
{tool.company}
{tool.file_count} files
))}
{/* Type Distribution */}
Open Source vs Proprietary
Distribution by tool type
{Object.entries(stats.by_type).map(([type, count]) => {
const percentage = (count / stats.total_tools) * 100
return (
{type}
{count} tools
{percentage.toFixed(1)}%
)
})}
)
}