1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

output additional links on all repos

This commit is contained in:
Matthias Kretschmann 2018-11-20 15:36:43 +01:00
parent 208b9c1978
commit 7f896375f3
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -44,6 +44,20 @@ const queryGithub = graphql`
} }
} }
} }
allRepositoriesYaml {
edges {
node {
items {
name
links {
name
url
}
}
}
}
}
} }
` `
@ -129,6 +143,7 @@ const Repository = ({ name, links, readme }) => (
render={data => { render={data => {
const repositoriesGitHub = const repositoriesGitHub =
data.github.organization.repositories.edges data.github.organization.repositories.edges
const repositoriesYaml = data.allRepositoriesYaml.edges
// just iterate over all repos until we have a name match, // just iterate over all repos until we have a name match,
// then return that repo, and then filter out all empty nodes // then return that repo, and then filter out all empty nodes
@ -153,6 +168,20 @@ const Repository = ({ name, links, readme }) => (
object object
} = repo } = repo
// enhance passed links array with what's in repositories.yml,
// iterating over all repos until we have a name match
const linksFilteredArray = repositoriesYaml.map(({ node }) => {
return node.items
.map(item => {
if (item.name === name) {
return item.links
}
})
.filter(n => n)[0]
})
const moreLinks = links || linksFilteredArray[0]
return ( return (
<article className={styles.repository}> <article className={styles.repository}>
<Title name={name} releases={releases} url={url} /> <Title name={name} releases={releases} url={url} />
@ -160,7 +189,7 @@ const Repository = ({ name, links, readme }) => (
<p>{!description ? '...' : description}</p> <p>{!description ? '...' : description}</p>
<footer className={styles.repositoryMeta}> <footer className={styles.repositoryMeta}>
<Links links={links} url={url} /> <Links links={moreLinks} url={url} />
<Numbers <Numbers
stargazers={stargazers} stargazers={stargazers}
forkCount={forkCount} forkCount={forkCount}