diff --git a/src/apis/apis.service.ts b/src/apis/apis.service.ts index ed62dbe..4b34913 100644 --- a/src/apis/apis.service.ts +++ b/src/apis/apis.service.ts @@ -18,7 +18,7 @@ export class APIService { { query: "query GetUserDetails($username: String!) { user(login: $username)" + "{ name login followers { totalCount } repositories(first: 100, orderBy: {field: STARGAZERS, direction: DESC})" + - "{ nodes { name stargazerCount } } } } }", + "{ nodes { name owner { login } stargazerCount } } } } }", variables: { username: username } diff --git a/src/apis/types.d.ts b/src/apis/types.d.ts index 6821484..e4ec2a8 100644 --- a/src/apis/types.d.ts +++ b/src/apis/types.d.ts @@ -9,6 +9,9 @@ interface GithubRepos { repositories: { nodes: { name: string, + owner: { + login: string + }, stargazerCount: number }[] diff --git a/src/config.ts b/src/config.ts index f1a7c05..63d3a79 100644 --- a/src/config.ts +++ b/src/config.ts @@ -20,12 +20,16 @@ const config: ConfigType = { typeColor: (type: TypeofTypes): string => { switch (type) { case 'bigint': - case 'number': return '#b5cea8'; + case 'number': + return '#b5cea8'; case 'object': case 'undefined': - case 'boolean': return '#569cd6'; - case 'function': return '#dcdcaa'; - default: return '#ce9178'; + case 'boolean': + return '#569cd6'; + case 'function': + return '#dcdcaa'; + default: + return '#ce9178'; } }, /** diff --git a/src/widget/widget.service.ts b/src/widget/widget.service.ts index b18c0f0..3c4329a 100644 --- a/src/widget/widget.service.ts +++ b/src/widget/widget.service.ts @@ -62,7 +62,13 @@ export class WidgetService { ]); const top_repos = github_data?.data?.user?.repositories?.nodes?.slice(0, 3) - ?.reduce((acc, value) => ({ ...acc, [value.name]: value.stargazerCount }), {}); + ?.reduce((acc, value) => { + const name = github_data.data.user.login !== value.owner.login ? + `${value.owner.login}/${value.name}` + : + value.name; + return { ...acc, [name]: value.stargazerCount } + }, {}); const top_langs = wakatime_last?.data?.slice(0, 3) ?.reduce((acc, value) => ({ ...acc, [value.name.toLowerCase().replaceAll('+', 'p')]: value.text }), {});