Skip to content

Commit

Permalink
chore: remove "special needs" from image tags
Browse files Browse the repository at this point in the history
  • Loading branch information
plunkettgoogle committed Nov 16, 2021
1 parent dedf51b commit 4ae5633
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
11 changes: 8 additions & 3 deletions sites/public/lib/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ const getListingCardSubtitle = (address: Address) => {
return address ? `${street}, ${city} ${state}, ${zipCode}` : null
}

export const getImageTagFromListing = (listing: Listing) => {
const reservedCommunityTypeName = listing.reservedCommunityType?.name
return reservedCommunityTypeName && reservedCommunityTypeName !== "specialNeeds"
? t(`listings.reservedCommunityTypes.${listing.reservedCommunityType.name}`)
: undefined
}

const getListingTableData = (listing: Listing) => {
if (listing.unitsSummary !== undefined && listing.unitsSummary.length > 0) {
return getSummariesTableFromUnitsSummary(listing.unitsSummary)
Expand All @@ -65,9 +72,7 @@ export const getListings = (listings) => {
subtitle: getListingCardSubtitle(listing.buildingAddress),
title: listing.name,
href: `/listing/${listing.id}/${listing.urlSlug}`,
tagLabel: listing.reservedCommunityType
? t(`listings.reservedCommunityTypes.${listing.reservedCommunityType.name}`)
: undefined,
tagLabel: getImageTagFromListing(listing),
}}
tableProps={{
headers: unitSummariesHeaders,
Expand Down
8 changes: 2 additions & 6 deletions sites/public/src/ListingView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
Message,
} from "@bloom-housing/ui-components"
import { ErrorPage } from "../pages/_error"
import { getGenericAddress, openInFuture } from "../lib/helpers"
import { getGenericAddress, getImageTagFromListing, openInFuture } from "../lib/helpers"

interface ListingProps {
listing: Listing
Expand Down Expand Up @@ -241,11 +241,7 @@ export const ListingView = (props: ListingProps) => {
<ImageCard
title={listing.name}
imageUrl={imageUrlFromListing(listing, parseInt(process.env.listingPhotoSize))}
tagLabel={
listing.reservedCommunityType
? t(`listings.reservedCommunityTypes.${props.listing.reservedCommunityType.name}`)
: undefined
}
tagLabel={getImageTagFromListing(listing)}
/>
<div className="p-3">
<p className="font-alt-sans uppercase tracking-widest text-sm font-semibold">
Expand Down

0 comments on commit 4ae5633

Please sign in to comment.