Skip to content

Commit

Permalink
fix: update contact gallery for private artwork to match spec (#10174)
Browse files Browse the repository at this point in the history
  • Loading branch information
brainbicycle committed Apr 29, 2024
1 parent 500e262 commit 0ce3886
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/app/Scenes/Artwork/Artwork.tsx
Expand Up @@ -367,7 +367,7 @@ export const Artwork: React.FC<ArtworkProps> = (props) => {
element: (
<PartnerCard
artwork={artworkBelowTheFold}
onlyShowQuestions={
showShortContactGallery={
!!artworkAboveTheFold?.isUnlisted && !!artworkBelowTheFold.partner?.isInquireable
}
/>
Expand Down Expand Up @@ -455,7 +455,7 @@ export const Artwork: React.FC<ArtworkProps> = (props) => {
<PartnerCard
shouldShowQuestions={!!artworkBelowTheFold.partner?.isInquireable}
artwork={artworkBelowTheFold}
onlyShowQuestions={
showShortContactGallery={
!!artworkAboveTheFold?.isUnlisted && !!artworkBelowTheFold.partner?.isInquireable
}
/>
Expand Down
18 changes: 14 additions & 4 deletions src/app/Scenes/Artwork/Components/PartnerCard.tsx
@@ -1,5 +1,6 @@
import { Spacer, Flex, Text, EntityHeader } from "@artsy/palette-mobile"
import { PartnerCard_artwork$data } from "__generated__/PartnerCard_artwork.graphql"
import { ShortContactGallery } from "app/Scenes/Artwork/Components/ShortContactGallery"
import { navigateToPartner } from "app/system/navigation/navigate"
import { limitWithCount } from "app/utils/limitWithCount"
import { compact } from "lodash"
Expand All @@ -12,13 +13,13 @@ interface PartnerCardProps {
artwork: PartnerCard_artwork$data
relay: RelayProp
shouldShowQuestions?: boolean
onlyShowQuestions?: boolean
showShortContactGallery?: boolean
}

export const PartnerCard: React.FC<PartnerCardProps> = ({
artwork,
shouldShowQuestions,
onlyShowQuestions,
showShortContactGallery,
}) => {
const handleTap = (href: string) => navigateToPartner(href)

Expand Down Expand Up @@ -48,8 +49,16 @@ export const PartnerCard: React.FC<PartnerCardProps> = ({

const partnerTypeDisplayText = partner.type === "Gallery" ? partner.type : "Institution"

if (onlyShowQuestions) {
return <Questions artwork={artwork} />
if (showShortContactGallery) {
return (
<ShortContactGallery
artwork={artwork}
showPartnerType={showPartnerType}
partnerName={partner.name}
partnerHref={partner.href ?? undefined}
locationNames={locationNames}
/>
)
}

return (
Expand Down Expand Up @@ -84,6 +93,7 @@ export const PartnerCardFragmentContainer = createFragmentContainer(PartnerCard,
artwork: graphql`
fragment PartnerCard_artwork on Artwork {
...Questions_artwork
...ShortContactGallery_artwork
sale {
isBenefit
isGalleryAuction
Expand Down
48 changes: 48 additions & 0 deletions src/app/Scenes/Artwork/Components/ShortContactGallery.tsx
@@ -0,0 +1,48 @@
import { EntityHeader, EnvelopeIcon, Flex } from "@artsy/palette-mobile"
import { ShortContactGallery_artwork$key } from "__generated__/ShortContactGallery_artwork.graphql"
import { navigateToPartner } from "app/system/navigation/navigate"
import { TouchableWithoutFeedback } from "react-native"
import { graphql, useFragment } from "react-relay"
import { InquiryButtonsFragmentContainer } from "./CommercialButtons/InquiryButtons"

interface ShortContactGalleryProps {
artwork: ShortContactGallery_artwork$key
partnerHref?: string
partnerName?: string | null
locationNames?: string | null
showPartnerType?: boolean
}

export const ShortContactGallery: React.FC<ShortContactGalleryProps> = (props) => {
const artworkData = useFragment(artworkFragment, props.artwork)

return (
<Flex flexDirection="row" flexWrap="wrap" justifyContent="space-between" alignItems="center">
<TouchableWithoutFeedback
onPress={() => {
if (props.partnerHref) {
navigateToPartner(props.partnerHref)
}
}}
>
<EntityHeader
name={props.partnerName ?? ""}
meta={props.locationNames ?? ""}
style={{ flex: 1 }}
/>
</TouchableWithoutFeedback>
<InquiryButtonsFragmentContainer
artwork={artworkData}
variant="outline"
size="small"
icon={<EnvelopeIcon fill="black100" width="16px" height="16px" />}
/>
</Flex>
)
}

const artworkFragment = graphql`
fragment ShortContactGallery_artwork on Artwork {
...InquiryButtons_artwork
}
`

0 comments on commit 0ce3886

Please sign in to comment.