From 6eaf7619b90dbf3d6badccccc43405da89fb629d Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Sat, 10 Nov 2018 19:27:27 +0100 Subject: [PATCH] documentation and cleanup --- README.md | 24 +++++++++++++++++++ src/components/Repositories/Repository.jsx | 15 ++++++------ .../Repositories/RepositoryList.jsx | 2 -- src/components/Repositories/index.jsx | 20 ---------------- 4 files changed, 32 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 60498f95..650c8021 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,30 @@ vi .env.development # GITHUB_TOKEN=ADD-YOUR-TOKEN-HERE ``` +When running the site locally, you can use the GraphiQL client running under [localhost:8000/\_\_\_graphql](http://localhost:8000/___graphql). + +screen shot 2018-11-10 at 18 41 45 + +This query should get you started to explore what information you can get: + +```graphql +query { + github { + organization(login: "oceanprotocol") { + repositories(first: 100) { + edges { + node { + name + description + url + } + } + } + } + } +} +``` + ## Authors - Troy McConaghy ([@ttmc](https://github.com/ttmc)) - [Ocean Protocol](https://oceanprotocol.com) diff --git a/src/components/Repositories/Repository.jsx b/src/components/Repositories/Repository.jsx index bca74dc5..87647574 100644 --- a/src/components/Repositories/Repository.jsx +++ b/src/components/Repositories/Repository.jsx @@ -7,7 +7,7 @@ const queryGithub = graphql` query GitHubReposInfo { github { organization(login: "oceanprotocol") { - repositories(first: 100) { + repositories(first: 100, isFork: false) { edges { node { name @@ -29,24 +29,25 @@ const Repository = ({ name, links }) => ( data.github.organization.repositories.edges // just iterate over all repos until we have a name match, - // then return that repo - const repoFilteredArray = repositoriesGitHub + // then return that repo, and then filter out all empty nodes + let repoFilteredArray = repositoriesGitHub .map(({ node }) => { if (node.name === name) return node }) - .filter(el => el != null) + .filter(n => n) - const repo = Object.assign(...repoFilteredArray) + const repo = repoFilteredArray[0] + const { url, description } = repo return (

{name}

-

{!repo ? '...' : repo.description}

+

{!description ? '...' : description}