Skip to content

Commit

Permalink
Merge pull request #3 from bloom-housing/master
Browse files Browse the repository at this point in the history
Pull latest from upstream
  • Loading branch information
bk3c authored Feb 6, 2020
2 parents c758b72 + 27082e7 commit 07b05bc
Show file tree
Hide file tree
Showing 39 changed files with 459 additions and 171 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ This is the repository for the Bloom affordable housing system.
An overview of the system will go here.

### Applications

### Services

### Shared Libraries

- UI Components
- Styles

Expand All @@ -29,11 +32,13 @@ yarn install
N/A for the time being.

### Running a Local Test Server

```
yarn dev:all
```

### Running Tests

```
yarn test:all
```
Expand Down
12 changes: 12 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "Bloom Listing Service",
"repository": "https://github.com/bloom-housing/bloom",
"buildpacks": [
{
"url": "https://github.com/lstoll/heroku-buildpack-monorepo.git"
},
{
"url": "heroku/nodejs"
}
]
}
2 changes: 1 addition & 1 deletion apps/public/layouts/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Layout = props => (
<title>{t("nav.siteTitle")}</title>
</Head>
<SiteHeader
logoSrc="/static/images/logo_glyph.svg"
logoSrc="/images/logo_glyph.svg"
notice="This is a preview of our new website. We're just getting started. We'd love to get your feedback."
title={t("nav.siteTitle")}
>
Expand Down
15 changes: 0 additions & 15 deletions apps/public/lib/getOccupancyDescription.tsx

This file was deleted.

62 changes: 0 additions & 62 deletions apps/public/lib/tableSummaries.tsx

This file was deleted.

13 changes: 12 additions & 1 deletion apps/public/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,23 @@ const axios = require("axios")
if (process.env.NODE_ENV !== "production") {
require("dotenv").config()
}
const LISTING_SERVICE_URL = process.env.LISTING_SERVICE_URL || "http://localhost:3001"

// Set up app-wide constants
let LISTING_SERVICE_URL = "http://localhost:3001"
if (process.env.INCOMING_HOOK_BODY && process.env.INCOMING_HOOK_BODY.startsWith("http")) {
// This is a value that can get set via a Netlify webhook for branch deploys
LISTING_SERVICE_URL = decodeURIComponent(process.env.INCOMING_HOOK_BODY)
} else if (process.env.LISTING_SERVICE_URL) {
LISTING_SERVICE_URL = process.env.LISTING_SERVICE_URL
}
console.log(`Using ${LISTING_SERVICE_URL} for the listing service.`)

const MAPBOX_TOKEN =
process.env.MAPBOX_TOKEN ||
"pk.eyJ1IjoibWplZHJhcyIsImEiOiJjazI2OHA5YzQycTBpM29xdDVwbXNyMDlwIn0.XS5ilGzTh_yVl3XY-8UKeA"
const HOUSING_COUNSELOR_SERVICE_URL = process.env.HOUSING_COUNSELOR_SERVICE_URL

// Load the Tailwind theme and set up SASS vars
const bloomTheme = require("./tailwind.config.js")
const tailwindVars = require("@bloom-housing/ui-components/tailwind.tosass.js")(bloomTheme)

Expand Down
1 change: 1 addition & 0 deletions apps/public/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@types/react": "^16.9.19",
"concurrently": "^5.0.2",
"cypress": "^3.8.2",
"js-levenshtein": "^1.1.6",
"next-transpile-modules": "^3.0.1",
"sass-loader": "^8.0.2",
"typescript": "^3.7.4",
Expand Down
8 changes: 4 additions & 4 deletions apps/public/pages/_app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ class MyApp extends App {
}

const generalTranslations = await import(
"@bloom-housing/ui-components/static/locales/general.json"
"@bloom-housing/ui-components/src/locales/general.json"
)
const spanishTranslations = await import("@bloom-housing/ui-components/static/locales/es.json")
const spanishTranslations = await import("@bloom-housing/ui-components/src/locales/es.json")
const translations = {
general: generalTranslations,
es: spanishTranslations,
custom: {
general: await import("../static/locale_overrides/general.json")
general: await import("../page_content/locale_overrides/general.json")
// Uncomment to add additional language overrides
// es: await import("../static/locale_overrides/es.json")
// es: await import("../page_content/locale_overrides/es.json")
}
}
return { pageProps, translations }
Expand Down
45 changes: 32 additions & 13 deletions apps/public/pages/listing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ import ReactDOMServer from "react-dom/server"
import Head from "next/head"
import MetaTags from "@bloom-housing/ui-components/src/atoms/MetaTags"
import t from "@bloom-housing/ui-components/src/helpers/translator"
import { unitSummariesTable, occupancyTable } from "../lib/tableSummaries"
import getOccupancyDescription from "../lib/getOccupancyDescription"
import {
occupancyTable,
getOccupancyDescription
} from "@bloom-housing/ui-components/src/helpers/occupancyFormatting"
import { groupNonReservedAndReservedSummaries } from "@bloom-housing/ui-components/src/helpers/tableSummaries"
import Layout from "../layouts/application"
import { Listing } from "@bloom-housing/core/src/listings"
import {
Expand All @@ -21,7 +24,11 @@ import ListingMap from "@bloom-housing/ui-components/src/page_components/listing
import ImageHeader from "@bloom-housing/ui-components/src/headers/image_header/image_header"
import { OneLineAddress } from "@bloom-housing/ui-components/src/helpers/address"
import { Description } from "@bloom-housing/ui-components/src/atoms/description"
import { Headers, BasicTable } from "@bloom-housing/ui-components/src/tables/basic_table"
import { Headers, BasicTable } from "@bloom-housing/ui-components/src/tables/BasicTable"
import {
GroupedTable,
GroupedTableGroup
} from "@bloom-housing/ui-components/src/tables/GroupedTable"
import UnitTables from "@bloom-housing/ui-components/src/page_components/UnitTables"
import AdditionalFees from "@bloom-housing/ui-components/src/page_components/listing/AdditionalFees"
import PreferencesList from "@bloom-housing/ui-components/src/lists/PreferencesList"
Expand Down Expand Up @@ -60,7 +67,6 @@ export default class extends Component<ListingProps> {
rent: "Rent",
availability: "Availability"
}
const unitSummaries = unitSummariesTable(listing.unitsSummarized.byUnitType)

const amiValues = listing.unitsSummarized.amiPercentages
.map(percent => {
Expand All @@ -70,6 +76,14 @@ export default class extends Component<ListingProps> {
.sort()
const hmiHeaders = listing.unitsSummarized.hmi.columns as Headers
const hmiData = listing.unitsSummarized.hmi.rows
let groupedUnits: GroupedTableGroup[] = null

if (amiValues.length == 1) {
groupedUnits = groupNonReservedAndReservedSummaries(
listing.unitsSummarized.byNonReservedUnitType,
listing.unitsSummarized.byReservedType
)
} // else condition is handled inline below

const occupancyDescription = getOccupancyDescription(listing)
const occupancyHeaders = {
Expand Down Expand Up @@ -121,21 +135,26 @@ export default class extends Component<ListingProps> {
return parseInt(item.percent, 10) == percent
})

groupedUnits = groupNonReservedAndReservedSummaries(
byAMI.byNonReservedUnitType,
byAMI.byReservedType
)

return (
<>
<h2 className="mt-4 mb-2">{percent}% AMI Unit</h2>
<BasicTable
<GroupedTable
headers={unitSummariesHeaders}
data={unitSummariesTable(byAMI.byNonReservedUnitType)}
data={groupedUnits}
responsiveCollapse={true}
/>
</>
)
})}
{amiValues.length == 1 && (
<BasicTable
<GroupedTable
headers={unitSummariesHeaders}
data={unitSummaries}
data={groupedUnits}
responsiveCollapse={true}
/>
)}
Expand All @@ -146,7 +165,7 @@ export default class extends Component<ListingProps> {
<ListingDetails>
<ListingDetailItem
imageAlt="eligibility-notebook"
imageSrc="/static/images/listing-eligibility.svg"
imageSrc="/images/listing-eligibility.svg"
title="Eligibility"
subtitle="Income, occupancy, preferences, and subsidies"
desktopClass="bg-primary-lighter"
Expand Down Expand Up @@ -207,7 +226,7 @@ export default class extends Component<ListingProps> {

<ListingDetailItem
imageAlt="process-info"
imageSrc="/static/images/listing-process.svg"
imageSrc="/images/listing-process.svg"
title="Process"
subtitle="Important dates and contact information"
hideHeader={true}
Expand All @@ -231,7 +250,7 @@ export default class extends Component<ListingProps> {

<ListingDetailItem
imageAlt="features-cards"
imageSrc="/static/images/listing-features.svg"
imageSrc="/images/listing-features.svg"
title="Features"
subtitle="Amenities, unit details and additional fees"
>
Expand Down Expand Up @@ -260,7 +279,7 @@ export default class extends Component<ListingProps> {

<ListingDetailItem
imageAlt="neighborhood-buildings"
imageSrc="/static/images/listing-neighborhood.svg"
imageSrc="/images/listing-neighborhood.svg"
title="Neighborhood"
subtitle="Location and transportation"
desktopClass="bg-primary-lighter"
Expand All @@ -272,7 +291,7 @@ export default class extends Component<ListingProps> {

<ListingDetailItem
imageAlt="additional-information-envelope"
imageSrc="/static/images/listing-legal.svg"
imageSrc="/images/listing-legal.svg"
title="Additional Information"
subtitle="Required documents and selection criteria"
>
Expand Down
4 changes: 1 addition & 3 deletions apps/public/pages/listings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Layout from "../layouts/application"
import PageHeader from "@bloom-housing/ui-components/src/headers/page_header/page_header"
import ListingsList from "@bloom-housing/ui-components/src/page_components/listing/ListingsList"
import axios from "axios"
import { unitSummariesTable } from "../lib/tableSummaries"
import moment from "moment"
import { Listing } from "@bloom-housing/core/src/listings"
import ListingsGroup from "@bloom-housing/ui-components/src/page_components/listing/ListingsGroup"
Expand Down Expand Up @@ -38,7 +37,7 @@ export default class extends Component<ListingsProps> {

renderOpenListings() {
return this.props.openListings.length > 0 ? (
<ListingsList listings={this.props.openListings} unitSummariesTable={unitSummariesTable} />
<ListingsList listings={this.props.openListings} />
) : (
<div className="flex flex-row flex-wrap max-w-5xl m-auto mt-5 mb-12 text-center p-4 bg-gray-300">
<h3 className="m-auto text-gray-800">{t("listings.noOpenListings")}</h3>
Expand All @@ -54,7 +53,6 @@ export default class extends Component<ListingsProps> {
header={t("listings.closedListings")}
hideButtonText={t("listings.hideClosedListings")}
showButtonText={t("listings.showClosedListings")}
unitSummariesTable={unitSummariesTable}
/>
)
)
Expand Down
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions services/listings/Procfile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
release: yarn herokusetup
web: yarn start
Loading

0 comments on commit 07b05bc

Please sign in to comment.