diff --git a/README.md b/README.md index d7e660e..8710f60 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ - Profile Stats - Profile Contribution Calander - List of Followers(last 100) +- Pinned Repositories - Most forked Repository Graph - Most Stared Repository Graph diff --git a/components/profile/ProfilePinnedRepositories.js b/components/profile/ProfilePinnedRepositories.js new file mode 100644 index 0000000..a091ce4 --- /dev/null +++ b/components/profile/ProfilePinnedRepositories.js @@ -0,0 +1,76 @@ +import Link from 'next/link'; +import React from 'react'; + +const ProfilePinnedRepositories = ({ username, pinnedRepositories }) => { + return ( +
+

+

+ {'@'} {username} Pinned Repositories +
+
+ {'(Total: '} + {pinnedRepositories.totalCount} + {')'} +
+

+
+ {pinnedRepositories?.nodes.map((repo) => ( + + +
+ +

+ + + + + + + + + {repo.name} +

+ +

+ {repo.shortDescriptionHTML} +

+ +

+ + + + + { repo.stargazerCount } + {' | '} + + + + + { repo.watchers.totalCount } + {' | '} + + + + { repo.forks.totalCount } + + +

+ {repo.languages?.nodes.map((lang) => ( +
+ { lang.name } +
+
+ ))} +
+

+
+
+ + ))} +
+
+ ); +}; + +export default ProfilePinnedRepositories; diff --git a/graphql/Query.js b/graphql/Query.js index 528ad66..dc3f97f 100644 --- a/graphql/Query.js +++ b/graphql/Query.js @@ -63,6 +63,33 @@ export const GET_USER = gql` ) { totalCount } + pinnedItems(types:REPOSITORY, first: 100) { + nodes { + ... on Repository { + id + name + url + stargazerCount + shortDescriptionHTML + watchers { + totalCount + } + forks { + totalCount + } + languages(first: 1, orderBy: {direction: DESC, field: SIZE}) { + nodes { + ... on Language { + id + name + color + } + } + } + } + } + totalCount + } contributionsCollection { contributionCalendar { totalContributions diff --git a/pages/user/[username].js b/pages/user/[username].js index cc85314..cedb32e 100644 --- a/pages/user/[username].js +++ b/pages/user/[username].js @@ -22,6 +22,9 @@ const ProfileNums = dynamic(() => const ProfileFollowers = dynamic(() => import("../../components/profile/ProfileFollowers") ); +const ProfilePinnedRepositories = dynamic(() => + import('../../components/profile/ProfilePinnedRepositories') +); const ProfileCalendar = dynamic(() => import("../../components/profile/ProfileCalendar") ); @@ -114,10 +117,17 @@ const UserName = ({ user, ogImageUrl }) => { - +
+
+ +
+
+ +
+
);