diff --git a/src/App.jsx b/src/App.jsx index 87ecba6..5365cda 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -43,6 +43,7 @@ import Covid from './pages/Covid.jsx'; import Navbar from './components/Navbar.jsx'; import ContributorsWall from './pages/Contributors.jsx' import Pokedex from './pages/Pokedex.jsx'; +import GitHubAnalyzer from './pages/GitHubAnalyzer.jsx'; // TODO: Extract theme state into context (see todo 5). import { useState, useEffect } from 'react'; @@ -79,9 +80,10 @@ export default function App() { } /> } /> } /> - } /> - } /> - } /> + } /> + } /> + } /> + } /> diff --git a/src/components/Navbar.jsx b/src/components/Navbar.jsx index 55ec1ad..4d3dcf9 100644 --- a/src/components/Navbar.jsx +++ b/src/components/Navbar.jsx @@ -16,6 +16,7 @@ export default function Navbar({ theme, toggleTheme }) {
  • Jokes & Quotes
  • Pets
  • COVID-19
  • +
  • GitHub Analyzer
  • + + + {loading && } + + + {profile && ( +
    + {/* Profile Overview */} + +
    + {profile.login} +
    +

    {profile.name || profile.login}

    +

    @{profile.login}

    + {profile.bio &&

    {profile.bio}

    } + {profile.location &&

    📍 {profile.location}

    } + {profile.company &&

    🏢 {profile.company}

    } +

    Joined: {new Date(profile.created_at).toLocaleDateString()}

    +
    +
    +
    + + {/* Basic Stats */} + +
    +
    + Followers: {profile.followers?.toLocaleString()} +
    +
    + Following: {profile.following?.toLocaleString()} +
    +
    + Public Repos: {profile.public_repos?.toLocaleString()} +
    +
    + Public Gists: {profile.public_gists?.toLocaleString()} +
    +
    +
    + + {/* Advanced Stats */} + {profileStats && ( + +
    +
    + Total Stars: {profileStats.totalStars.toLocaleString()} +
    +
    + Total Forks: {profileStats.totalForks.toLocaleString()} +
    +
    + Top Languages: +
      + {profileStats.topLanguages.map(([lang, count]) => ( +
    • + {lang}: {count} repos +
    • + ))} +
    +
    +
    + Average Stars per Repo:{" "} + {(profileStats.totalStars / repos.length).toFixed(1)} +
    +
    +
    + )} + + {/* Recent Repositories */} + +
    + {repos.slice(0, 10).map((repo) => ( +
    +
    + + {repo.name} + + {repo.language && ( + + {repo.language} + + )} +
    +
    + ⭐ {repo.stargazers_count} + 🍴 {repo.forks_count} +
    +
    + ))} +
    +
    +
    + )} + + {/* Profile Comparison Section */} + {profile && ( +
    +

    🔄 Profile Comparison

    +
    + setCompareUsername(e.target.value)} + placeholder="Enter username to compare" + style={{ marginRight: "1rem" }} + /> + +
    + + {compareProfile && ( +
    + +
    +
    +

    {profile.name || profile.login}

    +

    Followers: {profile.followers}

    +

    Following: {profile.following}

    +

    Repos: {profile.public_repos}

    + {profileStats && ( + <> +

    Total Stars: {profileStats.totalStars}

    +

    Total Forks: {profileStats.totalForks}

    + + )} +
    +
    +

    {compareProfile.name || compareProfile.login}

    +

    Followers: {compareProfile.followers}

    +

    Following: {compareProfile.following}

    +

    Repos: {compareProfile.public_repos}

    + {compareStats && ( + <> +

    Total Stars: {compareStats.totalStars}

    +

    Total Forks: {compareStats.totalForks}

    + + )} +
    +
    +
    +
    + )} +
    + )} + + ); +} \ No newline at end of file diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx index e1be9cc..789fbf8 100644 --- a/src/pages/Home.jsx +++ b/src/pages/Home.jsx @@ -35,6 +35,7 @@ const dashboards = [ { path: '/covid', title: 'COVID-19 Stats', desc: 'Global & country data' }, { path: '/pokedex', title: 'Pokédex', desc: 'Explore Pokémon species' }, { path: '/contributors', title: 'Contributor Wall', desc: 'Our Contributors' }, + { path: '/github-analyzer', title: 'GitHub Analyzer', desc: 'Analyze GitHub profiles with advanced stats' }, ];