Support version tags in universe and add note about reporting (#10093)

* Support version tags in universe and add note about reporting

* Apply suggestions from code review

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
This commit is contained in:
Ines Montani 2022-01-20 23:21:26 +01:00 committed by GitHub
parent a69005037a
commit 34ed93ef68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 17 deletions

View File

@ -141,7 +141,8 @@
"website": "https://www.nr.no/~plison" "website": "https://www.nr.no/~plison"
}, },
"category": ["pipeline", "standalone", "research", "training"], "category": ["pipeline", "standalone", "research", "training"],
"tags": [] "tags": [],
"spacy_version": 3
}, },
{ {
"id": "numerizer", "id": "numerizer",

View File

@ -8,10 +8,11 @@ import Title from '../components/title'
import Grid from '../components/grid' import Grid from '../components/grid'
import Button from '../components/button' import Button from '../components/button'
import Icon from '../components/icon' import Icon from '../components/icon'
import Tag from '../components/tag'
import CodeBlock, { InlineCode } from '../components/code' import CodeBlock, { InlineCode } from '../components/code'
import Aside from '../components/aside' import Aside from '../components/aside'
import Sidebar from '../components/sidebar' import Sidebar from '../components/sidebar'
import Section from '../components/section' import Section, { Hr } from '../components/section'
import Main from '../components/main' import Main from '../components/main'
import Footer from '../components/footer' import Footer from '../components/footer'
import { H3, H5, Label, InlineList } from '../components/typography' import { H3, H5, Label, InlineList } from '../components/typography'
@ -121,6 +122,18 @@ const UniverseContent = ({ content = [], categories, theme, pageContext, mdxComp
</Grid> </Grid>
</Section> </Section>
)} )}
<section className="search-exclude">
<H3>Found a mistake or something isn't working?</H3>
<p>
If you've come across a universe project that isn't working or is
incompatible with the reported spaCy version, let us know by{' '}
<Link to="https://github.com/explosion/spaCy/discussions/new">
opening a discussion thread
</Link>
.
</p>
</section>
<Hr />
<section className="search-exclude"> <section className="search-exclude">
<H3>Submit your project</H3> <H3>Submit your project</H3>
<p> <p>
@ -168,25 +181,41 @@ UniverseContent.propTypes = {
mdxComponents: PropTypes.object, mdxComponents: PropTypes.object,
} }
const SpaCyVersion = ({ version }) => {
const versions = !Array.isArray(version) ? [version] : version
return versions.map((v, i) => (
<>
<Tag tooltip={`This project is compatible with spaCy v${v}`}>spaCy v{v}</Tag>{' '}
</>
))
}
const Project = ({ data, components }) => ( const Project = ({ data, components }) => (
<> <>
<Title title={data.title || data.id} teaser={data.slogan} image={data.thumb}> <Title title={data.title || data.id} teaser={data.slogan} image={data.thumb}>
{data.github && ( {(data.github || data.spacy_version) && (
<p> <p>
<Link to={`https://github.com/${data.github}`} hidden> {data.spacy_version && <SpaCyVersion version={data.spacy_version} />}
{[ {data.github && (
`release/${data.github}/all.svg?style=flat-square`, <Link to={`https://github.com/${data.github}`} hidden>
`license/${data.github}.svg?style=flat-square`, {[
`stars/${data.github}.svg?style=social&label=Stars`, `release/${data.github}/all.svg?style=flat-square`,
].map((url, i) => ( `license/${data.github}.svg?style=flat-square`,
<img `stars/${data.github}.svg?style=social&label=Stars`,
style={{ borderRadius: '1em', marginRight: '0.5rem' }} ].map((url, i) => (
key={i} <img
src={`https://img.shields.io/github/${url}`} style={{
alt="" borderRadius: '1em',
/> marginRight: '0.5rem',
))} verticalAlign: 'middle',
</Link> }}
key={i}
src={`https://img.shields.io/github/${url}`}
alt=""
/>
))}
</Link>
)}
</p> </p>
)} )}
</Title> </Title>
@ -335,6 +364,7 @@ const query = graphql`
url url
github github
description description
spacy_version
pip pip
cran cran
category category