Skip to content

Commit a19fbc0

Browse files
Merge branch 'main' into FeatureGitHub-Analysis-dashboard-1
2 parents a8c6dc1 + 9fa26a8 commit a19fbc0

8 files changed

Lines changed: 164 additions & 160 deletions

File tree

.github/workflows/auto-label-gssoc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ jobs:
1717
with:
1818
github_token: ${{ secrets.GITHUB_TOKEN }} # Use GITHUB_TOKEN for issues
1919
labels: |
20-
gssoc2025
20+
gssoc25
2121
2222
- name: Add labels to new pull requests
2323
if: github.event_name == 'pull_request_target'
2424
uses: actions-ecosystem/action-add-labels@v1
2525
with:
2626
github_token: ${{ secrets.GITHUB_TOKEN }} # Use GITHUB_TOKEN for PRs
2727
labels: |
28-
gssoc2025
28+
gssoc25

src/Routes/Router.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
import { Navigate, Route, Routes } from "react-router-dom"
23
import Home from "../pages/Home/Home"
34
import About from "../pages/About/About"
@@ -13,16 +14,16 @@ import UserAnalytics from "../pages/UserAnalytics/UserAnalytics.tsx";
1314
const Router = () => {
1415
return (
1516
<Routes>
16-
{/* Redirect from root (/) to the home page */}
17+
<Route path="/" element={<Home />} />
1718
<Route path="/signup" element={<Signup />} />
1819
<Route path="/login" element={<Login />} />
19-
<Route path="/" element={<Home />} />
2020
<Route path="/analytics" element={<UserAnalytics />} />
2121
<Route path="/about" element={<About />} />
2222
<Route path="/contact" element={<Contact />} />
2323
<Route path="/contributors" element={<Contributors />} />
24-
<Route path="/user/:username" element={<UserProfile />} />
24+
<Route path="/contributor/:username" element={<ContributorProfile />} />
2525
</Routes>
2626
);
27-
};
27+
};
28+
2829
export default Router;

src/hooks/useGitHubAuth.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
import { useState } from 'react';
1+
import { useState, useMemo } from 'react';
22
import { Octokit } from '@octokit/core';
33

44
export const useGitHubAuth = () => {
55
const [username, setUsername] = useState('');
66
const [token, setToken] = useState('');
77
const [error, setError] = useState('');
88

9-
const getOctokit = () => {
9+
const octokit = useMemo(() => {
1010
if (!username || !token) return null;
1111
return new Octokit({ auth: token });
12-
};
12+
}, [username, token]);
13+
14+
const getOctokit = () => octokit;
1315

1416
return {
1517
username,

src/hooks/useGitHubData.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
23
// import { useState, useCallback } from 'react';
34

45
// export const useGitHubData = (octokit) => {
@@ -60,4 +61,7 @@
6061
// error,
6162
// fetchData,
6263
// };
63-
// };
64+
// };
65+
66+
67+

src/hooks/usePagination.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/pages/UserProfile/UserProfile.tsx renamed to src/pages/ContributorProfile/ContributorProfile.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ type PR = {
88
repository_url: string;
99
};
1010

11-
export default function UserProfile() {
11+
export default function ContributorProfile() {
1212
const { username } = useParams();
1313
const [profile, setProfile] = useState<any>(null);
1414
const [prs, setPRs] = useState<PR[]>([]);
@@ -23,7 +23,9 @@ export default function UserProfile() {
2323
const userData = await userRes.json();
2424
setProfile(userData);
2525

26-
const prsRes = await fetch(`https://api.github.com/search/issues?q=author:${username}+type:pr`);
26+
const prsRes = await fetch(
27+
`https://api.github.com/search/issues?q=author:${username}+type:pr`
28+
);
2729
const prsData = await prsRes.json();
2830
setPRs(prsData.items);
2931
} catch (error) {
@@ -43,12 +45,19 @@ export default function UserProfile() {
4345

4446
if (loading) return <div className="text-center mt-10">Loading...</div>;
4547

46-
if (!profile) return <div className="text-center mt-10 text-red-600">User not found.</div>;
48+
if (!profile)
49+
return (
50+
<div className="text-center mt-10 text-red-600">User not found.</div>
51+
);
4752

4853
return (
4954
<div className="max-w-3xl mx-auto mt-2 mb-2 p-4 bg-white dark:bg-gray-800 dark:text-white shadow-xl rounded-xl">
5055
<div className="text-center">
51-
<img src={profile.avatar_url} alt="Avatar" className="w-24 h-24 mx-auto rounded-full" />
56+
<img
57+
src={profile.avatar_url}
58+
alt="Avatar"
59+
className="w-24 h-24 mx-auto rounded-full"
60+
/>
5261
<h2 className="text-2xl font-bold mt-2">{profile.login}</h2>
5362
<p className="">{profile.bio}</p>
5463
<button

src/pages/Contributors/Contributors.tsx

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ const ContributorsPage = () => {
7373
<Grid container spacing={4}>
7474
{contributors.map((contributor) => (
7575
<Grid item xs={12} sm={6} md={3} key={contributor.id}>
76-
<Link
77-
to={`/user/${contributor.login}`}
78-
style={{ textDecoration: "none" }}
79-
>
8076
<Card
8177
sx={{
8278
textAlign: "center",
@@ -93,46 +89,50 @@ const ContributorsPage = () => {
9389
},
9490
}}
9591
>
96-
<Avatar
97-
src={contributor.avatar_url}
98-
alt={contributor.login}
99-
sx={{ width: 100, height: 100, mx: "auto", mb: 2 }}
100-
/>
92+
<Link
93+
to={`/contributor/${contributor.login}`}
94+
style={{ textDecoration: "none" }}
95+
>
96+
<Avatar
97+
src={contributor.avatar_url}
98+
alt={contributor.login}
99+
sx={{ width: 100, height: 100, mx: "auto", mb: 2 }}
100+
/>
101+
<CardContent>
102+
<Typography variant="h6" sx={{ fontWeight: "bold" }}>
103+
{contributor.login}
104+
</Typography>
101105

102-
<CardContent>
103-
<Typography variant="h6" sx={{ fontWeight: "bold" }}>
104-
{contributor.login}
105-
</Typography>
106-
107-
<Typography variant="body2" color="text.secondary">
108-
{contributor.contributions} Contributions
109-
</Typography>
110-
{/*
111-
<Typography variant="body2" sx={{ mt: 2 }}>
112-
Thank you for your valuable contributions to our
113-
community!
114-
</Typography> */}
106+
<Typography variant="body2" color="text.secondary">
107+
{contributor.contributions} Contributions
108+
</Typography>
109+
{/*
110+
<Typography variant="body2" sx={{ mt: 2 }}>
111+
Thank you for your valuable contributions to our
112+
community!
113+
</Typography> */}
114+
</CardContent>
115+
</Link>
115116

116117
<Box sx={{ mt: 2 }}>
117-
<Button
118-
variant="contained"
119-
startIcon={<FaGithub />}
120-
href={contributor.html_url}
121-
target="_blank"
122-
sx={{
123-
backgroundColor: "#333333",
124-
color: "#FFFFFF",
125-
"&:hover": {
126-
backgroundColor: "#555555",
127-
},
128-
}}
129-
>
130-
GitHub Profile
131-
</Button>
118+
<Button
119+
variant="contained"
120+
startIcon={<FaGithub />}
121+
href={contributor.html_url}
122+
target="_blank"
123+
sx={{
124+
backgroundColor: "#333333",
125+
textTransform: "none",
126+
color: "#FFFFFF",
127+
"&:hover": {
128+
backgroundColor: "#555555",
129+
},
130+
}}
131+
>
132+
GitHub
133+
</Button>
132134
</Box>
133-
</CardContent>
134135
</Card>
135-
</Link>
136136
</Grid>
137137
))}
138138
</Grid>

0 commit comments

Comments
 (0)