diff --git a/src/pages/Contributors.jsx b/src/pages/Contributors.jsx
index 07f4e8a..dc0565e 100644
--- a/src/pages/Contributors.jsx
+++ b/src/pages/Contributors.jsx
@@ -1,154 +1,149 @@
import React, { useState, useEffect } from 'react';
-import { Users, GitFork, Star, ExternalLink } from 'lucide-react';
+// Re-importing icons for the stats
+import { Users, GitFork, Star } from 'lucide-react';
export default function ContributorsWall() {
const [contributors, setContributors] = useState([]);
+ const [repoInfo, setRepoInfo] = useState(null); // State for repo info
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
- const [repoInfo, setRepoInfo] = useState(null);
useEffect(() => {
- fetchContributors();
- fetchRepoInfo();
- }, []);
+ // Fetch both contributors and repo info at the same time
+ const fetchData = async () => {
+ setLoading(true);
+ setError(null);
+ try {
+ const [repoRes, contributorsRes] = await Promise.all([
+ fetch('https://api.github.com/repos/commitra/react-verse'),
+ fetch('https://api.github.com/repos/commitra/react-verse/contributors?per_page=100')
+ ]);
- const fetchRepoInfo = async () => {
- try {
- const response = await fetch('https://api.github.com/repos/commitra/react-verse');
- const data = await response.json();
- setRepoInfo(data);
- } catch (err) {
- console.error('Error fetching repo info:', err);
- }
- };
+ // Check both responses
+ if (!repoRes.ok) {
+ throw new Error(`Failed to fetch repo info: ${repoRes.statusText}`);
+ }
+ if (!contributorsRes.ok) {
+ throw new Error(`Failed to fetch contributors: ${contributorsRes.statusText}`);
+ }
- const fetchContributors = async () => {
- try {
- setLoading(true);
- const response = await fetch(
- 'https://api.github.com/repos/commitra/react-verse/contributors?per_page=100'
- );
-
- if (!response.ok) {
- throw new Error('Failed to fetch contributors');
+ const repoData = await repoRes.json();
+ const contributorsData = await contributorsRes.json();
+
+ setRepoInfo(repoData); // Set the repo info
+ setContributors(contributorsData);
+ } catch (err) {
+ setError(err.message);
+ } finally {
+ setLoading(false);
}
-
- const data = await response.json();
- setContributors(data);
- setLoading(false);
- } catch (err) {
- setError(err.message);
- setLoading(false);
- }
+ };
+
+ fetchData();
+ }, []); // Empty dependency array ensures this runs once on mount
+
+ // Style object for the new stat boxes
+ // This uses variables from your main stylesheet
+ const statBoxStyle = {
+ background: 'var(--bg-alt)',
+ border: '1px solid var(--border)',
+ padding: '0.5rem 1rem',
+ borderRadius: 'var(--radius)',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '0.5rem',
+ fontSize: '0.9rem',
+ fontWeight: 500,
+ color: 'var(--text)'
};
if (loading) {
return (
-
-
-
-
Loading contributors...
-
+
+
Loading contributors...
);
}
if (error) {
return (
-
-
+
+
Error: {error}
+
You may have hit the GitHub API rate limit. Please try again later.
);
}
return (
-
-
- {/* Header */}
-
-
-
-
Wall of Contributors
+
+
+
+ React-Verse Contributors
+
+
+ Honoring the amazing developers who made this project possible.
+
+
+ {/* --- NEW STATS SECTION --- */}
+ {repoInfo && (
+ // Uses .flex and .wrap from your stylesheet
+
+ {/* Stat Box for Stars */}
+
+
+ {repoInfo.stargazers_count} Stars
-
- React-Verse Contributors
-
-
- Honoring the amazing developers who made this project possible
-
- {repoInfo && (
-
-
-
- {repoInfo.stargazers_count} Stars
-
-
-
- {repoInfo.forks_count} Forks
-
-
-
- {contributors.length} Contributors
-
-
- )}
+ {/* Stat Box for Forks */}
+
+
+ {repoInfo.forks_count} Forks
+
+
+ {/* Stat Box for Contributors */}
+
+
+ {contributors.length} Contributors
+
+ )}
+ {/* --- END OF STATS SECTION --- */}
- {/* Repository Link */}
-
+ {/* Uses the .grid class from your stylesheet */}
+
-
- {/* Contributors Grid */}
-
-
- {/* Footer */}
-
-
- Thank you to all our contributors for making React-Verse awesome! 🎉
-
-
+ ))}
-
+
);
}
\ No newline at end of file
diff --git a/src/styles.css b/src/styles.css
index c1ba1b5..c6bfdc2 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -1366,4 +1366,4 @@ footer a {
footer a:hover {
color: var(--primary-hover);
-}
+}
\ No newline at end of file