Skip to content
This repository was archived by the owner on May 4, 2025. It is now read-only.

Commit 45fe23b

Browse files
committed
Removed meta link
1 parent 79d8463 commit 45fe23b

File tree

5 files changed

+44
-49
lines changed

5 files changed

+44
-49
lines changed

index.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
<head>
44
<meta charset="UTF-8" />
55

6-
<meta
7-
http-equiv="Content-Security-Policy"
8-
content="default-src 'self'; img-src 'self' https://foss-cell-gecpkd.github.io;"
9-
/>
10-
11-
<!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" /> -->
126
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
137
<link rel="preconnect" href="https://fonts.googleapis.com" />
148
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />

src/components/projectCard.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// src/components/ProjectCard.tsx
2-
3-
import React from 'react';
1+
import React from "react";
42
import { ExternalLink, Star } from "lucide-react";
53
import { SiGithub } from "@icons-pack/react-simple-icons";
64

@@ -43,9 +41,7 @@ const ProjectCard: React.FC<ProjectCardProps> = ({ project }) => {
4341
</span>
4442
)}
4543
</span>
46-
<p className="text-sm text-gray-600 mb-2">
47-
by {project.studentName}
48-
</p>
44+
<p className="text-sm text-gray-600 mb-2">by {project.studentName}</p>
4945
<p className="text-gray-700 mb-4">{project.description}</p>
5046

5147
<div className="flex flex-wrap gap-2 mb-4">
@@ -86,4 +82,4 @@ const ProjectCard: React.FC<ProjectCardProps> = ({ project }) => {
8682
);
8783
};
8884

89-
export default ProjectCard;
85+
export default ProjectCard;

src/hooks/useGithubStars.ts

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
// src/hooks/useGitHubStars.ts
2-
3-
import { useState, useEffect } from 'react';
4-
import {
5-
getStarsFromCache,
6-
saveStarsToCache,
7-
getExpiredStarsFromCache
8-
} from '../utils/githubCache';
9-
import { Project } from '../components/projectCard';
1+
import { useState, useEffect } from "react";
2+
import {
3+
getStarsFromCache,
4+
saveStarsToCache,
5+
getExpiredStarsFromCache,
6+
} from "../utils/githubCache";
7+
import { Project } from "../components/projectCard";
108

119
interface RateLimit {
1210
remaining: number;
@@ -25,56 +23,67 @@ export const useGitHubStars = (initialProjects: Project[]) => {
2523
const updatedProjects = await Promise.all(
2624
initialProjects.map(async (project) => {
2725
let stars = 0;
28-
26+
2927
if (project.githubLink) {
3028
try {
3129
const url = new URL(project.githubLink);
32-
const [, owner, repo] = url.pathname.split('/');
33-
30+
const [, owner, repo] = url.pathname.split("/");
31+
3432
if (owner && repo) {
3533
const repoKey = `${owner}/${repo}`;
36-
34+
3735
// Try to get data from cache if not forcing refresh
3836
if (!forceRefresh) {
3937
const cachedStars = getStarsFromCache(repoKey);
4038
if (cachedStars !== null) {
4139
return { ...project, stars: cachedStars };
4240
}
4341
}
44-
45-
const response = await fetch(`https://api.github.com/repos/${owner}/${repo}`);
46-
47-
const remaining = parseInt(response.headers.get('X-RateLimit-Remaining') || '0');
48-
const resetTimestamp = parseInt(response.headers.get('X-RateLimit-Reset') || '0') * 1000;
42+
43+
const response = await fetch(
44+
`https://api.github.com/repos/${owner}/${repo}`,
45+
);
46+
47+
const remaining = parseInt(
48+
response.headers.get("X-RateLimit-Remaining") || "0",
49+
);
50+
const resetTimestamp =
51+
parseInt(response.headers.get("X-RateLimit-Reset") || "0") *
52+
1000;
4953
const resetTime = new Date(resetTimestamp).toLocaleTimeString();
50-
54+
5155
setRateLimit({
5256
remaining,
53-
resetTime
57+
resetTime,
5458
});
55-
59+
5660
if (response.ok) {
5761
const data = await response.json();
5862
stars = data.stargazers_count;
59-
63+
6064
// Update cache for this repo
6165
saveStarsToCache(repoKey, stars);
6266
} else if (response.status === 403 && remaining === 0) {
6367
// If we hit rate limit, try to use expired cache if available
6468
const expiredStars = getExpiredStarsFromCache(repoKey);
6569
if (expiredStars !== null) {
6670
stars = expiredStars;
67-
console.warn(`Rate limit exceeded. Using expired cache for ${repoKey}`);
71+
console.warn(
72+
`Rate limit exceeded. Using expired cache for ${repoKey}`,
73+
);
6874
}
6975
}
7076
}
7177
} catch (error) {
72-
console.error(`Failed to fetch stars for ${project.projectName}:`, error);
78+
console.error(
79+
`Failed to fetch stars for ${project.projectName}:`,
80+
error,
81+
);
7382
}
7483
}
75-
84+
7685
return { ...project, stars };
77-
})
86+
}),
7887
);
7988

8089
setProjects(updatedProjects);
@@ -85,10 +94,10 @@ export const useGitHubStars = (initialProjects: Project[]) => {
8594
fetchGitHubStars();
8695
}, []);
8796

88-
return {
89-
projects,
90-
isLoading,
91-
rateLimit,
92-
refreshStars: () => fetchGitHubStars(true)
97+
return {
98+
projects,
99+
isLoading,
100+
rateLimit,
101+
refreshStars: () => fetchGitHubStars(true),
93102
};
94-
};
103+
};

tsconfig.app.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77
"module": "ESNext",
88
"skipLibCheck": true,
99

10-
/* Bundler mode */
1110
"moduleResolution": "bundler",
1211
"allowImportingTsExtensions": true,
1312
"isolatedModules": true,
1413
"moduleDetection": "force",
1514
"noEmit": true,
1615
"jsx": "react-jsx",
1716

18-
/* Linting */
1917
"strict": true,
2018
"noUnusedLocals": true,
2119
"noUnusedParameters": true,

tsconfig.node.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66
"module": "ESNext",
77
"skipLibCheck": true,
88

9-
/* Bundler mode */
109
"moduleResolution": "bundler",
1110
"allowImportingTsExtensions": true,
1211
"isolatedModules": true,
1312
"moduleDetection": "force",
1413
"noEmit": true,
1514

16-
/* Linting */
1715
"strict": true,
1816
"noUnusedLocals": true,
1917
"noUnusedParameters": true,

0 commit comments

Comments
 (0)