A few things here and there
This commit is contained in:
@@ -0,0 +1,34 @@
|
|||||||
|
import { NextRequest, NextResponse } from "next/server";
|
||||||
|
|
||||||
|
export async function GET(req: NextRequest) {
|
||||||
|
const username = "kleo-dev";
|
||||||
|
const token = process.env.GITHUB_TOKEN;
|
||||||
|
|
||||||
|
const query = `
|
||||||
|
query {
|
||||||
|
user(login: "${username}") {
|
||||||
|
contributionsCollection {
|
||||||
|
contributionCalendar {
|
||||||
|
totalContributions
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const response = await fetch("https://api.github.com/graphql", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ query }),
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
const total =
|
||||||
|
data.data.user.contributionsCollection.contributionCalendar
|
||||||
|
.totalContributions;
|
||||||
|
|
||||||
|
return NextResponse.json({ total }, { status: 200 });
|
||||||
|
}
|
||||||
+1
-7
@@ -15,13 +15,7 @@ export default function RootLayout({
|
|||||||
}>) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body className="antialiased bg-black">
|
<body className="antialiased bg-black">{children}</body>
|
||||||
{/* <Background> */}
|
|
||||||
{/* <div className="relative h-screen overflow-y-scroll"> */}
|
|
||||||
{children}
|
|
||||||
{/* </div> */}
|
|
||||||
{/* </Background> */}
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+26
-8
@@ -1,3 +1,5 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
import PinnedRepos from "@/components/PinnedRepos";
|
import PinnedRepos from "@/components/PinnedRepos";
|
||||||
import Skill from "@/components/Skill";
|
import Skill from "@/components/Skill";
|
||||||
import {
|
import {
|
||||||
@@ -12,9 +14,22 @@ import {
|
|||||||
} from "@fortawesome/free-brands-svg-icons";
|
} from "@fortawesome/free-brands-svg-icons";
|
||||||
import { faJava } from "@fortawesome/free-brands-svg-icons/faJava";
|
import { faJava } from "@fortawesome/free-brands-svg-icons/faJava";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
import GitHubCalendar from "react-github-calendar";
|
import GitHubCalendar from "react-github-calendar";
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
|
const [contribs, setContribs] = useState<number>();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchContributions = async () => {
|
||||||
|
const res = await fetch("/api/contribs");
|
||||||
|
const data = await res.json();
|
||||||
|
console.log("Total contributions:", data.total);
|
||||||
|
setContribs(data.total || undefined);
|
||||||
|
};
|
||||||
|
fetchContributions();
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="content-center w-full lg:mx-auto pt-5 relative z-20 pb-10 animate-fadeIn">
|
<div className="content-center w-full lg:mx-auto pt-5 relative z-20 pb-10 animate-fadeIn">
|
||||||
@@ -35,8 +50,7 @@ export default function App() {
|
|||||||
<a href="https://github.com/kleo-dev/" target="blank_">
|
<a href="https://github.com/kleo-dev/" target="blank_">
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faGithub}
|
icon={faGithub}
|
||||||
width={36}
|
className="text-slate-300 size-[2.3rem]"
|
||||||
className="text-slate-300"
|
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
@@ -45,15 +59,16 @@ export default function App() {
|
|||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faLinkedin}
|
icon={faLinkedin}
|
||||||
width={36}
|
className="text-slate-300 size-[2.3rem]"
|
||||||
className="text-slate-300"
|
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.instagram.com/kleo.dev/" target="blank_">
|
<a
|
||||||
|
href="https://www.instagram.com/selimaj.dev/"
|
||||||
|
target="blank_"
|
||||||
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faInstagram}
|
icon={faInstagram}
|
||||||
width={36}
|
className="text-slate-300 size-[2.3rem]"
|
||||||
className="text-slate-300"
|
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -75,7 +90,10 @@ export default function App() {
|
|||||||
<section className="">
|
<section className="">
|
||||||
<PinnedRepos />
|
<PinnedRepos />
|
||||||
</section>
|
</section>
|
||||||
<section className="mt-8">
|
<h2 className="text-slate-300 mt-7">
|
||||||
|
{contribs || "Loading.."} contributions in the last year
|
||||||
|
</h2>
|
||||||
|
<section className="mt-4">
|
||||||
<GitHubCalendar
|
<GitHubCalendar
|
||||||
username="kleo-dev"
|
username="kleo-dev"
|
||||||
theme={{
|
theme={{
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export function Repo({
|
|||||||
strokeWidth="2"
|
strokeWidth="2"
|
||||||
strokeLinecap="round"
|
strokeLinecap="round"
|
||||||
strokeLinejoin="round"
|
strokeLinejoin="round"
|
||||||
className="lucide lucide-star text-yellow-500 h-3 w-3 sm:h-4 sm:w-4"
|
className="lucide lucide-star text-gray-300 h-3 w-3 sm:h-4 sm:w-4"
|
||||||
>
|
>
|
||||||
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />
|
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ export default function Skill({
|
|||||||
|
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={icon}
|
icon={icon}
|
||||||
width={40}
|
className={`text-gray-300 ${classInsert} size-[2.3rem]`}
|
||||||
className={`text-slate-300 ${classInsert} cursor-pointer`}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user