Skip to content

Commit

Permalink
Refactor GraphQL types and remove unused getPopular function
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorKowalczyk committed Jan 2, 2025
1 parent f483cb5 commit 2997f3c
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 342 deletions.
32 changes: 6 additions & 26 deletions config.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Contact, Header, Meta, Project, Technology } from "./lib/types";

export const meta = {
title: "Igor Kowalczyk",
description: "I’m a full-stack developer based in Poland 🇵🇱. I have a passion for building web applications and solving problems.",
Expand All @@ -21,35 +23,13 @@ export const meta = {
username: "majonezexe",
},
},
};
} satisfies Meta;

export const header = {
title: "Igor Kowalczyk",
subtitle: "Full-stack developer",
description: meta.description,
code: {
user: "igorkowalczyk",
},
};

export type Project = {
name: string;
started?: string;
ended?: string;
description: string;
images: {
src: string;
alt: string;
width: number;
height: number;
}[];
technologies: {
name: string;
icon: string;
}[];
website: string | null;
github: string | null;
};
} satisfies Header;

export const projects = [
{
Expand Down Expand Up @@ -299,7 +279,7 @@ export const contact = {
),
},
],
};
} satisfies Contact;

export const footer = {
categories: [
Expand Down Expand Up @@ -485,4 +465,4 @@ export const technologies = [
icon: "/assets/tech/eslint.svg",
link: "https://eslint.org/",
},
];
] satisfies Technology[];
2 changes: 0 additions & 2 deletions lib/graphql/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import "server-only";

export * from "./src/getOGImage";
export * from "./src/getPopular";
export * from "./src/getRepos";
export * from "./src/getTotalContributionsForYear";
export * from "./src/getTotalContributionsForYears";
export * from "./src/getTotalYears";
Expand Down
48 changes: 19 additions & 29 deletions lib/graphql/src/getOGImage.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,27 @@
import { meta } from "@/config";
import { requestGraphql } from "@/lib/graphql/src/requestGraphql";

interface Language {
size: number;
node: {
color: string;
name: string;
};
}

interface Repository {
openGraphImageUrl: string;
isPrivate: boolean;
description: string;
languages: {
edges: Language[];
totalSize: number;
};
owner: {
avatarUrl: string;
name: string;
};
stargazerCount: number;
}
import { Language } from "@/lib/types";

interface GraphqlResponse {
data: {
repository: Repository | null;
repository: {
openGraphImageUrl: string;
isPrivate: boolean;
description: string;
languages: {
edges: Language[];
totalSize: number;
};
owner: {
avatarUrl: string;
name: string;
};
stargazerCount: number;
} | null;
};
}

export async function GetOGImage(
repo: string,
owner: string
): Promise<null | {
interface Response {
domain: string;
private: boolean;
og: string;
Expand All @@ -45,7 +33,9 @@ export async function GetOGImage(
name: string;
};
stargazerCount: number;
}> {
}

export async function GetOGImage(repo: string, owner: string): Promise<Response | null> {
if (!repo || !owner) return null;
if (owner !== meta.accounts.github.username) return null;

Expand Down
89 changes: 0 additions & 89 deletions lib/graphql/src/getPopular.ts

This file was deleted.

139 changes: 0 additions & 139 deletions lib/graphql/src/getRepos.ts

This file was deleted.

Loading

0 comments on commit 2997f3c

Please sign in to comment.