diff --git a/src/components/donate/KeySponsors.tsx b/src/components/donate/KeySponsors.tsx index 95358d33..2fd4d203 100644 --- a/src/components/donate/KeySponsors.tsx +++ b/src/components/donate/KeySponsors.tsx @@ -1,41 +1,76 @@ +import { useState, useEffect } from 'react'; import { motion } from 'framer-motion'; -import { Building2 } from 'lucide-react'; +// Dummy list of sponsors with GitHub usernames const keySponsors = [ { - name: 'TONMOY INFRASTRUCTURE', - description: 'Enterprise Partner & Infrastructure Provider', - logo: Building2, + username: 'TIAsCode', // GitHub username + description: 'Enterprise Partner & Server Provider', + amount: '₹82,025.36', // Example of amount, could be fetched or hardcoded }, { - name: 'IX INTERNATION CO.', + username: 'ixintl', // GitHub username description: 'Strategic Development Partner', - logo: Building2, + amount: '₹54,399.36', // Example of amount, could be fetched or hardcoded }, ]; +async function fetchGitHubUser(username: string) { + const response = await fetch(`https://api.github.com/users/${username}`); + const data = await response.json(); + return data; +} + export function KeySponsors() { + const [sponsorsData, setSponsorsData] = useState([]); + + useEffect(() => { + const fetchSponsorsData = async () => { + const sponsorsWithData = await Promise.all( + keySponsors.map(async (sponsor) => { + const user = await fetchGitHubUser(sponsor.username); + return { + ...sponsor, + name: user.name || sponsor.username, // Use GitHub name or fallback to username + avatar_url: user.avatar_url, // Fetch the GitHub profile picture + }; + }) + ); + setSponsorsData(sponsorsWithData); + }; + + fetchSponsorsData(); + }, []); + return (
-

+

Key Sponsors

-
- {keySponsors.map((sponsor, index) => ( +
+ {sponsorsData.map((sponsor, index) => ( -
-
- +
+
+ {/* Displaying the profile picture */} + {sponsor.name}
-

{sponsor.name}

+

{sponsor.name}

{sponsor.description}

+

+ Amount: {sponsor.amount} +

@@ -43,4 +78,4 @@ export function KeySponsors() {
); -} \ No newline at end of file +}