Stats fix
This commit is contained in:
@@ -3,6 +3,10 @@ import { NextRequest, NextResponse } from "next/server";
|
||||
var lastGitRequest = new Date("2023-01-10T12:00:00Z");
|
||||
var stats = { stars: 0, forks: 0, contributors: 0 };
|
||||
|
||||
function isIterable(obj: any): obj is Iterable<any> {
|
||||
return obj != null && typeof obj[Symbol.iterator] === "function";
|
||||
}
|
||||
|
||||
async function getStats() {
|
||||
let page = 0;
|
||||
let stars = 0;
|
||||
@@ -15,7 +19,7 @@ async function getStats() {
|
||||
);
|
||||
const repos = await res.json();
|
||||
|
||||
if (repos.length === 0) break;
|
||||
if (repos.length === 0 || !isIterable(repos)) break;
|
||||
|
||||
for (const repo of repos) {
|
||||
stars += repo.stargazers_count;
|
||||
|
||||
+3
-3
@@ -150,14 +150,14 @@ export default function HomePage() {
|
||||
</motion.a>
|
||||
|
||||
<motion.a
|
||||
href="https://discord.gg/HFRsNxfCqT"
|
||||
href="/projects"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center justify-center gap-2 px-8 py-4 border-2 border-purple-500 hover:bg-purple-500/15 rounded-lg font-semibold text-lg transition-all"
|
||||
whileTap={{ scale: 0.95 }}
|
||||
>
|
||||
<MessageSquare className="w-5 h-5" />
|
||||
Join Community
|
||||
View Our Projects
|
||||
<Github className="w-5 h-5" />
|
||||
</motion.a>
|
||||
</motion.div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user