Skip to content

Commit

Permalink
remove expired partner offers ff (#15052)
Browse files Browse the repository at this point in the history
  • Loading branch information
leamotta authored Jan 3, 2025
1 parent 4115d48 commit dfdda0e
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions src/Apps/Artwork/Components/ArtworkPageBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Text } from "@artsy/palette"
import { CascadingEndTimesBannerFragmentContainer } from "Components/CascadingEndTimesBanner"
import { FullBleedBanner } from "Components/FullBleedBanner"
import { useFeatureFlag } from "System/Hooks/useFeatureFlag"
import { useRouter } from "System/Hooks/useRouter"
import { extractNodes } from "Utils/extractNodes"
import type { ArtworkPageBanner_artwork$key } from "__generated__/ArtworkPageBanner_artwork.graphql"
Expand All @@ -13,15 +12,12 @@ interface ArtworkPageBannerProps {
artwork: ArtworkPageBanner_artwork$key
me: ArtworkPageBanner_me$key
}
export const ArtworkPageBanner: FC<
React.PropsWithChildren<ArtworkPageBannerProps>
> = props => {
export const ArtworkPageBanner: FC<React.PropsWithChildren<
ArtworkPageBannerProps
>> = props => {
const artwork = useFragment(ARTWORK_FRAGMENT, props.artwork)
const me = useFragment(ME_FRAGMENT, props.me)
const { match } = useRouter()
const allowExpiredPartnerOffers = useFeatureFlag(
"emerald_allow-expired-partner-offers",
)

const expectedPartnerOfferID = match?.location?.query?.partner_offer_id as
| string
Expand Down Expand Up @@ -55,17 +51,10 @@ export const ArtworkPageBanner: FC<
return <ArtworkUnavailableBanner />
}

if (allowExpiredPartnerOffers) {
if (
partnerOffer &&
partnerOffer.internalID == expectedPartnerOfferID &&
!partnerOffer.isActive
) {
return <ExpiredOfferBanner />
}
} else if (
me &&
(!partnerOffer || partnerOffer.internalID !== expectedPartnerOfferID)
if (
partnerOffer &&
partnerOffer.internalID == expectedPartnerOfferID &&
!partnerOffer.isActive
) {
return <ExpiredOfferBanner />
}
Expand Down Expand Up @@ -100,7 +89,7 @@ const UnpublishedArtworkBanner = () => (

const ME_FRAGMENT = graphql`
fragment ArtworkPageBanner_me on Me
@argumentDefinitions(artworkID: { type: "String!" }) {
@argumentDefinitions(artworkID: { type: "String!" }) {
partnerOffersConnection(artworkID: $artworkID, first: 1) {
edges {
node {
Expand Down

0 comments on commit dfdda0e

Please sign in to comment.