Skip to content

Commit

Permalink
notifications, use env jurisdiction
Browse files Browse the repository at this point in the history
  • Loading branch information
emilyjablonski committed Sep 8, 2021
1 parent d9f6ff7 commit 00c4ee5
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 12 deletions.
9 changes: 9 additions & 0 deletions backend/core/types/src/backend-swagger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3521,6 +3521,9 @@ export interface Jurisdiction {

/** */
name: string

/** */
notificationsSignUpURL?: string
}

export interface User {
Expand Down Expand Up @@ -3734,6 +3737,9 @@ export interface PaginatedUserList {
export interface JurisdictionCreate {
/** */
name: string

/** */
notificationsSignUpURL?: string
}

export interface JurisdictionUpdate {
Expand All @@ -3748,6 +3754,9 @@ export interface JurisdictionUpdate {

/** */
name: string

/** */
notificationsSignUpURL?: string
}

export interface ListingFilterParams {
Expand Down
45 changes: 33 additions & 12 deletions sites/public/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import {
AlertBox,
LinkButton,
Hero,
MarkdownSection,
t,
SiteAlert,
ActionBlock,
Icon,
} from "@bloom-housing/ui-components"
import Layout from "../layouts/application"
import axios from "axios"
Expand All @@ -17,6 +18,7 @@ import { MetaTags } from "../src/MetaTags"

interface IndexProps {
listings: Listing[]
notificationsSignUpURL?: string
}

export default function Home(props: IndexProps) {
Expand Down Expand Up @@ -62,14 +64,29 @@ export default function Home(props: IndexProps) {
listings={props.listings}
/>
<div className="homepage-extra">
<MarkdownSection fullwidth={true}>
<>
<p>{t("welcome.seeMoreOpportunities")}</p>
<LinkButton href="/additional-resources">
{props.notificationsSignUpURL && (
<ActionBlock
header={t("welcome.signUp")}
icon={<Icon size="3xl" symbol="mail" />}
actions={[
<LinkButton
key={"sign-up"}
href={"https://github.com/bloom-housing/bloom/pull/1800/files"}
>
{t("welcome.signUpToday")}
</LinkButton>,
]}
/>
)}
<ActionBlock
header={t("welcome.seeMoreOpportunities")}
icon={<Icon size="3xl" symbol="building" />}
actions={[
<LinkButton href="/additional-resources" key={"additional-resources"}>
{t("welcome.viewAdditionalHousing")}
</LinkButton>
</>
</MarkdownSection>
</LinkButton>,
]}
/>
</div>
<ConfirmationModal
setSiteAlertMessage={(alertMessage, alertType) => setAlertInfo({ alertMessage, alertType })}
Expand All @@ -80,8 +97,9 @@ export default function Home(props: IndexProps) {

export async function getStaticProps() {
let listings = []
let notificationsSignUpURL = null
try {
const response = await axios.get(process.env.listingServiceUrl, {
const listingsResponse = await axios.get(process.env.listingServiceUrl, {
params: {
view: "base",
limit: "all",
Expand All @@ -96,11 +114,14 @@ export async function getStaticProps() {
return qs.stringify(params)
},
})

listings = response?.data?.items ? response.data.items : []
const jurisdictions = await axios.get(`${process.env.backendApiBase}/jurisdictions/list`)
const jurisdiction = process.env.jurisdictionName
const thisJurisdiction = jurisdictions?.data?.find((juris) => juris.name === jurisdiction)
notificationsSignUpURL = thisJurisdiction.notificationsSignUpURL
listings = listingsResponse?.data?.items ? listingsResponse.data.items : []
} catch (error) {
console.error(error)
}

return { props: { listings }, revalidate: process.env.cacheRevalidate }
return { props: { listings, notificationsSignUpURL }, revalidate: process.env.cacheRevalidate }
}
6 changes: 6 additions & 0 deletions ui-components/src/global/homepage.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
.homepage-extra {
@apply text-center;
@apply text-base;
@apply flex;
@apply flex-col;
@apply justify-center;
@apply items-center;

@screen md {
@apply text-lg;
@apply flex-row;
@apply justify-around;
}
}
2 changes: 2 additions & 0 deletions ui-components/src/locales/general.json
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,8 @@
"seeRentalListings": "See Rentals",
"title": "Apply for affordable housing in",
"seeMoreOpportunities": "See more rental and ownership housing opportunities",
"signUp": "Get emailed whenever a new listing is posted",
"signUpToday": "Sign up today",
"viewAdditionalHousing": "View Additional Housing Opportunities and Resources"
},
"whatToExpect": {
Expand Down

0 comments on commit 00c4ee5

Please sign in to comment.