Skip to content

Commit

Permalink
minor update to use existing check for defaultUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmalbert committed Sep 17, 2021
2 parents d2869ed + 8c35649 commit e5c7d43
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ All notable changes to this project will be documented in this file. The format
- Update select width ([#1765](https://github.com/bloom-housing/bloom/pull/1765)) (Dominik Barcikowski)
- Reset page to 1 on limit change ([#1809](https://github.com/bloom-housing/bloom/pull/1809)) (Dominik Barcikowski)
- Update public and partners to support preferred unit ids ([#1774](https://github.com/bloom-housing/bloom/pull/1774)) (Dominik Barcikowski)
- Update select options ([#1768](https://github.com/bloom-housing/bloom/pull/1768)) (Dominik Barcikowski)

- Changed:

Expand Down
10 changes: 7 additions & 3 deletions sites/partners/lib/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,14 @@ export const getLotteryEvent = (listing: FormListing): ListingEvent | undefined
: null
}

// TODO memoize this function
export function arrayToFormOptions<T>(arr: T[], label: string, value: string): FormOption[] {
export function arrayToFormOptions<T>(
arr: T[],
label: string,
value: string,
translateLabel?: string
): FormOption[] {
return arr.map((val: T) => ({
label: val[label],
label: translateLabel ? t(`${translateLabel}.${val[label]}`) : val[label],
value: val[value],
}))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const DetailRankingsAndResults = () => {
<ViewItem label={t("listings.reviewOrderQuestion")}>
{getReviewOrderType() === ListingReviewOrder.firstComeFirstServe
? t("listings.firstComeFirstServe")
: t("listings.lottery")}
: t("listings.lotteryTitle")}
</ViewItem>
</GridSection>
{lotteryEvent && (
Expand Down
2 changes: 1 addition & 1 deletion sites/partners/src/listings/PaperListingForm/UnitForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ const UnitForm = ({ onSubmit, onClose, defaultUnit, existingId, nextId }: UnitFo
"name",
"id"
),
unitTypes: arrayToFormOptions<UnitType>(unitTypes, "name", "id"),
unitTypes: arrayToFormOptions<UnitType>(unitTypes, "name", "id", "listings.unit.typeOptions"),
})
}, [amiCharts, unitPriorities, unitTypes])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const RankingsAndResults = ({ listing }: RankingsAndResultsProps) => {
!listing || listing?.reviewOrderType === ListingReviewOrder.firstComeFirstServe,
},
{
label: t("listings.lottery"),
label: t("listings.lotteryTitle"),
value: "reviewOrderLottery",
id: "reviewOrderLottery",
defaultChecked: listing?.reviewOrderType === ListingReviewOrder.lottery,
Expand Down
10 changes: 9 additions & 1 deletion ui-components/src/locales/general.json
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@
"listingSubmitted": "Listing Submitted",
"listingUpdated": "Listing Updated",
"longitude": "Longitude",
"lottery": "Lottery",
"lotteryTitle": "Lottery",
"lotteryDateNotes": "Lottery Date Notes",
"lotteryDateQuestion": "When will the lottery be run?",
"lotteryEndTime": "Lottery End Time",
Expand Down Expand Up @@ -1055,6 +1055,14 @@
"available": "Available",
"occupied": "Occupied",
"unavailable": "Unavailable"
},
"typeOptions": {
"studio": "Studio",
"oneBdrm": "One Bedroom",
"twoBdrm": "Two Bedroom",
"threeBdrm": "Three Bedroom",
"fourBdrm": "Four Bedroom",
"SRO": "Single Room Occupancy"
}
},
"events": {
Expand Down

0 comments on commit e5c7d43

Please sign in to comment.