diff --git a/src/components/DeveloperSummary.tsx b/src/components/DeveloperSummary.tsx new file mode 100644 index 00000000..a2a13de1 --- /dev/null +++ b/src/components/DeveloperSummary.tsx @@ -0,0 +1,105 @@ +import React, { useEffect, useState } from "react"; +import { + Paper, + Typography, + Box, + Avatar, + Chip, +} from "@mui/material"; + +interface DeveloperProfile { + name: string; + bio: string; + followers: number; + following: number; + public_repos: number; + avatar_url: string; +} + +interface Props { + username: string; +} + +const DeveloperSummary: React.FC = ({ username }) => { + const [profile, setProfile] = + useState(null); + + useEffect(() => { + if (!username) return; + + fetch(`https://api.github.com/users/${username}`) + .then((res) => res.json()) + .then((data) => setProfile(data)) + .catch(console.error); + }, [username]); + + if (!profile) return null; + + return ( + + + + + + + {profile.name || username} + + + {profile.bio && ( + + {profile.bio} + + )} + + + + + + + + + + + {profile.name || username} has{" "} + {profile.public_repos} public repositories and{" "} + {profile.followers} followers, showing active + participation in the GitHub community. + + + ); +}; + +export default DeveloperSummary; \ No newline at end of file diff --git a/src/pages/Tracker/Tracker.tsx b/src/pages/Tracker/Tracker.tsx index 576f39bf..4490dcd3 100644 --- a/src/pages/Tracker/Tracker.tsx +++ b/src/pages/Tracker/Tracker.tsx @@ -33,6 +33,8 @@ import { useTheme } from "@mui/material/styles"; import { useGitHubAuth } from "../../hooks/useGitHubAuth"; import { useGitHubData } from "../../hooks/useGitHubData"; import { KeyIcon } from "lucide-react"; +import DeveloperSummary from "../../components/DeveloperSummary"; + const ROWS_PER_PAGE = 10; @@ -241,7 +243,7 @@ const Home: React.FC = () => { - + {/* Filters */}