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"
},
"category": ["pipeline", "standalone", "research", "training"],
"tags": []
"tags": [],
"spacy_version": 3
},
{
"id": "numerizer",

View File

@ -8,10 +8,11 @@ import Title from '../components/title'
import Grid from '../components/grid'
import Button from '../components/button'
import Icon from '../components/icon'
import Tag from '../components/tag'
import CodeBlock, { InlineCode } from '../components/code'
import Aside from '../components/aside'
import Sidebar from '../components/sidebar'
import Section from '../components/section'
import Section, { Hr } from '../components/section'
import Main from '../components/main'
import Footer from '../components/footer'
import { H3, H5, Label, InlineList } from '../components/typography'
@ -121,6 +122,18 @@ const UniverseContent = ({ content = [], categories, theme, pageContext, mdxComp
</Grid>
</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">
<H3>Submit your project</H3>
<p>
@ -168,25 +181,41 @@ UniverseContent.propTypes = {
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 }) => (
<>
<Title title={data.title || data.id} teaser={data.slogan} image={data.thumb}>
{data.github && (
{(data.github || data.spacy_version) && (
<p>
<Link to={`https://github.com/${data.github}`} hidden>
{[
`release/${data.github}/all.svg?style=flat-square`,
`license/${data.github}.svg?style=flat-square`,
`stars/${data.github}.svg?style=social&label=Stars`,
].map((url, i) => (
<img
style={{ borderRadius: '1em', marginRight: '0.5rem' }}
key={i}
src={`https://img.shields.io/github/${url}`}
alt=""
/>
))}
</Link>
{data.spacy_version && <SpaCyVersion version={data.spacy_version} />}
{data.github && (
<Link to={`https://github.com/${data.github}`} hidden>
{[
`release/${data.github}/all.svg?style=flat-square`,
`license/${data.github}.svg?style=flat-square`,
`stars/${data.github}.svg?style=social&label=Stars`,
].map((url, i) => (
<img
style={{
borderRadius: '1em',
marginRight: '0.5rem',
verticalAlign: 'middle',
}}
key={i}
src={`https://img.shields.io/github/${url}`}
alt=""
/>
))}
</Link>
)}
</p>
)}
</Title>
@ -335,6 +364,7 @@ const query = graphql`
url
github
description
spacy_version
pip
cran
category