Skip to content

Commit

Permalink
Add more data avoid anyone is null
Browse files Browse the repository at this point in the history
  • Loading branch information
vn7n24fzkq committed Aug 24, 2020
1 parent 179b35d commit f798244
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,35 @@ const createProfileDetailsCard = async function (username) {
2
)} public repos`,
},
{ index: 2, icon: Icons.EMAIL, name: "Email", value: userDetails["email"] },
{
index: 3,
index: 2,
icon: Icons.CLOCK,
name: "JoinedAt",
value: `Joined GitHub ${moment(userDetails["joinedAt"]).fromNow()}`,
},
];
if (userDetails["email"] != "") {
details.push({
index: 3,
icon: Icons.EMAIL,
name: "Email",
value: userDetails["email"],
});
}else if (userDetails["company"] != "") {
details.push({
index: 3,
icon: Icons.COMPANY,
name: "Company",
value: userDetails["company"],
});
}else if(userDetails["location"] != "") {
details.push({
index: 3,
icon: Icons.LOCATION,
name: "Location",
value: userDetails["location"],
});
}

let contributionsData = userDetails.contributions;

Expand Down
2 changes: 2 additions & 0 deletions src/const/icon.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/github-api/profile-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const fetcher = (token, variables) => {
email
createdAt
twitterUsername
company
location
websiteUrl
repositories(privacy:PUBLIC){
totalCount
}
Expand Down Expand Up @@ -77,6 +80,9 @@ async function getProfileDetails(username) {
result.totalContributions =
user.contributionsCollection.contributionCalendar.totalContributions;
result.totalPublicRepos = user.repositories.totalCount;
result.websiteUrl = user.websiteUrl;
result.company = user.company;
result.location = user.location;

//contributions into array
for (let week of user.contributionsCollection.contributionCalendar.weeks) {
Expand Down

0 comments on commit f798244

Please sign in to comment.