diff --git a/index.html b/index.html index 128d0c14..ebe25444 100644 --- a/index.html +++ b/index.html @@ -63,7 +63,7 @@ Snigdha OS - Advanced Penetration Testing Distribution - + diff --git a/src/components/home/StatsSection.tsx b/src/components/home/StatsSection.tsx index c05af281..8217f360 100644 --- a/src/components/home/StatsSection.tsx +++ b/src/components/home/StatsSection.tsx @@ -15,6 +15,8 @@ export function StatsSection() { { label: "GitHub Stars", value: "Loading...", icon: Star }, ]); + const [error, setError] = useState(false); + const fetchGitHubStats = async (username: string) => { try { const response = await fetch(`https://api.github.com/users/${username}`); @@ -32,12 +34,7 @@ export function StatsSection() { ]); } catch (error) { console.error("Error fetching GitHub data:", error); - setStats((prevStats) => - prevStats.map((stat) => ({ - ...stat, - value: "N/A", - })) - ); + setError(true); } }; @@ -47,7 +44,7 @@ export function StatsSection() { }, []); return ( -
+

Our Impact

@@ -55,36 +52,42 @@ export function StatsSection() { A snapshot of our growing community and contributions.

-
- {stats.map((stat, index) => ( - + {error ? ( +
+ Unable to fetch data. Please try again later. +
+ ) : ( +
+ {stats.map((stat, index) => ( - - - - {stat.value} - -

{stat.label}

- - ))} -
+ + + + + {stat.value} + +

{stat.label}

+
+ ))} +
+ )}
);