Skip to content

Commit

Permalink
added org login in repos list
Browse files Browse the repository at this point in the history
  • Loading branch information
Andcool-Systems committed Jan 27, 2025
1 parent 613fc6e commit 6cc7e03
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/apis/apis.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 3 additions & 0 deletions src/apis/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ interface GithubRepos {
repositories: {
nodes: {
name: string,
owner: {
login: string
},
stargazerCount: number

}[]
Expand Down
12 changes: 8 additions & 4 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
},
/**
Expand Down
8 changes: 7 additions & 1 deletion src/widget/widget.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }), {});
Expand Down

0 comments on commit 6cc7e03

Please sign in to comment.