Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion src/Apps/Artwork/ArtworkApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ import { ArtworkAuctionCreateAlertHeaderFragmentContainer } from "Apps/Artwork/C
import { compact } from "lodash"
import { AlertProvider } from "Components/Alert/AlertProvider"
import { FullBleedBanner } from "Components/FullBleedBanner"
import { extractNodes } from "Utils/extractNodes"
import { useFeatureFlag } from "System/useFeatureFlag"

export interface Props {
artwork: ArtworkApp_artwork$data
Expand Down Expand Up @@ -300,7 +302,14 @@ export const ArtworkApp: React.FC<Props> = props => {

const WrappedArtworkApp: React.FC<Props> = props => {
const {
artwork: { artists, attributionClass, internalID, mediumType, sale },
artwork: {
artists,
artistSeriesConnection,
attributionClass,
internalID,
mediumType,
sale,
},
} = props

const {
Expand All @@ -314,6 +323,10 @@ const WrappedArtworkApp: React.FC<Props> = props => {
const referrer = state && state.previousHref
const { isComplete } = useRouteComplete()

const isArtistSeriesFilterEnabled = useFeatureFlag(
"onyx_enable-artist-series-filter"
)

const websocketEnabled = !!sale?.extendedBiddingIntervalMinutes

const initialAlertCriteria = {
Expand All @@ -322,6 +335,13 @@ const WrappedArtworkApp: React.FC<Props> = props => {
additionalGeneIDs: compact([mediumType?.filterGene?.slug as string]),
}

if (isArtistSeriesFilterEnabled) {
const artistSeriesSlugs = compact(
extractNodes(artistSeriesConnection).map(node => node.slug)
)
initialAlertCriteria["artistSeriesIDs"] = artistSeriesSlugs
}

return (
<Analytics contextPageOwnerId={internalID}>
<WebsocketContextProvider
Expand Down Expand Up @@ -358,6 +378,13 @@ export const ArtworkAppFragmentContainer = createFragmentContainer(
attributionClass {
internalID
}
artistSeriesConnection(first: 5) {
edges {
node {
slug
}
}
}
slug
internalID
is_acquireable: isAcquireable
Expand Down
6 changes: 6 additions & 0 deletions src/Components/Alert/Hooks/__tests__/AlertProvider.jest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ describe("AlertProvider", () => {
field: "artistIDs",
value: "artist-id",
},
{
displayValue: "Soup Cans",
field: "artistSeriesID",
value: "artist-series-id",
},
],
},
}),
Expand All @@ -106,6 +111,7 @@ describe("AlertProvider", () => {

expect(screen.getByText("Add Filters:")).toBeInTheDocument()
expect(screen.getByText("Andy Warhol")).toBeInTheDocument()
expect(screen.getByText("Soup Cans")).toBeInTheDocument()

// transition to filters step
screen.getByTestId("addFilters").click()
Expand Down
66 changes: 56 additions & 10 deletions src/__generated__/ArtworkApp_artwork.graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading