Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import { listing } from "@bloom-housing/shared-helpers/__tests__/testHelpers"
import { AuthContext } from "@bloom-housing/shared-helpers"
import { screen } from "../../../testUtils"
import * as helpers from "../../../../src/lib/helpers"

afterEach(cleanup)

Expand All @@ -27,6 +28,7 @@ describe("<LeasingAgent>", () => {

it("shows all content enableLeasingAgentAltText on", () => {
const phoneNumber = "(123) 456-7890"
jest.spyOn(helpers, "isFeatureFlagOn").mockReturnValue(true)
render(
<AuthContext.Provider
value={{
Expand Down Expand Up @@ -86,6 +88,7 @@ describe("<LeasingAgent>", () => {
})
it("shows all content enableLeasingAgentAltText off", () => {
const phoneNumber = "(123) 456-7890"
jest.spyOn(helpers, "isFeatureFlagOn").mockReturnValue(false)
render(
<AuthContext.Provider
value={{
Expand Down
6 changes: 3 additions & 3 deletions sites/public/src/components/listing/ListingView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ export const ListingView = (props: ListingProps) => {
FeatureFlagEnum.disableListingPreferences,
listing?.jurisdictions?.id
)
const enableLeasingAgentAltText = doJurisdictionsHaveFeatureFlagOn(
FeatureFlagEnum.enableLeasingAgentAltText,
listing.jurisdictions.id
const enableLeasingAgentAltText = isFeatureFlagOn(
props.jurisdiction,
FeatureFlagEnum.enableLeasingAgentAltText
)

const leasingAgentContactText = enableLeasingAgentAltText
Expand Down
2 changes: 1 addition & 1 deletion sites/public/src/components/listing/ListingViewSeeds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export const ListingViewSeeds = ({ listing, jurisdiction, profile, preview }: Li
{LotteryEvent}
{ReferralApplication}
{WhatToExpect}
<LeasingAgent listing={listing} />
<LeasingAgent listing={listing} jurisdiction={jurisdiction} />
{ListingUpdatedAt}
</>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@ import { Card, Heading, Link } from "@bloom-housing/ui-seeds"
import { Address, AuthContext } from "@bloom-housing/shared-helpers"
import { t } from "@bloom-housing/ui-components"
import styles from "../ListingViewSeeds.module.scss"
import { FeatureFlagEnum, Listing } from "@bloom-housing/shared-helpers/src/types/backend-swagger"
import {
FeatureFlagEnum,
Jurisdiction,
Listing,
} from "@bloom-housing/shared-helpers/src/types/backend-swagger"
import { isFeatureFlagOn } from "../../../lib/helpers"

export const formatPhone = (phone: string) => {
return phone.replace(/[-() ]/g, "")
}

type LeasingAgentProps = {
listing: Listing
jurisdiction?: Jurisdiction
}
export const LeasingAgent = ({ listing }: LeasingAgentProps) => {
export const LeasingAgent = ({ listing, jurisdiction }: LeasingAgentProps) => {
const {
listingsLeasingAgentAddress: address,
leasingAgentEmail: email,
Expand All @@ -30,9 +36,9 @@ export const LeasingAgent = ({ listing }: LeasingAgentProps) => {
: undefined
if (!address && !email && !name && !officeHours && !title && !phone && !managementWebsite) return

const enableLeasingAgentAltText = doJurisdictionsHaveFeatureFlagOn(
FeatureFlagEnum.enableLeasingAgentAltText,
listing.jurisdictions.id
const enableLeasingAgentAltText = isFeatureFlagOn(
jurisdiction,
FeatureFlagEnum.enableLeasingAgentAltText
)

const leasingAgentContactText = enableLeasingAgentAltText
Expand Down
Loading