Skip to content

Commit

Permalink
Merge pull request #5897 from artsy/staging
Browse files Browse the repository at this point in the history
Deploy
  • Loading branch information
sweir27 authored Jul 9, 2020
2 parents f334564 + 553e784 commit ccb0562
Show file tree
Hide file tree
Showing 45 changed files with 1,327 additions and 558 deletions.
51 changes: 51 additions & 0 deletions data/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ type Artist implements EntityWithFilterArtworksConnectionInterface & Node & Sear
aggregations: [ArtworkAggregation]
artistID: String
artistIDs: [String]
artistSeriesID: String
atAuction: Boolean
attributionClass: [String]
before: String
Expand Down Expand Up @@ -992,6 +993,48 @@ type ArtistSeries {
artists(page: Int, size: Int): [Artist]
description: String
featured: Boolean!
filterArtworksConnection(
acquireable: Boolean
after: String
aggregationPartnerCities: [String]
aggregations: [ArtworkAggregation]
artistID: String
artistIDs: [String]
artistSeriesID: String
atAuction: Boolean
attributionClass: [String]
before: String
color: String
dimensionRange: String
extraAggregationGeneIDs: [String]
first: Int
forSale: Boolean
geneID: String
geneIDs: [String]
height: String
includeArtworksByFollowedArtists: Boolean
includeMediumFilterInAggregation: Boolean
inquireableOnly: Boolean
keyword: String
keywordMatchExact: Boolean
last: Int
majorPeriods: [String]
marketable: Boolean
medium: String
offerable: Boolean
page: Int
partnerCities: [String]
partnerID: ID
period: String
periods: [String]
priceRange: String
saleID: ID
size: Int
sizes: [ArtworkSizes]
sort: String
tagID: String
width: String
): FilterArtworksConnection

# Unique ID for this artist series
internalID: ID!
Expand Down Expand Up @@ -4573,6 +4616,7 @@ interface EntityWithFilterArtworksConnectionInterface {
aggregations: [ArtworkAggregation]
artistID: String
artistIDs: [String]
artistSeriesID: String
atAuction: Boolean
attributionClass: [String]
before: String
Expand Down Expand Up @@ -4713,6 +4757,7 @@ type Fair implements EntityWithFilterArtworksConnectionInterface & Node {
aggregations: [ArtworkAggregation]
artistID: String
artistIDs: [String]
artistSeriesID: String
atAuction: Boolean
attributionClass: [String]
before: String
Expand Down Expand Up @@ -5323,6 +5368,7 @@ type Gene implements Node & Searchable {
aggregations: [ArtworkAggregation]
artistID: String
artistIDs: [String]
artistSeriesID: String
atAuction: Boolean
attributionClass: [String]
before: String
Expand Down Expand Up @@ -5964,6 +6010,7 @@ type MarketingCollection {
aggregations: [ArtworkAggregation]
artistID: String
artistIDs: [String]
artistSeriesID: String
atAuction: Boolean
attributionClass: [String]
before: String
Expand Down Expand Up @@ -7214,6 +7261,7 @@ type Query {
aggregations: [ArtworkAggregation]
artistID: String
artistIDs: [String]
artistSeriesID: String
atAuction: Boolean
attributionClass: [String]
before: String
Expand Down Expand Up @@ -8455,6 +8503,7 @@ type Show implements EntityWithFilterArtworksConnectionInterface & Node {
aggregations: [ArtworkAggregation]
artistID: String
artistIDs: [String]
artistSeriesID: String
atAuction: Boolean
attributionClass: [String]
before: String
Expand Down Expand Up @@ -8835,6 +8884,7 @@ type Tag implements Node {
aggregations: [ArtworkAggregation]
artistID: String
artistIDs: [String]
artistSeriesID: String
atAuction: Boolean
attributionClass: [String]
before: String
Expand Down Expand Up @@ -9219,6 +9269,7 @@ type Viewer {
aggregations: [ArtworkAggregation]
artistID: String
artistIDs: [String]
artistSeriesID: String
atAuction: Boolean
attributionClass: [String]
before: String
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@artsy/cohesion": "1.19.0",
"@artsy/express-reloadable": "1.4.8",
"@artsy/gemup": "0.0.3",
"@artsy/palette": "11.6.0",
"@artsy/palette": "11.7.0",
"@artsy/passport": "1.3.0",
"@artsy/reaction": "26.53.0",
"@artsy/stitch": "6.1.6",
Expand Down Expand Up @@ -135,6 +135,7 @@
"fastclick": "1.0.6",
"flickity": "2.1.2",
"flickity-imagesloaded": "2.0.0",
"focus-visible": "5.1.0",
"forever": "0.15.3",
"found": "0.4.9",
"found-relay": "0.5.0",
Expand Down Expand Up @@ -194,6 +195,7 @@
"react": "16.8.6",
"react-autosuggest": "9.4.3",
"react-dom": "16.8.6",
"react-linkify": "1.0.0-alpha",
"react-redux": "5.1.1",
"react-relay": "7.1.0",
"react-relay-network-modern": "2.5.1",
Expand Down
7 changes: 2 additions & 5 deletions src/desktop/apps/categories/__tests__/routes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ describe("#index", () => {
beforeEach(() => {
req = {
app: {
get: sinon
.stub()
.withArgs("views")
.returns("components"),
get: sinon.stub().withArgs("views").returns("components"),
},
}
res = {}
Expand Down Expand Up @@ -46,7 +43,7 @@ describe("#index", () => {
}

rewire.__set__(
"metaphysics",
"metaphysics2",
sinon.stub().returns(Promise.resolve(geneFamiliesQuery))
)

Expand Down
27 changes: 0 additions & 27 deletions src/desktop/apps/categories/__tests__/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,6 @@ describe("#alphabetizeGenes", () => {
})
})

describe("#featuredGenesForFamily", () => {
it("pulls out featured genes for the given family", () => {
const featuredGenesByFamily = [
{
name: "Materials",
genes: [
{ id: "aluminum", href: "/gene/aluminum" },
{ id: "gold", href: "/gene/gold" },
],
},
{
name: "Styles",
genes: [
{ id: "impressionism", href: "/gene/impressionism" },
{ id: "photorealism", href: "/gene/photorealism" },
],
},
]

const result = featuredGenesForFamily("Materials", featuredGenesByFamily)
result.should.be.of.type.Object
result.name.should.equal("Materials")
result.genes[0].id.should.equal("aluminum")
result.genes[1].id.should.equal("gold")
})
})

describe("#geneFamiliesFromConnection", () => {
it("maps the connection to a simple list of gene families", () => {
const dataFromGeneFamilyConnection = {
Expand Down
6 changes: 1 addition & 5 deletions src/desktop/apps/categories/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,14 @@ const Layout = styled.div`
class App extends Component {
static propTypes = {
geneFamilies: PropTypes.array.isRequired,
allFeaturedGenesByFamily: PropTypes.array.isRequired,
}

render() {
const { geneFamilies, allFeaturedGenesByFamily } = this.props
return (
<Layout>
<GeneFamilyNav geneFamilies={geneFamilies} />
<TAGPContent
geneFamilies={geneFamilies}
allFeaturedGenesByFamily={allFeaturedGenesByFamily}
/>
<TAGPContent geneFamilies={geneFamilies} />
</Layout>
)
}
Expand Down
12 changes: 6 additions & 6 deletions src/desktop/apps/categories/components/FeaturedGenes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import styled from "styled-components"
import FeaturedGene from "./FeaturedGene"

const propTypes = {
featuredGenes: PropTypes.object,
featuredGeneLinks: PropTypes.array,
}

const Layout = styled.div`
Expand All @@ -19,14 +19,14 @@ const Layout = styled.div`
}
`

const FeaturedGenes = ({ featuredGenes }) => {
const FeaturedGenes = ({ featuredGeneLinks }) => {
return (
<Layout>
{featuredGenes &&
featuredGenes.genes.length > 0 &&
featuredGenes.genes
{featuredGeneLinks &&
featuredGeneLinks.length > 0 &&
featuredGeneLinks
.map(featuredGene => (
<FeaturedGene key={featuredGene.id} {...featuredGene} />
<FeaturedGene key={featuredGene.href} {...featuredGene} />
))
.slice(0, 3)}
</Layout>
Expand Down
15 changes: 2 additions & 13 deletions src/desktop/apps/categories/components/GeneFamilies.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,13 @@ import { featuredGenesForFamily } from "../utils.js"

const propTypes = {
geneFamilies: PropTypes.array.isRequired,
allFeaturedGenesByFamily: PropTypes.array.isRequired,
}

const GeneFamilies = ({ geneFamilies, allFeaturedGenesByFamily }) => {
const GeneFamilies = ({ geneFamilies }) => {
return (
<div>
{geneFamilies.map(geneFamily => {
const featuredGenes = featuredGenesForFamily(
geneFamily.name,
allFeaturedGenesByFamily
)
return (
<GeneFamily
key={geneFamily.id}
featuredGenes={featuredGenes}
{...geneFamily}
/>
)
return <GeneFamily key={geneFamily.id} {...geneFamily} />
})}
</div>
)
Expand Down
12 changes: 7 additions & 5 deletions src/desktop/apps/categories/components/GeneFamily.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const propTypes = {
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
genes: PropTypes.array.isRequired,
featuredGenes: PropTypes.object,
featuredGeneLinks: PropTypes.array,
}

const GeneFamilyName = styled.h2`
Expand All @@ -29,15 +29,17 @@ const GeneList = styled.ul`
}
`

const GeneFamily = ({ id, name, genes, featuredGenes }) => {
const GeneFamily = ({ slug, name, genes, featuredGeneLinks }) => {
const publishedGenes = genes.filter(g => g.is_published)
const sortedGenes = alphabetizeGenes(publishedGenes)
return (
<div id={id}>
<div id={slug}>
<GeneFamilyName>{name}</GeneFamilyName>
<FeaturedGenes featuredGenes={featuredGenes} />
<FeaturedGenes featuredGeneLinks={featuredGeneLinks} />
<GeneList>
{sortedGenes.map(gene => <Gene key={gene.id} {...gene} />)}
{sortedGenes.map(gene => (
<Gene key={gene.id} {...gene} />
))}
</GeneList>
</div>
)
Expand Down
4 changes: 2 additions & 2 deletions src/desktop/apps/categories/components/GeneFamilyNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ class GeneFamilyNav extends React.Component {
offset={-1 * TOP_BUFFER}
>
{geneFamilies.map(geneFamily => (
<GeneFamilyItem key={geneFamily.id}>
<GeneFamilyItem key={geneFamily.slug}>
<GeneFamilyLink
href={`#${geneFamily.id}`}
href={`#${geneFamily.slug}`}
onClick={this.handleClick}
>
{geneFamily.name}
Expand Down
6 changes: 1 addition & 5 deletions src/desktop/apps/categories/components/TAGPContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import GeneFamilies from "./GeneFamilies"

const propTypes = {
geneFamilies: PropTypes.array.isRequired,
allFeaturedGenesByFamily: PropTypes.array.isRequired,
}

const ResponsiveContent = styled.main`
Expand All @@ -22,10 +21,7 @@ const TAGPContent = ({ geneFamilies, allFeaturedGenesByFamily }) => {
return (
<ResponsiveContent>
<TAGPIntro />
<GeneFamilies
geneFamilies={geneFamilies}
allFeaturedGenesByFamily={allFeaturedGenesByFamily}
/>
<GeneFamilies geneFamilies={geneFamilies} />
</ResponsiveContent>
)
}
Expand Down
25 changes: 5 additions & 20 deletions src/desktop/apps/categories/components/__tests__/App.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import App from "../App"
describe("Categories App", () => {
let app
let geneFamilies
let allFeaturedGenesByFamily

beforeEach(() => {
geneFamilies = [
Expand All @@ -15,37 +14,23 @@ describe("Categories App", () => {
genes: [
/* … */
],
},
{
id: "styles",
name: "Styles",
genes: [
featuredGeneLinks: [
/* … */
],
},
]

allFeaturedGenesByFamily = [
{
name: "Materials",
id: "styles",
name: "Styles",
genes: [
/* … */
],
},
{
name: "Styles",
genes: [
featuredGeneLinks: [
/* … */
],
},
]

app = shallow(
<App
geneFamilies={geneFamilies}
allFeaturedGenesByFamily={allFeaturedGenesByFamily}
/>
)
app = shallow(<App geneFamilies={geneFamilies} />)
})

it("renders navigation", () => {
Expand Down
Loading

0 comments on commit ccb0562

Please sign in to comment.