Compare commits
1 commit
developmen
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
60481a9adf |
3 changed files with 20 additions and 22 deletions
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
24
package.json
24
package.json
|
@ -9,27 +9,27 @@
|
||||||
"lint": "next lint"
|
"lint": "next lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@radix-ui/react-separator": "^1.1.2",
|
"@radix-ui/react-separator": "^1.1.1",
|
||||||
"@radix-ui/react-slot": "^1.1.2",
|
"@radix-ui/react-slot": "^1.1.1",
|
||||||
"@radix-ui/react-tabs": "^1.1.3",
|
"@radix-ui/react-tabs": "^1.1.2",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"lucide-react": "^0.468.0",
|
"lucide-react": "^0.468.0",
|
||||||
"next": "15.1.0",
|
"next": "15.1.0",
|
||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
"react-dom": "^19.0.0",
|
"react-dom": "^19.0.0",
|
||||||
"tailwind-merge": "^2.6.0",
|
"tailwind-merge": "^2.5.5",
|
||||||
"tailwindcss-animate": "^1.0.7"
|
"tailwindcss-animate": "^1.0.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^5.7.3",
|
"typescript": "^5",
|
||||||
"@types/node": "^20.17.19",
|
"@types/node": "^20",
|
||||||
"@types/react": "^19.0.10",
|
"@types/react": "^19",
|
||||||
"@types/react-dom": "^19.0.4",
|
"@types/react-dom": "^19",
|
||||||
"postcss": "^8.5.3",
|
"postcss": "^8",
|
||||||
"tailwindcss": "^3.4.17",
|
"tailwindcss": "^3.4.1",
|
||||||
"eslint": "^9.21.0",
|
"eslint": "^9",
|
||||||
"eslint-config-next": "15.1.0",
|
"eslint-config-next": "15.1.0",
|
||||||
"@eslint/eslintrc": "^3.3.0"
|
"@eslint/eslintrc": "^3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ const calculateAge = (birthdate: Date): number => {
|
||||||
return age;
|
return age;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getRepos = async (username: string, options: RequestInit = {}) => {
|
const getRepos = async (username: string) => {
|
||||||
let repos: Repository[] = [];
|
let repos: Repository[] = [];
|
||||||
let page = 1;
|
let page = 1;
|
||||||
let hasNextPage = true;
|
let hasNextPage = true;
|
||||||
|
@ -31,7 +31,6 @@ const getRepos = async (username: string, options: RequestInit = {}) => {
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/vnd.github+json',
|
Accept: 'application/vnd.github+json',
|
||||||
},
|
},
|
||||||
...options,
|
|
||||||
});
|
});
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
|
@ -47,12 +46,11 @@ const getRepos = async (username: string, options: RequestInit = {}) => {
|
||||||
return repos;
|
return repos;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getLanguages = async (repo: Repository, options: RequestInit = {}) => {
|
const getLanguages = async (repo: Repository) => {
|
||||||
const response = await fetch(repo.languages_url, {
|
const response = await fetch(repo.languages_url, {
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/vnd.github+json',
|
Accept: 'application/vnd.github+json',
|
||||||
},
|
},
|
||||||
...options,
|
|
||||||
});
|
});
|
||||||
return await response.json();
|
return await response.json();
|
||||||
};
|
};
|
||||||
|
@ -61,7 +59,7 @@ const accumulateLanguages = async (repos: Repository[]) => {
|
||||||
const languages: { [key: string]: number } = {};
|
const languages: { [key: string]: number } = {};
|
||||||
|
|
||||||
for (const repo of repos) {
|
for (const repo of repos) {
|
||||||
const repoLanguages = await getLanguages(repo, { next: { revalidate: 3600 } });
|
const repoLanguages = await getLanguages(repo);
|
||||||
for (const lang in repoLanguages) {
|
for (const lang in repoLanguages) {
|
||||||
languages[lang] = (languages[lang] || 0) + repoLanguages[lang];
|
languages[lang] = (languages[lang] || 0) + repoLanguages[lang];
|
||||||
}
|
}
|
||||||
|
@ -82,11 +80,11 @@ const accumulateStars = (repos: Repository[]) => {
|
||||||
|
|
||||||
export default async function Home() {
|
export default async function Home() {
|
||||||
|
|
||||||
const profileResponse = await fetch('https://api.github.com/users/markusthielker', { next: { revalidate: 3600 } });
|
const profileResponse = await fetch('https://api.github.com/users/markusthielker');
|
||||||
const profile = await profileResponse.json() as PublicUser;
|
const profile = await profileResponse.json() as PublicUser;
|
||||||
|
|
||||||
const username = 'markusthielker';
|
const username = 'markusthielker';
|
||||||
const repos = await getRepos(username, { next: { revalidate: 3600 } });
|
const repos = await getRepos(username);
|
||||||
const languages = await accumulateLanguages(repos);
|
const languages = await accumulateLanguages(repos);
|
||||||
const stars = accumulateStars(repos);
|
const stars = accumulateStars(repos);
|
||||||
const totalBytes = Object.values(languages).reduce((sum, bytes) => sum + bytes, 0);
|
const totalBytes = Object.values(languages).reduce((sum, bytes) => sum + bytes, 0);
|
||||||
|
@ -100,7 +98,7 @@ export default async function Home() {
|
||||||
.slice(0, 3);
|
.slice(0, 3);
|
||||||
|
|
||||||
const age = calculateAge(new Date('2001-03-04'));
|
const age = calculateAge(new Date('2001-03-04'));
|
||||||
const year = new Date().getFullYear();
|
const year = new Date().getFullYear()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col min-h-screen">
|
<div className="flex flex-col min-h-screen">
|
||||||
|
@ -164,8 +162,7 @@ export default async function Home() {
|
||||||
<section className="grid gap-4 grid-cols-2 sm:grid-cols-4 md:grid-cols-8">
|
<section className="grid gap-4 grid-cols-2 sm:grid-cols-4 md:grid-cols-8">
|
||||||
|
|
||||||
{ /* images */}
|
{ /* images */}
|
||||||
<Card
|
<Card className="col-span-2 sm:col-span-4 md:row-span-2 overflow-hidden sm:grid sm:gap-0.5 sm:grid-cols-2 lg:grid-cols-5 sm:grid-row-2 md:max-h-72">
|
||||||
className="col-span-2 sm:col-span-4 md:row-span-2 overflow-hidden sm:grid sm:gap-0.5 sm:grid-cols-2 lg:grid-cols-5 sm:grid-row-2 md:max-h-72">
|
|
||||||
<div className="flex sm:col-span-1 lg:col-span-3 lg:row-span-2 max-h-72">
|
<div className="flex sm:col-span-1 lg:col-span-3 lg:row-span-2 max-h-72">
|
||||||
<Image
|
<Image
|
||||||
height="500"
|
height="500"
|
||||||
|
@ -255,6 +252,7 @@ export default async function Home() {
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
|
{ /* TODO */}
|
||||||
<Card className="hidden sm:block sm:col-span-2 md:hidden lg:block">
|
<Card className="hidden sm:block sm:col-span-2 md:hidden lg:block">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardDescription>
|
<CardDescription>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue