Skip to content

Commit

Permalink
Enable sign in (#267)
Browse files Browse the repository at this point in the history
* Bump ssri from 6.0.1 to 6.0.2 (bloom-housing#1194)

* feature: support rent as percent income (bloom-housing#1195)

* Enable sign in and account creation

* Add translations for referral application

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Emily Jablonski <65367387+emilyjablonski@users.noreply.github.com>
  • Loading branch information
3 people authored May 4, 2021
1 parent 6490abb commit 2c45f6c
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 42 deletions.
19 changes: 9 additions & 10 deletions sites/public/layouts/application.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react"
// import React, { useContext } from "react"
// import { useRouter } from "next/router"
import React, { useContext } from "react"
import { useRouter } from "next/router"
import Head from "next/head"
import {
LocalizedLink,
Expand All @@ -9,16 +8,16 @@ import {
FooterNav,
FooterSection,
ExygyFooter,
// UserNav,
UserNav,
t,
// UserContext,
// setSiteAlertMessage,
UserContext,
setSiteAlertMessage,
} from "@bloom-housing/ui-components"
import SVG from "react-inlinesvg"

const Layout = (props) => {
// const { profile, signOut } = useContext(UserContext)
// const router = useRouter()
const { profile, signOut } = useContext(UserContext)
const router = useRouter()

const LANGUAGES =
process.env.languages?.split(",")?.map((item) => ({
Expand Down Expand Up @@ -60,7 +59,7 @@ const Layout = (props) => {
{t("nav.getAssistance")}
</LocalizedLink>
)}
{/* <UserNav
<UserNav
signedIn={!!profile}
signOut={async () => {
setSiteAlertMessage(t(`authentication.signOut.success`), "notice")
Expand All @@ -78,7 +77,7 @@ const Layout = (props) => {
<LocalizedLink href="/account/edit" className="navbar-item">
{t("nav.accountSettings")}
</LocalizedLink>
</UserNav> */}
</UserNav>
</SiteHeader>
<main id="main-content">{props.children}</main>
</div>
Expand Down
8 changes: 4 additions & 4 deletions sites/public/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ module.exports = withCSS(
},
"/disclaimer": { page: "/disclaimer" },
"/privacy": { page: "/privacy" },
// "/sign-in": { page: "/sign-in" },
// "/forgot-password": { page: "/forgot-password" },
// "/reset-password": { page: "/reset-password" },
// "/create-account": { page: "/create-account" },
"/sign-in": { page: "/sign-in" },
"/forgot-password": { page: "/forgot-password" },
"/reset-password": { page: "/reset-password" },
"/create-account": { page: "/create-account" },
"/account/applications": { page: "/account/applications" },
"/account/application": { page: "/account/application" },
"/account/edit": { page: "/account/edit" },
Expand Down
5 changes: 5 additions & 0 deletions sites/public/page_content/locale_overrides/general.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,10 @@
},
"timeout": {
"afterMessage": "We care about your security. We ended your session due to inactivity. Please start a new application to continue."
},
"referralApplication": {
"instructions": "The permanent supportive housing units are referred directly through Alameda County Coordinated Entry System. Households experiencing homelessness can call 211 in order to get connected to an Access Point to learn more about the coordinated entry system and access housing-related resources and information.",
"furtherInformation": "For further information",
"phoneNumber": "211"
}
}
20 changes: 10 additions & 10 deletions sites/public/pages/applications/review/confirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
Application confirmation with lottery number (confirmation number)
*/
import Link from "next/link"
// import { useRouter } from "next/router"
import { useRouter } from "next/router"
import {
// AppearanceStyleType,
// Button,
AppearanceStyleType,
Button,
FormCard,
imageUrlFromListing,
// UserContext,
UserContext,
t,
} from "@bloom-housing/ui-components"
import FormsLayout from "../../../layouts/forms"
Expand All @@ -18,8 +18,8 @@ import React, { useContext } from "react"

export default () => {
const { application, listing } = useContext(AppSubmissionContext)
// const { initialStateLoaded, profile } = useContext(UserContext)
// const router = useRouter()
const { initialStateLoaded, profile } = useContext(UserContext)
const router = useRouter()

const imageUrl = imageUrlFromListing(listing)

Expand Down Expand Up @@ -74,7 +74,7 @@ export default () => {
)}
</div>

{/* {initialStateLoaded && !profile && (
{initialStateLoaded && !profile && (
<div className="form-card__group">
<h3 className="form-card__paragraph-title">
{t("application.review.confirmation.createAccountTitle")}
Expand All @@ -84,10 +84,10 @@ export default () => {
{t("application.review.confirmation.createAccountParagraph")}
</p>
</div>
)} */}
)}

<div className="form-card__pager">
{/* {initialStateLoaded && !profile && (
{initialStateLoaded && !profile && (
<div className="form-card__pager-row primary">
<Button
styleType={AppearanceStyleType.primary}
Expand All @@ -98,7 +98,7 @@ export default () => {
{t("account.createAccount")}
</Button>
</div>
)} */}
)}

<div className="form-card__pager-row py-6">
<a className="lined text-tiny" href="/">
Expand Down
17 changes: 13 additions & 4 deletions sites/public/pages/listing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
LotteryResultsEvent,
OpenHouseEvent,
DownloadLotteryResults,
ReferralApplication,
} from "@bloom-housing/ui-components"
import Layout from "../layouts/application"
import moment from "moment"
Expand Down Expand Up @@ -309,10 +310,18 @@ export default class extends Component<ListingProps> {
<ApplicationStatus listing={listing} />
<DownloadLotteryResults event={lotteryResults} />
{openHouseEvents && <OpenHouseEvent events={openHouseEvents} />}
<ApplicationSection
listing={listing}
internalFormRoute="/applications/start/choose-language"
/>
{listing.applicationMethods.length > 0 ? (
<ApplicationSection
listing={listing}
internalFormRoute="/applications/start/choose-language"
/>
) : (
<ReferralApplication
phoneNumber={t("application.referralApplication.phoneNumber")}
description={t("application.referralApplication.instructions")}
title={t("application.referralApplication.furtherInformation")}
/>
)}
</div>

{openHouseEvents && (
Expand Down
1 change: 1 addition & 0 deletions ui-components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export * from "./src/page_components/listing/UnitTables"
export * from "./src/page_components/listing/listing_sidebar/ApplicationSection"
export * from "./src/page_components/listing/listing_sidebar/Apply"
export * from "./src/page_components/listing/listing_sidebar/LeasingAgent"
export * from "./src/page_components/listing/listing_sidebar/ReferralApplication"
export * from "./src/page_components/listing/listing_sidebar/SidebarAddress"
export * from "./src/page_components/listing/listing_sidebar/Waitlist"
export * from "./src/page_components/listing/listing_sidebar/WhatToExpect"
Expand Down
33 changes: 23 additions & 10 deletions ui-components/src/helpers/tableSummaries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,40 @@ export const unitSummariesTable = (summaries: UnitSummary[]) => {
<strong>{unitSummary.minIncomeRange.max}</strong>
</>
)
const rent =
unitSummary.rentRange.min == unitSummary.rentRange.max ? (
<strong>{unitSummary.rentRange.min}</strong>

const getRent = (rentMin: string, rentMax: string, percent = false) => {
const unit = percent ? `% ${t("t.income")}` : ` ${t("t.perMonth")}`
return rentMin == rentMax ? (
<>
<strong>{rentMin}</strong>
{unit}
</>
) : (
<>
<strong>{unitSummary.rentRange.min}</strong> {t("t.to")}{" "}
<strong>{unitSummary.rentRange.max}</strong>
<strong>{rentMin}</strong>
{unit} {t("t.to")} <strong>{rentMax}</strong>
{unit}
</>
)
}

// Use rent as percent income if available, otherwise use exact rent
const rent = unitSummary.rentAsPercentIncomeRange.min
? getRent(
unitSummary.rentAsPercentIncomeRange.min.toString(),
unitSummary.rentAsPercentIncomeRange.max.toString(),
true
)
: getRent(unitSummary.rentRange.min, unitSummary.rentRange.min)

return {
unitType: <strong>{t("listings.unitTypes." + unitSummary.unitType)}</strong>,
minimumIncome: (
<>
{minIncome} {t("t.perMonth")}
</>
),
rent: (
<>
{rent} {t("t.perMonth")}
</>
),
rent: <>{rent}</>,
availability: (
<>
{unitSummary.totalAvailable > 0 ? (
Expand Down
8 changes: 7 additions & 1 deletion ui-components/src/locales/general.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@
"claimant": "Claimant",
"displacedAddress": "Displaced Address"
},
"referralApplication": {
"instructions": "The permanent supportive housing units are referred directly through <COUNTY> Coordinated Entry System. Households experiencing homelessness can call <PHONE_NUMBER> in order to get connected to an Access Point to learn more about the coordinated entry system and access housing-related resources and information.",
"furtherInformation": "For further information",
"phoneNumber": "211"
},
"details": {
"applicationData": "Application Data",
"number": "Application Number",
Expand Down Expand Up @@ -738,7 +743,8 @@
"reservedTypePlural": {
"family": "families",
"senior": "seniors",
"veteran": "veterans"
"veteran": "veterans",
"specialNeeds": "special needs"
},
"reservedUnits": "Reserved Units",
"reservedUnitsDescription": "In order to qualify for these units one of the following must apply to you or someone in your household:",
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18069,9 +18069,9 @@ sshpk@^1.7.0:
tweetnacl "~0.14.0"

ssri@^6.0.0, ssri@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.1.tgz#2a3c41b28dd45b62b63676ecb74001265ae9edd8"
integrity sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==
version "6.0.2"
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.2.tgz#157939134f20464e7301ddba3e90ffa8f7728ac5"
integrity sha512-cepbSq/neFK7xB6A50KHN0xHDotYzq58wWCa5LeWqnPrHG8GzfEjO/4O8kpmcGW+oaxkvhEJCWgbgNk4/ZV93Q==
dependencies:
figgy-pudding "^3.5.1"

Expand Down

0 comments on commit 2c45f6c

Please sign in to comment.