Skip to content

Commit

Permalink
Update core to 0.1.0 (#51)
Browse files Browse the repository at this point in the history
* Fix unit summary availability (core #224)
* Fixes for building criteria and preferences on listing (core #223)
* Insert GTM tags into page (core #195)
* Make floor optional for listings (core #225)
* Style changes (core #228)
* Added .idea (WebStorm config) to gitignore (core #234)
* Add .vscode to .gitignore (core #235)
* Add pretty URL slugs to listing pages (core #233)
* Add local development and dev site GTM keys (core #240)
* tech demo version "0.1" of Submit an Application form (core #232)
* Add lerna (core #226)
* fix production env key in netlify.toml (core #252)
* Upgrade prettier (core #214)
* Minor dependency updates to build and test tools (core #264)
* catch apps up with prettier 2
* match next.config with reference
* add redirect module now that it's enabled

Co-authored-by: Marcin Jędras <mjjedras@gmail.com>
Co-authored-by: Jared White <jared@jaredwhite.com>
Co-authored-by: Ben Kutler <ben@benkutler.com>
Co-authored-by: Jesse James Arnold <jesse.james@exygy.com>
Co-authored-by: Jesse Arnold <jessearnold@Jesses-MacBook-Pro.local>
Co-authored-by: Ben Peters <bencpeters@gmail.com>
  • Loading branch information
6 people committed May 15, 2020
1 parent 166e91b commit 879c310
Show file tree
Hide file tree
Showing 212 changed files with 12,122 additions and 1,676 deletions.
7 changes: 5 additions & 2 deletions .eslintrc.js
Expand Up @@ -8,16 +8,19 @@ module.exports = {
],
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: "module", // Allows for the use of imports
tsconfigRootDir: "."
tsconfigRootDir: ".",
},
plugins: ["react", "@typescript-eslint"],
extends: [
"eslint:recommended", // the set of rules which are recommended for all projects by the ESLint Team
"plugin:@typescript-eslint/eslint-recommended", // conflict resolution between above and below rulesets.
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin
"plugin:@typescript-eslint/recommended-requiring-type-checking", // additional rules that take a little longer to run
"plugin:import/errors", // check for imports not resolving correctly
"plugin:import/warnings",
"plugin:import/typescript",
"prettier/@typescript-eslint", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
"plugin:prettier/recommended" // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
"plugin:prettier/recommended", // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
rules: {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Expand Up @@ -13,6 +13,7 @@ storybook-static

# Cypress test output videos
apps/**/cypress/videos
apps/**/cypress/screenshots

# Complied Typescript
dist
Expand Down Expand Up @@ -76,4 +77,6 @@ yarn-error.log
# Yarn Integrity file
.yarn-integrity

.vscode/
# IDE configs
.idea
.vscode/
11 changes: 11 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,11 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.0.9](https://github.com/Exygy/bloom/compare/v0.0.2...v0.0.9) (2020-04-21)


### Reverts

* Revert "Getting layout component ready for Google Analytics" ([7ca55ec](https://github.com/Exygy/bloom/commit/7ca55ec94c1f377a8e40645f9cc61780b7c1cefa))
9 changes: 9 additions & 0 deletions README.md
Expand Up @@ -43,6 +43,15 @@ yarn dev:all
yarn test:all
```

### Versioning

We are using [lerna](https://lerna.js.org/) as a package versioning tool. It helps with keeping multiple package versions in sync.
To upgrade version, first commit your changes to feature branch and push it to github. Then run
```
yarn new-version
```
It will upgrade dependencies, commit them to github and create a release with a tag.

## Contributing

Contributions to the core Bloom applications and services are welcomed. To help us meet the project's goals around quality and maintainability, we ask that all contributors read, understand, and agree to these guidelines.
24 changes: 9 additions & 15 deletions apps/public-ala/cypress/integration/navigation.ts
@@ -1,48 +1,44 @@
describe("Navigating around the site", function() {
it("Loads the homepage directly", function() {
describe("Navigating around the site", function () {
it("Loads the homepage directly", function () {
cy.visit("http://localhost:3000")

// Check that the homepage banner text is present on the page
cy.contains("Apply for affordable housing")
})

it("Loads the listings page directly", function() {
it("Loads the listings page directly", function () {
cy.visit("http://localhost:3000/listings")

// Check that the listings page banner text is present on the page
cy.contains("Rent affordable housing")
})

it("Loads a listing page directly", function() {
it("Loads a listing page directly", function () {
cy.visit("http://localhost:3000/listing/Uvbk5qurpB2WI9V6WnNdH")

// Check that the listing page sidebar apply section text is present on the page
cy.contains("Get a Paper Application")
})

it("Loads a non-listing-related page directly", function() {
it("Loads a non-listing-related page directly", function () {
cy.visit("http://localhost:3000/disclaimer")

// Check that the Disclaimer page banner text is present on the page
cy.contains("Endorsement Disclaimers")
})

it("Can navigate to all page types after initial site load", function() {
it("Can navigate to all page types after initial site load", function () {
cy.visit("http://localhost:3000")

// Click on the Disclaimer page link in the footer
cy.get("footer a")
.contains("Disclaimer")
.click()
cy.get("footer a").contains("Disclaimer").click()

// Should be on the disclaimer page
cy.location("pathname").should("equal", "/disclaimer")
cy.contains("Endorsement Disclaimers")

// Click on the listings page link in the header nav
cy.get(".navbar")
.contains("Listings")
.click()
cy.get(".navbar").contains("Listings").click()

// Should be on the listings page
cy.location("pathname").should("equal", "/listings")
Expand All @@ -52,9 +48,7 @@ describe("Navigating around the site", function() {
cy.get("article")
.first()
.within(() => {
cy.get("a")
.last()
.click()
cy.get("a").last().click()
})

// Should be on the listing page
Expand Down
@@ -1,10 +1,8 @@
describe("Housing counselors page", function() {
it("renders the provided list of counselors", function() {
describe("Housing counselors page", function () {
it("renders the provided list of counselors", function () {
cy.visit("http://localhost:3000/housing-counselors")
cy.contains("Housing Counselors")
cy.get("article").should("have.length.of.at.least", 1)
cy.get("article")
.first()
.contains("Language Services: ")
cy.get("article").first().contains("Language Services: ")
})
})
2 changes: 1 addition & 1 deletion apps/public-ala/layouts/application.tsx
Expand Up @@ -4,7 +4,7 @@ import { t, LocalizedLink, SiteHeader } from "@bloom-housing/ui-components"
import AlamedaFooter from "../components/AlamedaFooter"
import SVG from "react-inlinesvg"

const Layout = props => (
const Layout = (props) => (
<div>
<Head>
<title>{t("nav.siteTitle")}</title>
Expand Down
27 changes: 16 additions & 11 deletions apps/public-ala/next.config.js
Expand Up @@ -38,16 +38,16 @@ module.exports = withCSS(
env: {
listingServiceUrl: LISTING_SERVICE_URL,
mapBoxToken: MAPBOX_TOKEN,
housingCounselorServiceUrl: HOUSING_COUNSELOR_SERVICE_URL
housingCounselorServiceUrl: HOUSING_COUNSELOR_SERVICE_URL,
gtmKey: process.env.GTM_KEY || null,
},
sassLoaderOptions: {
prependData: tailwindVars
prependData: tailwindVars,
},
// exportPathMap adapted from https://github.com/zeit/next.js/blob/canary/examples/with-static-export/next.config.js
async exportPathMap() {
// we fetch our list of listings, this allow us to dynamically generate the exported pages
let listings = []

try {
const response = await axios.get(LISTING_SERVICE_URL)
listings = response.data.listings
Expand All @@ -59,10 +59,15 @@ module.exports = withCSS(
const listingPaths = listings.reduce(
(listingPaths, listing) =>
Object.assign({}, listingPaths, {
[`/listing/${listing.id}`]: {
[`/listing/${listing.id}/${listing.urlSlug}`]: {
page: "/listing",
query: { id: listing.id }
}
query: { id: listing.id },
},
// Create a redirect so that the base ID redirects to the ID with URL slug
[`/listing/${listing.id}`]: {
page: "/redirect",
query: { to: `/listing/${listing.id}/${listing.urlSlug}` },
},
}),
{}
)
Expand All @@ -72,28 +77,28 @@ module.exports = withCSS(
"/": { page: "/" },
"/listings": { page: "/listings" },
"/housing-counselors": { page: "/HousingCounselors" },
"/additional-resources": { page: "/AdditionalResources" }
"/additional-resources": { page: "/AdditionalResources" },
})
const languages = ["es"] // add new language codes here
const languagePaths = {}
Object.entries(translatablePaths).forEach(([key, value]) => {
languagePaths[key] = value
languages.forEach(language => {
languages.forEach((language) => {
const query = Object.assign({}, value.query)
query.language = language
languagePaths[`/${language}${key.replace(/^\/$/, "")}`] = {
...value,
query: query
query: query,
}
})
})

// combine the map of all various types of page paths
return Object.assign({}, languagePaths, {
"/disclaimer": { page: "/disclaimer" },
"/privacy": { page: "/privacy" }
"/privacy": { page: "/privacy" },
})
}
},
})
)
)
Expand Down
19 changes: 10 additions & 9 deletions apps/public-ala/package.json
@@ -1,6 +1,6 @@
{
"name": "@bloom-housing/public-ala",
"version": "0.0.2",
"version": "0.1.0",
"description": "Public web app reference implementation for the Bloom affordable housing system",
"main": "index.js",
"license": "GPL-3.0",
Expand All @@ -15,33 +15,34 @@
"dev:all": "concurrently \"yarn dev:listings\" \"yarn dev\""
},
"dependencies": {
"@bloom-housing/core": "^0.0.8",
"@bloom-housing/ui-components": "^0.0.8",
"@bloom-housing/core": "^0.1.0",
"@bloom-housing/ui-components": "^0.1.0",
"@mdx-js/loader": "1.5.5",
"@next/mdx": "9.2.0",
"@zeit/next-css": "^1.0.1",
"@zeit/next-sass": "^1.0.1",
"axios": "^0.19.2",
"dotenv": "^8.2.0",
"moment": "^2.24.0",
"nanoid": "^3.0.0",
"nanoid": "^3.1.7",
"next": "9.2.0",
"next-plugin-custom-babel-config": "^1.0.2",
"node-polyglot": "^2.4.0",
"node-sass": "^4.12.0",
"node-sass": "^4.14.1",
"react": "16.12.0",
"react-dom": "16.12.0",
"react-hook-form": "^5.2.0",
"react-inlinesvg": "^1.2.0"
},
"devDependencies": {
"@types/node": "^12.12.31",
"@types/node": "^12.12.39",
"@types/react": "^16.9.19",
"concurrently": "^5.1.0",
"cypress": "^4.2.0",
"concurrently": "^5.2.0",
"cypress": "^4.5.0",
"js-levenshtein": "^1.1.6",
"next-transpile-modules": "^3.0.1",
"sass-loader": "^8.0.2",
"typescript": "^3.8.3",
"webpack": "^4.42.1"
"webpack": "^4.43.0"
}
}
2 changes: 1 addition & 1 deletion apps/public-ala/page_content/locale_overrides/es.json
Expand Up @@ -5,4 +5,4 @@
"pageDescription": {
"additionalResources": "Lo alentamos a buscar otros recursos de vivienda asequible."
}
}
}
6 changes: 3 additions & 3 deletions apps/public-ala/pages/AdditionalResources.tsx
Expand Up @@ -9,12 +9,12 @@ export default () => {
const pageTitle = t("pageTitle.additionalResources")
const subTitle = t("pageDescription.additionalResources")

const LinedH4 = props => <h4 className="text-caps-underline" {...props} />
const serifEm = props => <span className="font-serif" {...props} />
const LinedH4 = (props) => <h4 className="text-caps-underline" {...props} />
const serifEm = (props) => <span className="font-serif" {...props} />

const components = {
h4: LinedH4,
em: serifEm
em: serifEm,
}

return (
Expand Down
2 changes: 1 addition & 1 deletion apps/public-ala/pages/HousingCounselors.tsx
Expand Up @@ -32,7 +32,7 @@ export default class extends Component<HousingCounselorsProps> {
<PageHeader inverse={true} subtitle={t("housingCounselors.subtitle")}>
{t("pageTitle.housingCounselors")}
</PageHeader>
{this.props.counselors.map(c => {
{this.props.counselors.map((c) => {
return (
<article key={c.name} className="flex-row flex-wrap max-w-5xl m-auto py-8 border-b-2">
<HousingCounselor counselor={c} />
Expand Down
4 changes: 2 additions & 2 deletions apps/public-ala/pages/_app.jsx
Expand Up @@ -22,8 +22,8 @@ class MyApp extends App {
es: spanishTranslations,
custom: {
general: await import("../page_content/locale_overrides/general.json"),
es: await import("../page_content/locale_overrides/es.json")
}
es: await import("../page_content/locale_overrides/es.json"),
},
}
return { pageProps, translations }
}
Expand Down
16 changes: 8 additions & 8 deletions apps/public-ala/pages/listing.tsx
Expand Up @@ -27,7 +27,7 @@ import {
getOccupancyDescription,
groupNonReservedAndReservedSummaries,
occupancyTable,
t
t,
} from "@bloom-housing/ui-components"
import Layout from "../layouts/application"

Expand All @@ -42,7 +42,7 @@ export default class extends Component<ListingProps> {

try {
const response = await axios.get(process.env.listingServiceUrl)
listing = response.data.listings.find(l => l.id == listingId)
listing = response.data.listings.find((l) => l.id == listingId)
} catch (error) {
console.log(error)
}
Expand All @@ -63,11 +63,11 @@ export default class extends Component<ListingProps> {
unitType: t("t.unitType"),
minimumIncome: t("t.minimumIncome"),
rent: t("t.rent"),
availability: t("t.availability")
availability: t("t.availability"),
}

const amiValues = listing.unitsSummarized.amiPercentages
.map(percent => {
.map((percent) => {
const percentInt = parseInt(percent, 10)
return percentInt
})
Expand All @@ -86,14 +86,14 @@ export default class extends Component<ListingProps> {
const occupancyDescription = getOccupancyDescription(listing)
const occupancyHeaders = {
unitType: t("t.unitType"),
occupancy: t("t.occupancy")
occupancy: t("t.occupancy"),
}
const occupancyData = occupancyTable(listing)

const pageTitle = `${listing.name} - ${t("nav.siteTitle")}`
const metaDescription = t("pageDescription.listing", {
regionName: t("region.name"),
listingName: listing.name
listingName: listing.name,
})
const metaImage = listing.imageUrl

Expand Down Expand Up @@ -152,8 +152,8 @@ export default class extends Component<ListingProps> {

<div className="w-full md:w-2/3 md:mt-6 md:mb-6 md:px-3 md:pr-8">
{amiValues.length > 1 &&
amiValues.map(percent => {
const byAMI = listing.unitsSummarized.byAMI.find(item => {
amiValues.map((percent) => {
const byAMI = listing.unitsSummarized.byAMI.find((item) => {
return parseInt(item.percent, 10) == percent
})

Expand Down
2 changes: 1 addition & 1 deletion apps/public-ala/pages/listings.tsx
Expand Up @@ -8,7 +8,7 @@ import {
MetaTags,
PageHeader,
openDateState,
t
t,
} from "@bloom-housing/ui-components"
import { Listing } from "@bloom-housing/core"
import Layout from "../layouts/application"
Expand Down

0 comments on commit 879c310

Please sign in to comment.