// app/projects/code/page.tsx import MatrixRain from '@/app/components/MatrixRain'; import { FaCodeBranch, FaGithub, FaGlobe, FaStar } from 'react-icons/fa'; import { SiGitea } from 'react-icons/si'; import Image from 'next/image'; interface GithubProfile { html_url: string; avatar_url: string; name: string; login: string; bio: string; followers: number; public_repos: number; } interface GithubRepo { id: number; name: string; description: string; html_url: string; language: string; stargazers_count: number; forks: number; } interface GiteaRepo { id: number; name: string; description: string; html_url: string; stars_count: number; forks_count: number; language?: string; } async function getProfile(): Promise { try { const res = await fetch('https://api.github.com/users/WilliamSoderberg', { next: { revalidate: 60 } }); if (!res.ok) return null; return res.json(); } catch { return null; } } async function getGithubRepos(): Promise { try { const res = await fetch('https://api.github.com/users/WilliamSoderberg/repos?sort=updated', { next: { revalidate: 60 } }); if (!res.ok) return []; return res.json(); } catch { return []; } } async function getGiteaRepos(): Promise { try { const res = await fetch('https://git.stws.cc/api/v1/users/WilliamSoderberg/repos', { next: { revalidate: 60 } }); if (!res.ok) return []; return res.json(); } catch { console.error("Gitea fetch failed, returning empty array"); return []; } } const langColors: Record = { JavaScript: 'bg-[#f1e05a]', TypeScript: 'bg-[#2b7489]', TSX: 'bg-[#2b7489]', Python: 'bg-[#3572A5]', PHP: 'bg-[#4F5D95]', CSS: 'bg-[#563d7c]', HTML: 'bg-[#e44b23]', Vue: 'bg-[#41b883]' }; export default async function CodePage() { const [profile, githubRepos, giteaRepos] = await Promise.all([ getProfile(), getGithubRepos(), getGiteaRepos() ]); return (
{/* 2. Profile Card Section */} {profile && (
Avatar

{profile.name}

{profile.bio}

{profile.followers}
Followers
{profile.public_repos}
Repositories
)} {/* 3. Gitea Repositories Section */}

Gitea Projects

Self-hosted infrastructure and private development.

{giteaRepos.length > 0 ? ( ) : (
No public Gitea repositories found or API is restricted.
)}
{/* 4. GitHub Repositories Section */}

Public Repositories

{/* 5. Hosted Websites Section */}

Hosted Websites

); }