Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new, empty eviction free site. #1800

Merged
merged 10 commits into from
Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion common-data/site-choices.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
["JUSTFIX", "JustFix.nyc"],
["NORENT", "NoRent.org"]
["NORENT", "NoRent.org"],
["EVICTIONFREE", "EvictionFree.org"]
]
5 changes: 3 additions & 2 deletions common-data/site-choices.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// This file was auto-generated by commondatabuilder.
// Please don't edit it.

export type SiteChoice = "JUSTFIX"|"NORENT";
export type SiteChoice = "JUSTFIX"|"NORENT"|"EVICTIONFREE";

export const SiteChoices: SiteChoice[] = [
"JUSTFIX",
"NORENT"
"NORENT",
"EVICTIONFREE"
];

const SiteChoiceSet: Set<String> = new Set(SiteChoices);
Expand Down
3 changes: 3 additions & 0 deletions frontend/lib/analytics/amplitude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,8 @@ export function getAmplitudePageType(pathname: string): string {
return "JustFix " + getJustfixPageType(pathname);
case "NORENT":
return "NoRent " + getNorentPageType(pathname);
case "EVICTIONFREE":
// TODO: Return the type of page it is for EvictionFree.
return "EvictionFree";
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should file a github or clubhouse issue for this to make sure we don't forget about it.

}
}
3 changes: 3 additions & 0 deletions frontend/lib/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import { t } from "@lingui/macro";
// We're just using our infrastructure for code splitting here.
const LoadableJustfixSite = loadable(() => import("./justfix-site"));
const LoadableNorentSite = loadable(() => import("./norent/site"));
const LoadableEvictionFreeSite = loadable(() => import("./evictionfree/site"));

export type AppSiteProps = RouteComponentProps & {
ref?: React.Ref<HTMLDivElement>;
Expand Down Expand Up @@ -346,6 +347,8 @@ export class AppWithoutRouter extends React.Component<
return LoadableJustfixSite;
case "NORENT":
return LoadableNorentSite;
case "EVICTIONFREE":
return LoadableEvictionFreeSite;
}
}

Expand Down
16 changes: 16 additions & 0 deletions frontend/lib/evictionfree/homepage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Trans } from "@lingui/macro";
import React from "react";
import { Link } from "react-router-dom";
import { EvictionFreeRoutes } from "./route-info";

export const EvictionFreeHomePage: React.FC<{}> = () => (
<>
<p>
<Trans>This is a test localization message for EvictionFree.</Trans>
</p>
<p>
{/** This will eventually be replaced by a navbar link. */}
<Link to={EvictionFreeRoutes.dev.home}>Development tools</Link>
</p>
</>
);
23 changes: 23 additions & 0 deletions frontend/lib/evictionfree/route-info.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { createRoutesForSite, ROUTE_PREFIX } from "../util/route-util";
import { createDevRouteInfo } from "../dev/route-info";

function createLocalizedRouteInfo(prefix: string) {
return {
/** The locale prefix, e.g. `/en`. */
[ROUTE_PREFIX]: prefix,

/** The home page. */
home: `${prefix}/`,
};
}

export const EvictionFreeRoutes = createRoutesForSite(
createLocalizedRouteInfo,
{
/**
* Example pages used in integration tests, and other
* development-related pages.
*/
dev: createDevRouteInfo("/dev"),
}
);
Comment on lines +1 to +23
Copy link
Member

@sraby sraby Jan 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! loving the new route-info.ts name, makes it v clear

30 changes: 30 additions & 0 deletions frontend/lib/evictionfree/routes.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import loadable from "@loadable/component";
import { friendlyLoad, LoadingPage } from "../networking/loading-page";
import React from "react";
import { NotFound } from "../pages/not-found";
import { Route, RouteComponentProps, Switch } from "react-router-dom";
import { EvictionFreeRoutes as Routes } from "./route-info";
import { EvictionFreeHomePage } from "./homepage";

const LoadableDevRoutes = loadable(
() => friendlyLoad(import("../dev/routes")),
{
fallback: <LoadingPage />,
}
);

export const EvictionFreeRouteComponent: React.FC<RouteComponentProps> = (
props
) => {
const { location } = props;
if (!Routes.routeMap.exists(location.pathname)) {
return NotFound(props);
}
return (
<Switch location={location}>
<Route path={Routes.locale.home} exact component={EvictionFreeHomePage} />
<Route path={Routes.dev.prefix} component={LoadableDevRoutes} />
<Route component={NotFound} />
</Switch>
);
};
34 changes: 34 additions & 0 deletions frontend/lib/evictionfree/site.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import loadable from "@loadable/component";
import React from "react";
import { Route } from "react-router-dom";
import type { AppSiteProps } from "../app";
import { createLinguiCatalogLoader } from "../i18n-lingui";
import { LoadingOverlayManager } from "../networking/loading-page";
import { EvictionFreeRouteComponent } from "./routes";

export const EvictionFreeLinguiI18n = createLinguiCatalogLoader({
en: loadable.lib(
() => import("../../../locales/en/evictionfree.chunk") as any
),
es: loadable.lib(
() => import("../../../locales/es/evictionfree.chunk") as any
),
});

const EvictionFreeSite = React.forwardRef<HTMLDivElement, AppSiteProps>(
(props, ref) => {
return (
<EvictionFreeLinguiI18n>
<section>
<div ref={ref} data-jf-is-noninteractive tabIndex={-1}>
<LoadingOverlayManager>
<Route component={EvictionFreeRouteComponent} />
</LoadingOverlayManager>
</div>
</section>
</EvictionFreeLinguiI18n>
);
}
);

export default EvictionFreeSite;
21 changes: 21 additions & 0 deletions frontend/lib/evictionfree/tests/site.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from "react";
import { AppTesterPal } from "../../tests/app-tester-pal";
import { Route } from "react-router-dom";
import { waitFor } from "@testing-library/react";
import EvictionFreeSite from "../site";

describe("EvictionFreeSite", () => {
const route = <Route render={(props) => <EvictionFreeSite {...props} />} />;

it("renders 404 page", () => {
const pal = new AppTesterPal(route, { url: "/blarg" });
waitFor(() => pal.rr.getByText(/doesn't seem to exist/i));
});

it("renders home page", () => {
const pal = new AppTesterPal(route, { url: "/en/" });
waitFor(() =>
pal.rr.getByText(/This is a test localization message for EvictionFree/i)
);
});
});
3 changes: 3 additions & 0 deletions frontend/lib/global-site-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { RouteInfo, ROUTE_PREFIX } from "./util/route-util";
import { getGlobalAppServerInfo, AppServerInfo } from "./app-context";
import { default as JustfixRoutes } from "./justfix-route-info";
import { NorentRoutes } from "./norent/route-info";
import { EvictionFreeRoutes } from "./evictionfree/route-info";
import History from "history";

/** Common localized routes all our sites support. */
Expand Down Expand Up @@ -45,5 +46,7 @@ export function getGlobalSiteRoutes(
return JustfixRoutes;
case "NORENT":
return NorentRoutes;
case "EVICTIONFREE":
return EvictionFreeRoutes;
}
}
4 changes: 4 additions & 0 deletions frontend/lib/pages/cross-site-terms-opt-in.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export function hasLoggedInUserAgreedToTerms(s: AllSessionInfo): boolean {

case "NORENT":
return s.onboardingInfo.agreedToNorentTerms;

case "EVICTIONFREE":
// TODO: Need to figure out if we need separate terms for EvictionFree!
return s.onboardingInfo.agreedToJustfixTerms;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should file a github or clubhouse issue for this to make sure we don't forget about it.

}
}

Expand Down
3 changes: 3 additions & 0 deletions frontend/lib/ui/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ function getSiteBaseName(siteType: SiteChoice): string {

case "NORENT":
return "NoRent.org";

case "EVICTIONFREE":
return "EvictionFree.org";
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may need to change this based on what our final domain name is, so we should file an issue to address this later.

}
}

Expand Down
4 changes: 4 additions & 0 deletions frontend/lib/ui/privacy-info-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ function getURLforSite(baseURL: string, site: SiteChoice): string {

case "NORENT":
return `${baseURL}-norent`;

case "EVICTIONFREE":
// TODO: Figure out if we need a separate privacy policy / terms for EvictionFree!
return baseURL;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, file an issue to address this later.

}
}

Expand Down
8 changes: 8 additions & 0 deletions frontend/localebuilder/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ const SPLIT_CHUNK_CONFIGS: MessageCatalogSplitterChunkConfig[] = [
name: "norent",
test: (s) => s.startsWith("frontend/lib/norent/"),
},
/**
* Any strings that are *only* present in the evictionfree directory
* will go into their own chunk.
*/
{
name: "evictionfree",
test: (s) => s.startsWith("frontend/lib/evictionfree/"),
},
/**
* Any strings that are *only* present in the rh directory
* will go into their own chunk.
Expand Down
6 changes: 6 additions & 0 deletions frontend/sass/evictionfree/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@charset "utf-8";

@import "../../../node_modules/bulma/bulma.sass";
@import "../_a11y.scss";
@import "../_safe-mode.scss";
@import "../_loading-overlay.scss";
2 changes: 2 additions & 0 deletions frontend/templates/frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
{{ meta_tags }}
{% if site_type == "NORENT" %}
<link rel="stylesheet" href="{% static "frontend/styles-norent.css" %}" />
{% elif site_type == "EVICTIONFREE" %}
<link rel="stylesheet" href="{% static "frontend/styles-evictionfree.css" %}" />
{% else %}
<link rel="stylesheet" href="{% static "frontend/styles.css" %}" />
{% endif %}
Expand Down
22 changes: 13 additions & 9 deletions locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ msgstr "*Division of Housing and Community Renewal"
msgid "8 Minutes"
msgstr "8 Minutes"

#: frontend/lib/pages/cross-site-terms-opt-in.tsx:31
#: frontend/lib/pages/cross-site-terms-opt-in.tsx:34
msgid "<0/> makes use of a <1/> and <2/>, which you can review."
msgstr "<0/> makes use of a <1/> and <2/>, which you can review."

Expand Down Expand Up @@ -634,7 +634,7 @@ msgstr "Going on rent strike"
msgid "Good news!"
msgstr "Good news!"

#: frontend/lib/ui/privacy-info-modal.tsx:59
#: frontend/lib/ui/privacy-info-modal.tsx:62
msgid "Got it!"
msgstr "Got it!"

Expand Down Expand Up @@ -732,7 +732,7 @@ msgstr "How does sending this declaration help me?"
msgid "How it works"
msgstr "How it works"

#: frontend/lib/pages/cross-site-terms-opt-in.tsx:43
#: frontend/lib/pages/cross-site-terms-opt-in.tsx:46
msgid "I agree to the <0/> terms and conditions."
msgstr "I agree to the <0/> terms and conditions."

Expand Down Expand Up @@ -1229,7 +1229,7 @@ msgstr "Oklahoma"
msgid "One letter for the months between March and August when you couldn't pay rent in full."
msgstr "One letter for the months between March and August when you couldn't pay rent in full."

#: frontend/lib/app.tsx:55
#: frontend/lib/app.tsx:56
#: frontend/lib/norent/components/subscribe.tsx:41
#: frontend/lib/norent/components/subscribe.tsx:45
msgid "Oops! A network error occurred. Try again later."
Expand Down Expand Up @@ -1312,7 +1312,7 @@ msgstr "Pipes leaking"
msgid "Please <0>go back and choose a state</0>."
msgstr "Please <0>go back and choose a state</0>."

#: frontend/lib/pages/cross-site-terms-opt-in.tsx:29
#: frontend/lib/pages/cross-site-terms-opt-in.tsx:32
msgid "Please agree to our terms and conditions"
msgstr "Please agree to our terms and conditions"

Expand All @@ -1333,7 +1333,7 @@ msgstr "Please read the rest of this email carefully as it contains important in
msgid "Preview of your NoRent.org letter"
msgstr "Preview of your NoRent.org letter"

#: frontend/lib/ui/privacy-info-modal.tsx:25
#: frontend/lib/ui/privacy-info-modal.tsx:28
msgid "Privacy Policy"
msgstr "Privacy Policy"

Expand Down Expand Up @@ -1668,7 +1668,7 @@ msgstr "Tenants impacted by the COVID-19 crisis are protected from eviction for
msgid "Tennessee"
msgstr "Tennessee"

#: frontend/lib/ui/privacy-info-modal.tsx:26
#: frontend/lib/ui/privacy-info-modal.tsx:29
msgid "Terms of Use"
msgstr "Terms of Use"

Expand Down Expand Up @@ -1707,6 +1707,10 @@ msgstr "Think your apartment may be rent-stabilized? Request its official record
msgid "This building is owned by the <0>NYC Housing Authority (NYCHA)</0>."
msgstr "This building is owned by the <0>NYC Housing Authority (NYCHA)</0>."

#: frontend/lib/evictionfree/homepage.tsx:7
msgid "This is a test localization message for EvictionFree."
msgstr "This is a test localization message for EvictionFree."

#: frontend/lib/norent/letter-builder/landlord-email.tsx:20
msgid "This is optional."
msgstr "This is optional."
Expand Down Expand Up @@ -2149,7 +2153,7 @@ msgstr "Your letter was sent on {0}."
msgid "Your phone number"
msgstr "Your phone number"

#: frontend/lib/ui/privacy-info-modal.tsx:28
#: frontend/lib/ui/privacy-info-modal.tsx:31
msgid "Your privacy is very important to us!"
msgstr "Your privacy is very important to us!"

Expand Down Expand Up @@ -2200,7 +2204,7 @@ msgstr "Landlord not responding? You can take action for free to request repairs
msgid "justfix.legalDisclaimer"
msgstr "Disclaimer: The information in {website} does not constitute legal advice and must not be used as a substitute for the advice of a lawyer qualified to give advice on legal issues pertaining to housing. We can help direct you to free legal services if necessary."

#: frontend/lib/ui/privacy-info-modal.tsx:30
#: frontend/lib/ui/privacy-info-modal.tsx:33
msgid "justfix.privacyInfoModalText"
msgstr "<0>Your privacy is very important to us! Here are some important things to know:</0><1><2>Your personal information is secure.</2><3>We don’t use your personal information for profit or sell it to third parties.</3><4>We use your address to find information about your landlord and your building.</4></1><5>Our Privacy Policy enables sharing anonymized data with approved tenant advocacy organizations exclusively to help further our tenants rights mission. The Privacy Policy contains information regarding what data we collect, how we use it, and the choices you have regarding your personal information. If you’d like to read more, please review our full <6/> and <7/>.</5>"

Expand Down
Loading