@bloom-housing/ui-components 4.4.1-alpha.2 → 4.4.1-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/package.json +3 -3
- package/src/helpers/tableSummaries.tsx +34 -15
- package/src/locales/general.json +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.4.1-alpha.3](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.4.1-alpha.2...@bloom-housing/ui-components@4.4.1-alpha.3) (2022-05-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @bloom-housing/ui-components
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [4.4.1-alpha.2](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.4.1-alpha.1...@bloom-housing/ui-components@4.4.1-alpha.2) (2022-05-25)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @bloom-housing/ui-components
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloom-housing/ui-components",
|
|
3
|
-
"version": "4.4.1-alpha.
|
|
3
|
+
"version": "4.4.1-alpha.3",
|
|
4
4
|
"author": "Sean Albert <sean.albert@exygy.com>",
|
|
5
5
|
"description": "Shared user interface components for Bloom affordable housing system",
|
|
6
6
|
"homepage": "https://github.com/bloom-housing/bloom/tree/master/shared/ui-components",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"webpack": "^4.44.2"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@bloom-housing/backend-core": "^4.4.1-alpha.
|
|
73
|
+
"@bloom-housing/backend-core": "^4.4.1-alpha.3",
|
|
74
74
|
"@mapbox/mapbox-sdk": "^0.13.0",
|
|
75
75
|
"@types/body-scroll-lock": "^2.6.1",
|
|
76
76
|
"@types/jwt-decode": "^2.2.1",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"tailwindcss": "2.2.10",
|
|
103
103
|
"typesafe-actions": "^5.1.0"
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "385625937a1b258e21d6e97504be08425c199b9e"
|
|
106
106
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as React from "react"
|
|
2
2
|
import { t } from "./translator"
|
|
3
|
-
import { UnitSummary } from "@bloom-housing/backend-core/types"
|
|
3
|
+
import { UnitSummary, ListingAvailability } from "@bloom-housing/backend-core/types"
|
|
4
4
|
import { StandardTableData } from "../tables/StandardTable"
|
|
5
5
|
|
|
6
|
-
export const unitSummariesTable = (
|
|
6
|
+
export const unitSummariesTable = (
|
|
7
|
+
summaries: UnitSummary[],
|
|
8
|
+
listingAvailability: ListingAvailability
|
|
9
|
+
): StandardTableData => {
|
|
7
10
|
const unitSummaries = summaries?.map((unitSummary) => {
|
|
8
11
|
const unitPluralization = unitSummary.totalAvailable == 1 ? t("t.unit") : t("t.units")
|
|
9
12
|
const minIncome =
|
|
@@ -43,6 +46,29 @@ export const unitSummariesTable = (summaries: UnitSummary[]): StandardTableData
|
|
|
43
46
|
)
|
|
44
47
|
: getRent(unitSummary.rentRange.min, unitSummary.rentRange.max)
|
|
45
48
|
|
|
49
|
+
let availability = null
|
|
50
|
+
if (listingAvailability === ListingAvailability.availableUnits) {
|
|
51
|
+
availability = (
|
|
52
|
+
<span>
|
|
53
|
+
{unitSummary.totalAvailable > 0 ? (
|
|
54
|
+
<>
|
|
55
|
+
<strong>{unitSummary.totalAvailable}</strong> {unitPluralization}
|
|
56
|
+
</>
|
|
57
|
+
) : (
|
|
58
|
+
<span>
|
|
59
|
+
<strong>{t("listings.waitlist.open")}</strong>
|
|
60
|
+
</span>
|
|
61
|
+
)}
|
|
62
|
+
</span>
|
|
63
|
+
)
|
|
64
|
+
} else if (listingAvailability === ListingAvailability.openWaitlist) {
|
|
65
|
+
availability = (
|
|
66
|
+
<span>
|
|
67
|
+
<strong>{t("listings.waitlist.open")}</strong>
|
|
68
|
+
</span>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
46
72
|
return {
|
|
47
73
|
unitType: {
|
|
48
74
|
content: <strong>{t(`listings.unitTypes.${unitSummary.unitType?.name}`)}</strong>,
|
|
@@ -57,17 +83,7 @@ export const unitSummariesTable = (summaries: UnitSummary[]): StandardTableData
|
|
|
57
83
|
},
|
|
58
84
|
rent: { content: <span>{rent}</span> },
|
|
59
85
|
availability: {
|
|
60
|
-
content:
|
|
61
|
-
<span>
|
|
62
|
-
{unitSummary.totalAvailable > 0 ? (
|
|
63
|
-
<>
|
|
64
|
-
<strong>{unitSummary.totalAvailable}</strong> {unitPluralization}
|
|
65
|
-
</>
|
|
66
|
-
) : (
|
|
67
|
-
<span className="uppercase">{t("listings.waitlist.label")}</span>
|
|
68
|
-
)}
|
|
69
|
-
</span>
|
|
70
|
-
),
|
|
86
|
+
content: availability,
|
|
71
87
|
},
|
|
72
88
|
}
|
|
73
89
|
})
|
|
@@ -75,11 +91,14 @@ export const unitSummariesTable = (summaries: UnitSummary[]): StandardTableData
|
|
|
75
91
|
return unitSummaries
|
|
76
92
|
}
|
|
77
93
|
|
|
78
|
-
export const getSummariesTable = (
|
|
94
|
+
export const getSummariesTable = (
|
|
95
|
+
summaries: UnitSummary[],
|
|
96
|
+
listingAvailability: ListingAvailability
|
|
97
|
+
): StandardTableData => {
|
|
79
98
|
let unitSummaries: StandardTableData = []
|
|
80
99
|
|
|
81
100
|
if (summaries?.length > 0) {
|
|
82
|
-
unitSummaries = unitSummariesTable(summaries)
|
|
101
|
+
unitSummaries = unitSummariesTable(summaries, listingAvailability)
|
|
83
102
|
}
|
|
84
103
|
return unitSummaries
|
|
85
104
|
}
|
package/src/locales/general.json
CHANGED
|
@@ -594,6 +594,7 @@
|
|
|
594
594
|
"listings.availableAndWaitlist": "Available Units & Open Waitlist",
|
|
595
595
|
"listings.availableUnitsAndWaitlist": "Available units and waitlist",
|
|
596
596
|
"listings.availableUnitsAndWaitlistDesc": "Once applicants fill all available units, additional applicants will be placed on the waitlist for <span class='t-italic'>%{number} units</span>",
|
|
597
|
+
"listings.availableUnits": "Available Units",
|
|
597
598
|
"listings.bath": "bath",
|
|
598
599
|
"listings.browseListings": "Browse Listings",
|
|
599
600
|
"listings.buildingImageAltText": "A picture of the building",
|