From f85254657bbbaf56e0a41e78adc95d063e857e3b Mon Sep 17 00:00:00 2001 From: Christian Franchin dos Santos Date: Thu, 6 Oct 2022 07:32:31 -0300 Subject: [PATCH 1/7] feat(ProfilePinnedRepositories): adds a card with pinned repositories from the user Closes #14 --- components/graphs/ContributionGraph.js | 2 +- .../profile/ProfilePinnedRepositories.js | 61 +++++++++++++++++++ graphql/Query.js | 18 ++++++ pages/user/[username].js | 18 ++++-- public/svg/eye.svg | 4 ++ public/svg/fork.svg | 3 + public/svg/star.svg | 3 + 7 files changed, 104 insertions(+), 5 deletions(-) create mode 100644 components/profile/ProfilePinnedRepositories.js create mode 100644 public/svg/eye.svg create mode 100644 public/svg/fork.svg create mode 100644 public/svg/star.svg diff --git a/components/graphs/ContributionGraph.js b/components/graphs/ContributionGraph.js index c405173..d3a755b 100644 --- a/components/graphs/ContributionGraph.js +++ b/components/graphs/ContributionGraph.js @@ -33,7 +33,7 @@ const ContributionGraph = ({ weeks, username }) => { }; return ( -
+

{username}'s Contribution Graph

diff --git a/components/profile/ProfilePinnedRepositories.js b/components/profile/ProfilePinnedRepositories.js new file mode 100644 index 0000000..4db2d9a --- /dev/null +++ b/components/profile/ProfilePinnedRepositories.js @@ -0,0 +1,61 @@ +import Image from 'next/image'; +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} +

+

+ Stars + { repo.stargazerCount } + {' | '} + Watchers + { repo.watchers.totalCount } + {' | '} + Forks + {repo.forks.totalCount} +

+
+
+ + ))} +
+
+ ); +}; + +export default ProfilePinnedRepositories; diff --git a/graphql/Query.js b/graphql/Query.js index 0a0fd8a..98cb9dc 100644 --- a/graphql/Query.js +++ b/graphql/Query.js @@ -63,6 +63,24 @@ export const GET_USER = gql` ) { totalCount } + pinnedItems(types:REPOSITORY, first: 100) { + nodes { + ... on Repository { + id + name + url + stargazerCount + shortDescriptionHTML + watchers { + totalCount + } + forks { + totalCount + } + } + } + totalCount + } contributionsCollection { contributionCalendar { totalContributions diff --git a/pages/user/[username].js b/pages/user/[username].js index da3d096..1708164 100644 --- a/pages/user/[username].js +++ b/pages/user/[username].js @@ -21,6 +21,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') @@ -111,10 +114,17 @@ const UserName = ({ user, ogImageUrl }) => {
- +
+
+ +
+
+ +
+
); diff --git a/public/svg/eye.svg b/public/svg/eye.svg new file mode 100644 index 0000000..bf7fe3d --- /dev/null +++ b/public/svg/eye.svg @@ -0,0 +1,4 @@ + + + + diff --git a/public/svg/fork.svg b/public/svg/fork.svg new file mode 100644 index 0000000..01511f5 --- /dev/null +++ b/public/svg/fork.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/svg/star.svg b/public/svg/star.svg new file mode 100644 index 0000000..1828814 --- /dev/null +++ b/public/svg/star.svg @@ -0,0 +1,3 @@ + + + From d3a44b230507ec5b5145c9cddcfe3f7c8d179d0d Mon Sep 17 00:00:00 2001 From: Christian Franchin dos Santos Date: Thu, 6 Oct 2022 07:40:27 -0300 Subject: [PATCH 2/7] docs(README.md): add pinned repositories as a content --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 941a3cc..fb53307 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 From d0ea15ebec3e3c646ec21162e702c5a810f90fce Mon Sep 17 00:00:00 2001 From: Christian Franchin dos Santos Date: Wed, 12 Oct 2022 15:52:21 -0300 Subject: [PATCH 3/7] style(ProfilePinnedRepositories): change fork icon --- .../profile/ProfilePinnedRepositories.js | 2 +- public/svg/fork.svg | 150 +++++++++++++++++- 2 files changed, 149 insertions(+), 3 deletions(-) diff --git a/components/profile/ProfilePinnedRepositories.js b/components/profile/ProfilePinnedRepositories.js index 4db2d9a..b6585d5 100644 --- a/components/profile/ProfilePinnedRepositories.js +++ b/components/profile/ProfilePinnedRepositories.js @@ -45,7 +45,7 @@ const ProfilePinnedRepositories = ({ username, pinnedRepositories }) => { Forks {repo.forks.totalCount}

diff --git a/public/svg/fork.svg b/public/svg/fork.svg index 01511f5..8f1c0d8 100644 --- a/public/svg/fork.svg +++ b/public/svg/fork.svg @@ -1,3 +1,149 @@ - - + + + + +Created by potrace 1.16, written by Peter Selinger 2001-2019 + + + + From 61f592664f78aa91f20a4bf24d38d6ef1fe95b29 Mon Sep 17 00:00:00 2001 From: Christian Franchin dos Santos Date: Wed, 12 Oct 2022 16:27:25 -0300 Subject: [PATCH 4/7] style(ProfilePinnedRepositories): add repository icon --- components/profile/ProfilePinnedRepositories.js | 5 +++++ public/svg/repository.svg | 9 +++++++++ 2 files changed, 14 insertions(+) create mode 100644 public/svg/repository.svg diff --git a/components/profile/ProfilePinnedRepositories.js b/components/profile/ProfilePinnedRepositories.js index b6585d5..ab4cd58 100644 --- a/components/profile/ProfilePinnedRepositories.js +++ b/components/profile/ProfilePinnedRepositories.js @@ -21,6 +21,11 @@ const ProfilePinnedRepositories = ({ username, pinnedRepositories }) => {

+ Repository {repo.name}

diff --git a/public/svg/repository.svg b/public/svg/repository.svg new file mode 100644 index 0000000..bea2675 --- /dev/null +++ b/public/svg/repository.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file From 80548c55aee3e6adae4bb5acb5cd03ede5a3e736 Mon Sep 17 00:00:00 2001 From: Christian Franchin dos Santos Date: Wed, 12 Oct 2022 18:07:41 -0300 Subject: [PATCH 5/7] feat(ProfilePinnedRepositories): show most used language --- .../profile/ProfilePinnedRepositories.js | 57 +++++++++++-------- graphql/Query.js | 8 +++ 2 files changed, 41 insertions(+), 24 deletions(-) diff --git a/components/profile/ProfilePinnedRepositories.js b/components/profile/ProfilePinnedRepositories.js index ab4cd58..008a9db 100644 --- a/components/profile/ProfilePinnedRepositories.js +++ b/components/profile/ProfilePinnedRepositories.js @@ -1,4 +1,3 @@ -import Image from 'next/image'; import Link from 'next/link'; import React from 'react'; @@ -15,7 +14,7 @@ const ProfilePinnedRepositories = ({ username, pinnedRepositories }) => { {')'}

-
+ diff --git a/graphql/Query.js b/graphql/Query.js index 98cb9dc..3a76609 100644 --- a/graphql/Query.js +++ b/graphql/Query.js @@ -77,6 +77,14 @@ export const GET_USER = gql` forks { totalCount } + languages(first: 1, orderBy: {direction: DESC, field: SIZE}) { + nodes { + ... on Language { + name + color + } + } + } } } totalCount From da1e91e8a4a45510743585ae64073585ceedf454 Mon Sep 17 00:00:00 2001 From: Christian Franchin dos Santos Date: Wed, 12 Oct 2022 19:02:16 -0300 Subject: [PATCH 6/7] feat(ProfilePinnedRepositories): make everything work with dark theme --- .../profile/ProfilePinnedRepositories.js | 49 +++--- public/svg/eye.svg | 4 - public/svg/fork.svg | 149 ------------------ public/svg/repository.svg | 9 -- public/svg/star.svg | 3 - 5 files changed, 23 insertions(+), 191 deletions(-) delete mode 100644 public/svg/eye.svg delete mode 100644 public/svg/fork.svg delete mode 100644 public/svg/repository.svg delete mode 100644 public/svg/star.svg diff --git a/components/profile/ProfilePinnedRepositories.js b/components/profile/ProfilePinnedRepositories.js index 008a9db..5e4014e 100644 --- a/components/profile/ProfilePinnedRepositories.js +++ b/components/profile/ProfilePinnedRepositories.js @@ -3,7 +3,7 @@ import React from 'react'; const ProfilePinnedRepositories = ({ username, pinnedRepositories }) => { return ( -
+

{'@'} {username} Pinned Repositories @@ -17,43 +17,40 @@ const ProfilePinnedRepositories = ({ username, pinnedRepositories }) => {
{pinnedRepositories?.nodes.map((repo) => ( - +

- Repository + + + + + + + + {repo.name}

{repo.shortDescriptionHTML}

-

- Stars + + + + { repo.stargazerCount } {' | '} - Watchers + + + + { repo.watchers.totalCount } {' | '} - Forks - {repo.forks.totalCount} -
+ + + + { repo.forks.totalCount } +
{repo.languages?.nodes.map((lang) => (
diff --git a/public/svg/eye.svg b/public/svg/eye.svg deleted file mode 100644 index bf7fe3d..0000000 --- a/public/svg/eye.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/public/svg/fork.svg b/public/svg/fork.svg deleted file mode 100644 index 8f1c0d8..0000000 --- a/public/svg/fork.svg +++ /dev/null @@ -1,149 +0,0 @@ - - - - -Created by potrace 1.16, written by Peter Selinger 2001-2019 - - - - - diff --git a/public/svg/repository.svg b/public/svg/repository.svg deleted file mode 100644 index bea2675..0000000 --- a/public/svg/repository.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/public/svg/star.svg b/public/svg/star.svg deleted file mode 100644 index 1828814..0000000 --- a/public/svg/star.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - From b674900ae2b74123821c058df86155e84d41d451 Mon Sep 17 00:00:00 2001 From: Christian Franchin dos Santos Date: Wed, 12 Oct 2022 19:51:22 -0300 Subject: [PATCH 7/7] fix(ProfilePinnedRepositories): some fixes --- .../profile/ProfilePinnedRepositories.js | 20 +++++++++++-------- graphql/Query.js | 1 + 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/components/profile/ProfilePinnedRepositories.js b/components/profile/ProfilePinnedRepositories.js index 5e4014e..a091ce4 100644 --- a/components/profile/ProfilePinnedRepositories.js +++ b/components/profile/ProfilePinnedRepositories.js @@ -14,11 +14,12 @@ const ProfilePinnedRepositories = ({ username, pinnedRepositories }) => { {')'}

-