Skip to content

Commit 49a3532

Browse files
committed
feat: allow hiding of collector signals "primary label"
1 parent cc05585 commit 49a3532

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/Components/Artwork/Details/Details.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface DetailsProps {
2323
hideSaleInfo?: boolean
2424
hideArtistName?: boolean
2525
hidePartnerName?: boolean
26+
hidePrimaryLabel?: boolean
2627
isHovered?: boolean
2728
showHighDemandIcon?: boolean
2829
showHoverDetails?: boolean
@@ -232,6 +233,7 @@ export const Details: React.FC<React.PropsWithChildren<DetailsProps>> = ({
232233
contextModule,
233234
hideArtistName,
234235
hidePartnerName,
236+
hidePrimaryLabel,
235237
hideSaleInfo,
236238
isHovered,
237239
showHighDemandIcon = false,
@@ -254,7 +256,7 @@ export const Details: React.FC<React.PropsWithChildren<DetailsProps>> = ({
254256
const artworkId = rest?.artwork?.internalID
255257

256258
const primaryLabel = rest?.artwork?.collectorSignals?.primaryLabel
257-
const showPrimaryLabelLine: boolean = !isAuction
259+
const showPrimaryLabelLine = !hidePrimaryLabel && !isAuction
258260

259261
// FIXME: Extract into a real component
260262
const renderSaveButtonComponent = () => {

src/Components/Artwork/Details/__tests__/Details.jest.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,32 @@ describe("Details", () => {
466466
).toBeInTheDocument()
467467
expect(screen.getByText("SaleMessageQueryRenderer")).toBeInTheDocument()
468468
})
469+
470+
it("does not render the primary label if hidePrimaryLabel is true", () => {
471+
const { renderWithRelay } = setupTestWrapperTL<Details_Test_Query>({
472+
Component: ({ artwork }) => (
473+
<ArtworkGridContextProvider isAuctionArtwork={false}>
474+
<DetailsFragmentContainer
475+
artwork={artwork!}
476+
includeLinks
477+
hidePrimaryLabel
478+
/>
479+
</ArtworkGridContextProvider>
480+
),
481+
query,
482+
})
483+
484+
renderWithRelay({
485+
Artwork: () => ({
486+
...artworkNotInAuction,
487+
collectorSignals: { primaryLabel: "PARTNER_OFFER" },
488+
}),
489+
})
490+
491+
expect(
492+
screen.queryByText("PrimaryLabelLineQueryRenderer"),
493+
).not.toBeInTheDocument()
494+
})
469495
})
470496

471497
describe("in auction", () => {

0 commit comments

Comments
 (0)