Skip to content

Commit 4eb1dda

Browse files
committed
✨ style(change): content
1 parent f4f540a commit 4eb1dda

File tree

4 files changed

+287
-285
lines changed

4 files changed

+287
-285
lines changed

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
22
import { HashRouter as Router, Routes, Route } from 'react-router-dom';
33
import { Layout } from './components/layout/Layout';
44
import { Home } from './pages/Home';

src/pages/Donors.tsx

Lines changed: 92 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,116 @@
1-
import { Heart, Trophy, PieChart } from 'lucide-react';
1+
import { useEffect, useState } from 'react';
2+
import { Heart, PieChart } from 'lucide-react';
23
import { FaRupeeSign } from 'react-icons/fa';
34

5+
async function getGitHubUserData(username: string): Promise<{ name: string; avatar_url: string }> {
6+
try {
7+
const response = await fetch(`https://api.github.com/users/${username}`);
8+
if (!response.ok) {
9+
throw new Error(`User not found: ${username}`);
10+
}
11+
const data = await response.json();
12+
return {
13+
name: data.name || username, // Use GitHub name or fallback to username
14+
avatar_url: data.avatar_url || '',
15+
};
16+
} catch (error) {
17+
console.error(error);
18+
return { name: username, avatar_url: '' }; // Return username if there is an error
19+
}
20+
}
21+
22+
function useGitHubDonors(usernames: string[]): { [key: string]: { name: string; avatar_url: string } } {
23+
const [donors, setDonors] = useState<{ [key: string]: { name: string; avatar_url: string } }>({});
24+
25+
useEffect(() => {
26+
const fetchDonors = async () => {
27+
const donorData: { [key: string]: { name: string; avatar_url: string } } = {};
28+
for (let username of usernames) {
29+
const data = await getGitHubUserData(username);
30+
donorData[username] = data;
31+
}
32+
setDonors(donorData);
33+
};
34+
35+
fetchDonors();
36+
}, [usernames]);
37+
38+
return donors;
39+
}
40+
441
export function Donors() {
42+
const donorUsernames = [
43+
"eshanized", "GlobalSystemsLtd", "FutureComputingInc", "SarahJohnson", "MichaelChang",
44+
"DataFlowSolutions", "RobertWilson", "EmmaThompson", "RajeshKumar", "PriyaSharma",
45+
"AryanPatel", "MeenaIyer", "VikramSingh"
46+
];
47+
48+
const donorData = useGitHubDonors(donorUsernames);
49+
550
return (
651
<div className="py-12">
752
<div className="container mx-auto px-4">
853
{/* Hero Section */}
954
<section className="text-center mb-16">
10-
<Heart className="h-16 w-16 text-red-500 mx-auto mb-6" />
11-
<h1 className="text-4xl font-bold mb-6">Our Amazing Donors</h1>
55+
<Heart className="h-16 w-16 text-[#6495ed] mx-auto mb-6" />
56+
<h1 className="text-4xl font-bold mb-6 text-[#6495ed]">Our Amazing Donors</h1>
1257
<p className="text-xl text-gray-600 max-w-3xl mx-auto">
13-
Snigdha OS is made possible thanks to the generous support of our
14-
donors. We are grateful for their contributions to keep our project
15-
running.
58+
Snigdha OS is made possible thanks to the generous support of our donors. We are grateful for their contributions to keep our project running.
1659
</p>
1760
</section>
1861

19-
{/* Donation Tiers */}
62+
{/* Donor List */}
2063
<section className="mb-16">
21-
<h2 className="text-3xl font-bold mb-8 text-center">
22-
<Trophy className="inline-block h-6 w-6 text-yellow-500 mr-2" />
23-
Donation Tiers
24-
</h2>
64+
<h2 className="text-3xl font-bold mb-8 text-center text-[#6495ed]">Donors List</h2>
2565
<div className="grid grid-cols-1 md:grid-cols-3 gap-8">
26-
<DonationTier
27-
title="Platinum Donors"
28-
amount="₹500+"
29-
icon={<Trophy className="h-6 w-6 text-gray-500" />}
30-
color="bg-gradient-to-r from-gray-200 to-gray-100"
31-
donors={[
32-
"TechCorp International",
33-
"Global Systems Ltd",
34-
"Future Computing Inc",
35-
]}
36-
/>
37-
<DonationTier
38-
title="Gold Donors"
39-
amount="₹100-₹499"
40-
icon={<Trophy className="h-6 w-6 text-yellow-500" />}
41-
color="bg-gradient-to-r from-yellow-100 to-yellow-50"
42-
donors={[
43-
"Sarah Johnson",
44-
"Michael Chang",
45-
"DataFlow Solutions",
46-
"Robert Wilson",
47-
"Emma Thompson",
48-
]}
49-
/>
50-
<DonationTier
51-
title="Silver Donors"
52-
amount="$₹10-₹99"
53-
icon={<Trophy className="h-6 w-6 text-gray-400" />}
54-
color="bg-gradient-to-r from-gray-100 to-white"
55-
donors={[
56-
"Rajesh Kumar",
57-
"Priya Sharma",
58-
"Aryan Patel",
59-
"Meena Iyer",
60-
"Vikram Singh",
61-
// "And many more...",
62-
]}
63-
/>
66+
{donorUsernames.map((donor) => (
67+
<div key={donor} className="flex items-center gap-4">
68+
{donorData[donor]?.avatar_url ? (
69+
<img
70+
src={donorData[donor].avatar_url}
71+
alt={donorData[donor].name}
72+
className="h-12 w-12 rounded-full"
73+
/>
74+
) : (
75+
<div className="h-12 w-12 rounded-full bg-gray-300"></div> // Placeholder if no avatar
76+
)}
77+
<div>
78+
<span className="font-semibold">{donorData[donor]?.name || donor}</span>
79+
<br />
80+
<span className="text-sm text-gray-500">
81+
<a
82+
href={`https://github.com/${donor}`}
83+
target="_blank"
84+
rel="noopener noreferrer"
85+
className="text-blue-500 hover:underline"
86+
>
87+
@{donor}
88+
</a>
89+
</span>
90+
</div>
91+
</div>
92+
))}
6493
</div>
6594
</section>
6695

6796
{/* Become a Donor */}
68-
<section className="bg-indigo-50 rounded-lg p-8 text-center">
69-
<h2 className="text-3xl font-bold mb-4">
97+
<section className="bg-[#6495ed] rounded-lg p-8 text-center">
98+
<h2 className="text-3xl font-bold mb-4 text-white">
7099
<FaRupeeSign className="inline-block h-6 w-6 text-green-500 mr-2" />
71100
Become a Donor
72101
</h2>
73-
<p className="text-gray-600 mb-8 max-w-2xl mx-auto">
74-
Your support helps us maintain and improve Snigdha OS. Every donation,
75-
big or small, makes a difference in keeping our project independent and
76-
sustainable.
102+
<p className="text-white mb-8 max-w-2xl mx-auto">
103+
Your support helps us maintain and improve Snigdha OS. Every donation, big or small, makes a difference in keeping our project independent and sustainable.
77104
</p>
78-
<button className="bg-indigo-600 text-white px-8 py-3 rounded-[5px] hover:bg-indigo-700 transition-colors">
105+
<button className="bg-[#6495ed] text-white px-8 py-3 rounded-[5px] hover:bg-[#6495ed] transition-colors">
79106
Make a Donation
80107
</button>
81108
</section>
82109

83110
{/* Yearly Report */}
84111
<section className="mt-16">
85-
<h2 className="text-3xl font-bold mb-8">
86-
<PieChart className="inline-block h-6 w-6 text-blue-500 mr-2" />
112+
<h2 className="text-3xl font-bold mb-8 text-[#6495ed]">
113+
<PieChart className="inline-block h-6 w-6 text-[#6495ed] mr-2" />
87114
Yearly Donation Report
88115
</h2>
89116
<div className="bg-white rounded-lg shadow-lg p-8">
@@ -95,25 +122,25 @@ export function Donors() {
95122
averageDonation={1125}
96123
/>
97124
<div className="border-t pt-6">
98-
<h3 className="font-bold mb-4">How Donations Are Used</h3>
125+
<h3 className="font-bold mb-4 text-[#6495ed]">How Donations Are Used</h3>
99126
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
100127
<UsageCard
101128
percentage={40}
102129
category="Development"
103130
description="Supporting core developers and infrastructure"
104-
icon={<PieChart className="h-6 w-6 text-green-500" />}
131+
icon={<PieChart className="h-6 w-6 text-[#6495ed]" />}
105132
/>
106133
<UsageCard
107134
percentage={35}
108135
category="Server Costs"
109136
description="Maintaining mirrors and websites"
110-
icon={<PieChart className="h-6 w-6 text-blue-500" />}
137+
icon={<PieChart className="h-6 w-6 text-[#6495ed]" />}
111138
/>
112139
<UsageCard
113140
percentage={25}
114141
category="Community"
115142
description="Supporting community projects and events"
116-
icon={<PieChart className="h-6 w-6 text-indigo-500" />}
143+
icon={<PieChart className="h-6 w-6 text-[#6495ed]" />}
117144
/>
118145
</div>
119146
</div>
@@ -125,37 +152,6 @@ export function Donors() {
125152
);
126153
}
127154

128-
type DonationTierProps = {
129-
title: string;
130-
amount: string;
131-
color: string;
132-
icon: React.ReactNode;
133-
donors: string[];
134-
};
135-
136-
function DonationTier({
137-
title,
138-
amount,
139-
color,
140-
icon,
141-
donors,
142-
}: DonationTierProps) {
143-
return (
144-
<div className={`rounded-lg shadow-lg p-6 ${color}`}>
145-
<h3 className="text-xl font-bold mb-2 flex items-center gap-2">
146-
{icon}
147-
{title}
148-
</h3>
149-
<p className="text-gray-600 mb-4">{amount}</p>
150-
<ul className="space-y-2">
151-
{donors.map((donor, index) => (
152-
<li key={index} className="text-gray-700">{donor}</li>
153-
))}
154-
</ul>
155-
</div>
156-
);
157-
}
158-
159155
type YearlyStatsProps = {
160156
month: string;
161157
amount: number;
@@ -171,7 +167,7 @@ function YearlyStats({
171167
}: YearlyStatsProps) {
172168
return (
173169
<div>
174-
<h3 className="font-bold text-xl mb-4">{month}</h3>
170+
<h3 className="font-bold text-xl mb-4 text-[#6495ed]">{month}</h3>
175171
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
176172
<div className="bg-gray-50 p-4 rounded-lg">
177173
<p className="text-sm text-gray-600">Total Donations</p>
@@ -207,11 +203,11 @@ function UsageCard({
207203
<div className="bg-gray-50 p-4 rounded-lg">
208204
<div className="flex items-center mb-2">
209205
{icon}
210-
<span className="ml-2 text-xl font-semibold text-indigo-600">
206+
<span className="ml-2 text-xl font-semibold text-[#6495ed]">
211207
{percentage}%
212208
</span>
213209
</div>
214-
<h4 className="font-regular mb-1">{category}</h4>
210+
<h4 className="font-regular mb-1 text-[#6495ed]">{category}</h4>
215211
<p className="text-sm text-gray-600">{description}</p>
216212
</div>
217213
);

0 commit comments

Comments
 (0)