diff --git a/sites/public/lib/helpers.tsx b/sites/public/lib/helpers.tsx index b82c70c000..653b731b5a 100644 --- a/sites/public/lib/helpers.tsx +++ b/sites/public/lib/helpers.tsx @@ -40,6 +40,15 @@ const getListingCardSubtitle = (address: Address) => { return address ? `${street}, ${city} ${state}, ${zipCode}` : null } +// TODO(#773): Determine the best way of surfacing accessibility-related +// information in listing views. +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) @@ -65,9 +74,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, diff --git a/sites/public/src/ListingView.tsx b/sites/public/src/ListingView.tsx index 89f1c442f3..378557e264 100644 --- a/sites/public/src/ListingView.tsx +++ b/sites/public/src/ListingView.tsx @@ -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 @@ -241,11 +241,7 @@ export const ListingView = (props: ListingProps) => {