From 151f0f0874bca1767c3bf222c268f6993680f9fc Mon Sep 17 00:00:00 2001 From: "MD. Ariful Alam" Date: Wed, 25 Aug 2021 19:57:15 +0600 Subject: [PATCH] Constructor search query --- src/App.js | 68 ++++++++++++++++++++++++--------------- src/components/Project.js | 24 ++++++++------ src/config.js | 13 +++++++- 3 files changed, 68 insertions(+), 37 deletions(-) diff --git a/src/App.js b/src/App.js index b555309..d0e8346 100644 --- a/src/App.js +++ b/src/App.js @@ -30,7 +30,7 @@ function App() { }, [theme]) const loadData = useCallback(() => { - axios.get(`https://api.github.com/users/${config.githubUsername}`) + axios.get(`https://api.github.com/users/${config.github.username}`) .then(response => { let data = response.data; @@ -45,7 +45,21 @@ function App() { dispatch(setProfile(profileData)); }) .then(() => { - axios.get(`https://api.github.com/search/repositories?q=user:${config.githubUsername}+&s=stars&type=Repositories`) + let excludeRepo = ``; + + config.github.exclude.projects.forEach(project => { + excludeRepo += `+-repo:${config.github.username}/${project}`; + }); + + let query = `user:${config.github.username}+fork:${!config.github.exclude.forks}${excludeRepo}`; + + let url = `https://api.github.com/search/repositories?q=${query}&sort=${config.github.sortBy}&per_page=${config.github.limit}&type=Repositories`; + + axios.get(url, { + headers: { + 'Content-Type': 'application/vnd.github.v3+json' + } + }) .then(response => { let data = response.data; @@ -129,36 +143,38 @@ function App() { } /> ) : ( -
-
-
-
- { - !config.themeConfig.disableSwitch && ( - - ) - } - -
- - - + +
+
+
+
+ { + !config.themeConfig.disableSwitch && ( + + ) + } + +
+ + + +
-
-
-
- - +
+
+ + +
-
+ {/* DO NOT REMOVE/MODIFY THE FOOTER */} +
+

Made with ezprofile and ❤️

+
+
) } - {/* DO NOT REMOVE/MODIFY THE FOOTER */} -
-

Made with ezprofile and ❤️

-
); diff --git a/src/components/Project.js b/src/components/Project.js index 42799db..a74f74e 100644 --- a/src/components/Project.js +++ b/src/components/Project.js @@ -1,18 +1,16 @@ import { Fragment } from "react"; import { useSelector } from "react-redux"; import { languageColor, skeleton } from "../helpers/utils"; -import { AiFillStar, AiOutlineFork } from 'react-icons/ai'; +import { AiOutlineStar, AiOutlineFork } from 'react-icons/ai'; import config from "../config"; -const LIMIT = 8; - const Project = () => { const loading = useSelector(state => state.loading); const repo = useSelector(state => state.repo); const renderSkeleton = () => { let array = []; - for (let index = 0; index < LIMIT; index++) { + for (let index = 0; index < config.github.limit; index++) { array.push((
@@ -53,8 +51,14 @@ const Project = () => { } const renderProjects = () => { - return repo.slice(0, LIMIT).map((item, index) => ( - + return repo.map((item, index) => ( +