From e4f06638f95152afd4c14012307392a069009eef Mon Sep 17 00:00:00 2001 From: Your Name~ Date: Tue, 25 Oct 2022 16:50:46 +0545 Subject: [PATCH] Hide project section if no public github repo available for user --- src/components/GitProfile.jsx | 7 ++++++- src/components/project/index.jsx | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/GitProfile.jsx b/src/components/GitProfile.jsx index cf5acc5..c781e85 100644 --- a/src/components/GitProfile.jsx +++ b/src/components/GitProfile.jsx @@ -66,9 +66,14 @@ const GitProfile = ({ config }) => { }; setProfile(profileData); + return data; }) - .then(() => { + .then((userData) => { let excludeRepo = ``; + if (userData.public_repos === 0) { + setRepo([]); + return; + } sanitizedConfig.github.exclude.projects.forEach((project) => { excludeRepo += `+-repo:${sanitizedConfig.github.username}/${project}`; diff --git a/src/components/project/index.jsx b/src/components/project/index.jsx index 1a8b5ee..06d204e 100644 --- a/src/components/project/index.jsx +++ b/src/components/project/index.jsx @@ -4,6 +4,10 @@ import PropTypes from 'prop-types'; import { ga, languageColor, skeleton } from '../../helpers/utils'; const Project = ({ repo, loading, github, googleAnalytics }) => { + if (!loading && Array.isArray(repo) && repo.length === 0) { + return <>; + } + const renderSkeleton = () => { let array = []; for (let index = 0; index < github.limit; index++) {