Skip to content

Commit

Permalink
feat: update summary tables and tags with coming soon (1076) (1098) (…
Browse files Browse the repository at this point in the history
  • Loading branch information
emilyjablonski authored Apr 14, 2022
1 parent fc5c008 commit f4ad494
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 22 deletions.
1 change: 1 addition & 0 deletions backend/core/src/listings/views/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const views: Views = {
"listings.name",
"listings.applicationDueDate",
"listings.applicationOpenDate",
"listings.marketingType",
"listings.reviewOrderType",
"listings.status",
"listings.assets",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const listingSeed: ListingSeedType = {
},
listingPreferences: [],
jurisdictionName: "Detroit",
marketingType: ListingMarketingTypeEnum.Marketing,
marketingType: ListingMarketingTypeEnum.ComingSoon,
}

export class Listing10155Seed extends ListingDefaultSeed {
Expand Down
4 changes: 4 additions & 0 deletions sites/partners/page_content/locale_overrides/general.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@
"nav.flags": "Flags",
"nav.siteTitlePartners": "Detroit Partner Portal",
"nav.users": "Users",
"seasons.fall": "Fall",
"seasons.spring": "Spring",
"seasons.summer": "Summer",
"seasons.winter": "Winter",
"t.addNotes": "Add notes",
"t.areYouSure": "Are you sure?",
"t.automatic": "Automatic",
Expand Down
54 changes: 33 additions & 21 deletions sites/public/lib/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ELIGIBILITY_ROUTE, ELIGIBILITY_SECTIONS } from "./constants"
export const eligibilityRoute = (page: number) =>
`/${ELIGIBILITY_ROUTE}/${ELIGIBILITY_SECTIONS[page]}`
import dayjs from "dayjs"
import { Address, Listing } from "@bloom-housing/backend-core/types"
import { Address, Listing, ListingMarketingTypeEnum } from "@bloom-housing/backend-core/types"
import {
t,
ListingCard,
Expand Down Expand Up @@ -53,7 +53,11 @@ export const accessibilityFeaturesExist = (listing: Listing) => {
}

export const getImageTagLabelFromListing = (listing: Listing) => {
return listing?.isVerified ? t("listings.verifiedListing") : undefined
return listing?.marketingType === ListingMarketingTypeEnum.comingSoon
? t("listings.comingSoon")
: listing?.isVerified
? t("listings.verifiedListing")
: undefined
}

export const getListings = (listings) => {
Expand All @@ -73,7 +77,11 @@ export const getListings = (listings) => {
? [
{
text: getImageTagLabelFromListing(listing),
iconType: listing?.isVerified ? "badgeCheck" : null,
iconType:
listing?.isVerified &&
listing?.marketingType === ListingMarketingTypeEnum.comingSoon
? "badgeCheck"
: null,
iconColor: "#193154",
},
]
Expand Down Expand Up @@ -161,25 +169,29 @@ export const getUnitGroupSummary = (listing: Listing): UnitSummaryTable => {

let availability = null

if (group.unitVacancies > 0) {
if (listing.marketingType && listing.marketingType === ListingMarketingTypeEnum.comingSoon) {
availability = <strong>{t("listings.comingSoon")}</strong>
} else {
if (group.unitVacancies > 0) {
availability = (
<div>
<strong>{group.unitVacancies} </strong>
{group.unitVacancies === 1 ? t("listings.vacantUnit") : t("listings.vacantUnits")}
{` ${t("t.&")}`}
</div>
)
}

availability = (
<div>
<strong>{group.unitVacancies} </strong>
{group.unitVacancies === 1 ? t("listings.vacantUnit") : t("listings.vacantUnits")}
{` ${t("t.&")}`}
</div>
<>
{availability}
<strong>
{group.openWaitlist ? t("listings.waitlist.open") : t("listings.waitlist.closed")}
</strong>
</>
)
}

availability = (
<>
{availability}
<strong>
{group.openWaitlist ? t("listings.waitlist.open") : t("listings.waitlist.closed")}
</strong>
</>
)

let ami = null

if (group.amiPercentageRange && group.amiPercentageRange.min === group.amiPercentageRange.max) {
Expand Down Expand Up @@ -212,9 +224,9 @@ export const getUnitGroupSummary = (listing: Listing): UnitSummaryTable => {
.reduce((acc, curr) => [acc, ", ", curr])}
</>
),
rent,
availability,
ami: <strong>{ami}</strong>,
rent: rent ?? t("listings.unitsSummary.notAvailable"),
availability: <strong>{availability ?? t("listings.unitsSummary.notAvailable")}</strong>,
ami: ami ?? t("listings.unitsSummary.notAvailable"),
}
})

Expand Down
1 change: 1 addition & 0 deletions ui-components/src/locales/general.json
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,7 @@
"listings.unitsSummary.availability": "Availability",
"listings.unitsSummary.count": "Afforable Unit Group Quantity",
"listings.unitsSummary.available": "Total Available",
"listings.unitsSummary.notAvailable": "Not available",
"listings.unitsSummary.delete": "Delete this Summary",
"listings.unitsSummary.deleteConf": "Do you really want to delete this summary?",
"listings.unitsSummary.bathroomsMin": "Min Number of Bathrooms",
Expand Down

0 comments on commit f4ad494

Please sign in to comment.