import { getTranslations, setRequestLocale } from 'next-intl/server'; import Link from 'next/link'; import { Header } from '@/components/Header'; import { Footer } from '@/components/Footer'; import { Github, Heart, Users, Code, GitFork, ExternalLink, Database, Clock } from 'lucide-react'; import { getPageAlternates } from '@/lib/seo'; export const dynamic = 'force-dynamic'; interface AttributionStats { totalSkills: number; totalContributors: number; totalRepos: number; awesomeLists: { count: number; totalRepos: number; }; forkNetworks: number; licenseDistribution: Array<{ license: string; count: number; percentage: number; }>; discoveryBySource: Array<{ source: string; count: number; withSkills: number; }>; lastUpdated: string; } async function getAttributionStats(): Promise { try { const baseUrl = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3000'; const res = await fetch(`${baseUrl}/api/attribution`, { next: { revalidate: 3600 }, // Cache for 1 hour }); if (!res.ok) return null; return res.json(); } catch { return null; } } function formatNumber(num: number): string { if (num >= 1000000) { return `${(num / 1000000).toFixed(1)}M`; } if (num >= 1000) { return `${(num / 1000).toFixed(1)}K`; } return num.toLocaleString(); } function formatLicenseName(license: string, locale: string): string { const licenseNames: Record = { 'Unspecified': { en: 'Not Specified', fa: 'مشخص نشده' }, 'NOASSERTION': { en: 'Not Declared', fa: 'اعلام نشده' }, 'Complete terms in LICENSE.txt': { en: 'Custom License', fa: 'لایسنس سفارشی' }, 'Proprietary. LICENSE.txt has complete terms': { en: 'Proprietary', fa: 'اختصاصی' }, 'MIT license': { en: 'MIT', fa: 'MIT' }, 'BSD-3-Clause license': { en: 'BSD-3-Clause', fa: 'BSD-3-Clause' }, 'Unknown': { en: 'Unknown', fa: 'نامشخص' }, }; const names = licenseNames[license]; return names ? names[locale as 'en' | 'fa'] || names.en : license; } export async function generateMetadata({ params, }: { params: Promise<{ locale: string }>; }) { const { locale } = await params; return { alternates: getPageAlternates(locale, '/attribution'), }; } export default async function AttributionPage({ params, }: { params: Promise<{ locale: string }>; }) { const { locale } = await params; setRequestLocale(locale); const t = await getTranslations('attribution'); const stats = await getAttributionStats(); // Fallback data if API fails const sources = [ { name: locale === 'fa' ? 'مهارت‌های ایندکس شده' : 'Indexed Skills', icon: Database, description: locale === 'fa' ? 'مهارت‌های ایندکس شده در تمام پلتفرم‌ها' : 'Skills indexed across all supported platforms', count: stats ? formatNumber(stats.totalSkills) : '170K+', }, { name: locale === 'fa' ? 'مخازن کشف شده' : 'Repositories Discovered', icon: Github, description: locale === 'fa' ? 'مخازن عمومی GitHub اسکن شده برای مهارت‌ها' : 'Public GitHub repositories scanned for skills', count: stats ? formatNumber(stats.totalRepos) : '50K+', }, { name: locale === 'fa' ? 'شبکه Fork‌ها' : 'Fork Networks', icon: GitFork, description: locale === 'fa' ? 'شبکه Fork‌های مخازن معروف مهارت' : 'Fork networks of popular skill repositories', count: stats ? formatNumber(stats.forkNetworks) : '500+', }, { name: locale === 'fa' ? 'مشارکت‌کنندگان' : 'Contributors', icon: Users, description: locale === 'fa' ? 'توسعه‌دهندگانی که مهارت‌ها را ایجاد و نگهداری می‌کنند' : 'Developers who create and maintain skills', count: stats ? formatNumber(stats.totalContributors) : '6K+', }, ]; // Use real license data if available, otherwise fallback const licenses = stats?.licenseDistribution.slice(0, 5).map((l) => ({ name: formatLicenseName(l.license, locale), percentage: l.percentage, count: l.count, })) || [ { name: 'MIT', percentage: 65, count: 0 }, { name: 'Apache 2.0', percentage: 20, count: 0 }, { name: 'BSD', percentage: 8, count: 0 }, { name: 'GPL', percentage: 5, count: 0 }, { name: locale === 'fa' ? 'سایر' : 'Other', percentage: 2, count: 0 }, ]; return (
{/* Hero Section */}

{t('title')}

{t('subtitle')}

{stats && (
{locale === 'fa' ? 'آخرین به‌روزرسانی: ' : 'Last updated: '} {new Date(stats.lastUpdated).toLocaleDateString(locale === 'fa' ? 'fa-IR' : 'en-US', { year: 'numeric', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit', })}
)}
{/* Main Content */}
{/* Sources Section */}

{t('sources.title')}

{sources.map((source) => { const Icon = source.icon; return (

{source.name}

{source.count}

{source.description}

); })}
{/* License Compliance Section */}

{t('licenses.title')}

{t('licenses.description')}

{licenses.map((license) => (
{license.name}
{license.percentage}% {stats && license.count > 0 && ( ({formatNumber(license.count)}) )}
))}
{/* How It Works Section */}

{t('howItWorks.title')}

1

{t('howItWorks.step1')}

2

{t('howItWorks.step2')}

3

{t('howItWorks.step3')}

4

{t('howItWorks.step4')}

{/* Special Thanks Section */}

{t('thanks.title')}

{t('thanks.subtitle')}
  • Anthropic - {locale === 'fa' ? 'استاندارد SKILL.md و Agent Skills' : 'SKILL.md and Agent Skills standard'}
  • anthropics/skills - {locale === 'fa' ? 'مخزن رسمی مهارت‌ها' : 'Official skills repository'}
  • {locale === 'fa' ? 'OpenAI، GitHub، Cursor و Windsurf' : 'OpenAI, GitHub, Cursor & Windsurf'} - {locale === 'fa' ? 'پلتفرم‌های پشتیبانی شده' : 'Supported platforms'}
  • {locale === 'fa' ? `همه ${stats ? formatNumber(stats.totalContributors) : ''} مشارکت‌کنندگان متن‌باز` : `All ${stats ? formatNumber(stats.totalContributors) : ''} open-source contributors`}
{/* Your Rights Section */}

{t('rights.title')}

{t('rights.description')}

{t('rights.claimLink')}
); }