Skip to content

Commit c4da3e0

Browse files
authored
Merge pull request #128 from Abhash-Chakraborty/Abhash/#126
🔄️ Replaced Issue with Repos in user card #126
2 parents e778a15 + 787c934 commit c4da3e0

File tree

9 files changed

+18
-41
lines changed

9 files changed

+18
-41
lines changed

src/app/[username]/page.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ export default function previewCard({ params }) {
2525
lang: false,
2626
star: false,
2727
fork: false,
28-
issue: false,
28+
repo: false,
2929
};
3030

3131
const updateURL = () => {
3232
const params = new URLSearchParams();
33-
const excludeKeys = ["username", "tagline", "lang", "UserName", "Tagline", "star_count", "fork_count", "issue_count", "update"];
33+
const excludeKeys = ["username", "tagline", "lang", "UserName", "Tagline", "star_count", "fork_count", "repo_count", "update"];
3434
Object.entries(config).forEach(([key, value]) => {
3535
if (!excludeKeys.includes(key) && value !== false && value !== "" && value !== null) {
3636
params.set(key, value);
@@ -131,7 +131,7 @@ export default function previewCard({ params }) {
131131

132132
const getUrlParams = (config) => {
133133
const params = new URLSearchParams();
134-
const includeKeys = ["theme", "font", "pattern", "image", "star", "fork", "issue"];
134+
const includeKeys = ["theme", "font", "pattern", "image", "star", "fork", "repo"];
135135
Object.entries(config).forEach(([key, value]) => {
136136
if (includeKeys.includes(key) && value !== false && value !== "" && value !== null) {
137137
params.set(key, value);
@@ -288,12 +288,12 @@ export default function previewCard({ params }) {
288288
<div className="flex gap-1 items-center justify-center">
289289
<input
290290
type="checkbox"
291-
name="issue"
292-
checked={config.issue || false}
291+
name="repo"
292+
checked={config.repo || false}
293293
onChange={handleChange}
294294
className="accent-blue-500"
295295
/>
296-
<label htmlFor="username">Issue</label>
296+
<label htmlFor="username">Repo</label>
297297
</div>
298298
</div>
299299
</form>

src/app/api/config/interface.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ export interface GitHubRepo {
33
description: string | null;
44
stargazers_count: number | null;
55
forks_count: number | null;
6-
open_issues_count: number | null;
76
owner: { login: string };
87
name: string;
98
};
@@ -19,10 +18,10 @@ export interface GitHubRepo {
1918
lang: boolean;
2019
star: boolean;
2120
fork: boolean;
22-
issue: boolean;
21+
repo: boolean;
2322
UserName: string;
2423
Tagline: string;
2524
star_count: number;
2625
fork_count: number;
27-
issue_count: number;
26+
repo_count: number;
2827
};

src/app/api/config/route.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export async function POST(request: Request): Promise<Response> {
2222
const Description: Record<string, string> = {};
2323
const Stars: Record<string, number | null> = {};
2424
const Forks: Record<string, number | null> = {};
25-
const Issues: Record<string, number | null> = {};
2625
const config: Config = {
2726
theme: "dark",
2827
font: "helvetica",
@@ -34,12 +33,12 @@ export async function POST(request: Request): Promise<Response> {
3433
lang: false,
3534
star: false,
3635
fork: false,
37-
issue: false,
36+
repo: false,
3837
UserName: userData[0].owner.login,
3938
Tagline: "",
4039
star_count: 0,
4140
fork_count: 0,
42-
issue_count: 0,
41+
repo_count: Object.keys(userData).length || 0,
4342
};
4443

4544
if (userData && Array.isArray(userData)) {
@@ -59,10 +58,6 @@ export async function POST(request: Request): Promise<Response> {
5958
if (item.forks_count !== null) {
6059
Forks[item.name] = item.forks_count;
6160
}
62-
63-
if (item.open_issues_count !== null) {
64-
Issues[item.name] = item.open_issues_count;
65-
}
6661
});
6762

6863
config.star_count = userData.reduce(
@@ -74,11 +69,6 @@ export async function POST(request: Request): Promise<Response> {
7469
(acc, item) => acc + (item.forks_count || 0),
7570
0
7671
);
77-
78-
config.issue_count = userData.reduce(
79-
(acc, item) => acc + (item.open_issues_count || 0),
80-
0
81-
);
8272
}
8373

8474
const filteredDescription: Record<string, string> = {};

src/app/api/generate_tagline/interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export interface GenerateTaglineParams {
55
config: {
66
star_count: number;
77
fork_count: number;
8-
issue_count: number;
8+
repo_count: number;
99
};
1010
}
1111

src/app/api/generate_tagline/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export async function POST(request: Request): Promise<Response> {
1313
${Object.entries(Description)
1414
.map(([repo, desc]) => `${repo}: ${desc}`)
1515
.join(", ")}
16-
Total Stars: ${config.star_count}, Total Forks: ${config.fork_count}, Total Issues: ${config.issue_count}
16+
Total Stars: ${config.star_count}, Total Forks: ${config.fork_count}, Total Repositories: ${config.repo_count}
1717
18-
The tagline should summarize their impact, versatility, quality, and strength, everything in 100 characters or less, in a meaningful professional tone.
18+
The tagline should summarize their impactfulness, quality, and strength, everything in 100 characters or less, in a meaningful professional tone. Also, the tagline should be unique and not generic. Should inculde user's personal or professional traits.
1919
2020
Only generate one tagline. Do not include any code or code-like syntax in the response. Do not include any personal information.
2121
Do not include any offensive or inappropriate content. Do not include any content that is not safe for work.

src/app/api/github_profile/interface.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ export interface GitHubRepo {
33
description: string | null;
44
stargazers_count: number | null;
55
forks_count: number | null;
6-
open_issues_count: number | null;
76
name: string;
87
}

src/app/api/github_profile/route.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ export async function POST(request: Request): Promise<Response> {
2222
const Description: Record<string, string | null> = {};
2323
const Stars: Record<string, number | null> = {};
2424
const Forks: Record<string, number | null> = {};
25-
const Issues: Record<string, number | null> = {};
2625
const config = {
2726
star_count: 0,
2827
fork_count: 0,
29-
issue_count: 0,
28+
repo_count: 0 || Object.keys(userData).length,
3029
};
3130

3231
if (userData && Array.isArray(userData)) {
@@ -46,10 +45,6 @@ export async function POST(request: Request): Promise<Response> {
4645
if (item.forks_count !== null) {
4746
Forks[item.name] = item.forks_count;
4847
}
49-
50-
if (item.open_issues_count !== null) {
51-
Issues[item.name] = item.open_issues_count;
52-
}
5348
});
5449

5550
config.star_count = userData.reduce(
@@ -61,19 +56,13 @@ export async function POST(request: Request): Promise<Response> {
6156
(acc, item) => acc + (item.forks_count || 0),
6257
0
6358
);
64-
65-
config.issue_count = userData.reduce(
66-
(acc, item) => acc + (item.open_issues_count || 0),
67-
0
68-
);
6959
}
7060

7161
return new Response(JSON.stringify({
7262
Languages,
7363
Description,
7464
Stars,
7565
Forks,
76-
Issues,
7766
config,
7867
}), {
7968
headers: { "Content-Type": "application/json" },

src/app/api/image/route.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ export async function GET(req) {
4444
lang: configData.lang !== undefined ? configData.lang : false,
4545
star: query.star !== undefined ? true : configData.star !== undefined ? configData.star : false,
4646
fork: query.fork !== undefined ? true : configData.fork !== undefined ? configData.fork : false,
47-
issue: query.issue !== undefined ? true : configData.issue !== undefined ? configData.issue : false,
47+
repo: query.repo !== undefined ? true : configData.repo !== undefined ? configData.repo : false,
4848
UserName: configData.UserName || '',
4949
Tagline: configData.Tagline || '',
5050
star_count: configData.star_count || 0,
5151
fork_count: configData.fork_count || 0,
52-
issue_count: configData.issue_count || 0,
52+
repo_count: configData.repo_count || 0,
5353
};
5454

5555

src/components/RenderSVG.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const RenderSVG = (config) => {
1010
const activeStats = [];
1111
if (config.star) activeStats.push({ label: "Star", color: "orange", count: config.star_count || 0 });
1212
if (config.fork) activeStats.push({ label: "Fork", color: "lightblue", count: config.fork_count || 0 });
13-
if (config.issue) activeStats.push({ label: "Issue", color: "lightgreen", count: config.issue_count || 0 });
13+
if (config.repo) activeStats.push({ label: "Repo", color: "lightgreen", count: config.repo_count || 0 });
1414

1515
const positions = calculatePositions(activeStats, 720);
1616

@@ -57,7 +57,7 @@ const RenderSVG = (config) => {
5757
});
5858
};
5959

60-
const statsDisplayed = config.star || config.fork || config.issue;
60+
const statsDisplayed = config.star || config.fork || config.repo;
6161
const yOffset = statsDisplayed ? -30 : 0;
6262

6363
const patternSrc = {

0 commit comments

Comments
 (0)