'use client'; import { useEffect, useState } from 'react'; import { getRepos } from '@/lib/gitea'; import type { GiteaRepo } from '@/lib/types'; import { SITE, GITEA_URL, GITEA_USERNAME } from '@/lib/config'; const LANG_COLOR: Record = { python:'#3572A5',javascript:'#f1e05a',typescript:'#3178c6', go:'#00add8',rust:'#dea584','c++':'#f34b7d',c:'#555', html:'#e34c26',css:'#563d7c',shell:'#89e051',ruby:'#701516',java:'#b07219' }; function langColor(l: string | null) { return LANG_COLOR[(l||'').toLowerCase()] || '#555'; } function timeAgo(d: string) { const diff = Date.now() - new Date(d).getTime(); const m = Math.floor(diff / 60000); if (m < 60) return `${m}m ago`; const h = Math.floor(m / 60); if (h < 24) return `${h}h ago`; const days = Math.floor(h / 24); if (days < 30) return `${days}d ago`; return `${Math.floor(days / 30)}mo ago`; } export default function Projects() { const [repos, setRepos] = useState(null); const [error, setError] = useState(null); useEffect(() => { getRepos(SITE.repoLimit) .then(setRepos) .catch(e => setError(e.message)); }, []); return (
Gitea ยท Public repos

Recent Projects

All repos
{!repos && !error && (
{[...Array(6)].map((_, i) => (
))}
)} {error && (

Could not load repositories

{error}

)} {repos && ( )}
); }