Skip to content

Commit

Permalink
fix(ONYX-273): refactor and add isInAuction for header create alert c…
Browse files Browse the repository at this point in the history
…ta (#9266)

* fix(ONYX-273): refactor and add isInAuction for header create alert cta

* fix(ONYX-273): check hasArtists separately
  • Loading branch information
tam-kis authored and brainbicycle committed Sep 15, 2023
1 parent 88f0358 commit 215e759
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ export const ArtworkScreenHeaderCreateAlert: React.FC<ArtworkScreenHeaderCreateA
artworkRef
)
const [showCreateArtworkAlertModal, setShowCreateArtworkAlertModal] = useState(false)
const { isForSale, sale, saleArtwork } = artwork
const { isForSale, sale, saleArtwork, isInAuction } = artwork
const hasArtists = !!artwork?.artists?.length

const isLotClosedOrBiddingEnded =
hasBiddingEnded(sale, saleArtwork) || isLotClosed(sale, saleArtwork)
const enableAuctionHeaderAlertCTA = useFeatureFlag("AREnableAuctionHeaderAlertCTA")

if (!hasArtists || (isLotClosedOrBiddingEnded && enableAuctionHeaderAlertCTA)) {
const displayCreateAlertHeader =
isInAuction && isLotClosedOrBiddingEnded && enableAuctionHeaderAlertCTA

if (!!displayCreateAlertHeader || !hasArtists) {
return null
}

Expand All @@ -53,6 +56,7 @@ export const ArtworkScreenHeaderCreateAlert: React.FC<ArtworkScreenHeaderCreateA

const ArtworkScreenHeaderCreateAlert_artwork = graphql`
fragment ArtworkScreenHeaderCreateAlert_artwork on Artwork {
isInAuction
...CreateArtworkAlertModal_artwork
artists {
internalID
Expand Down

0 comments on commit 215e759

Please sign in to comment.