Skip to content

Commit

Permalink
Itvr 242 - household login (bcgov#67)
Browse files Browse the repository at this point in the history
* -moves login scss into its own page and out of eligibility.scss
-adds spouse login
-moves whats needed into its own component
-adds some conditional text to bottom banner

* -moves household component into page
-moves whatsneededtoapply component into the eligibility page and the household page,

* -adds useSearchParams for grabbing application id  for household form
-adds page for household form
-redirects to that page after bceid login
  • Loading branch information
emi-hi authored Apr 12, 2022
1 parent 07000ef commit 4e26226
Show file tree
Hide file tree
Showing 9 changed files with 227 additions and 86 deletions.
17 changes: 13 additions & 4 deletions frontend/src/components/BottomBanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@ import Box from '@mui/material/Box';
import React from 'react';
import { useKeycloak } from '@react-keycloak/web';
const BottomBanner = (props) => {
const { eligible } = props;
const { eligible, text = '', type = '', householdApplicationId = '' } = props;
const { keycloak } = useKeycloak();
const redirectUri = householdApplicationId
? `${window.location.origin}/householdForm/${householdApplicationId}`
: `${window.location.origin}/form`;
return (
<>
<div id="start-application">
<h1 id="start-text">Start your rebate application</h1>
<div
className={
type === 'individual'
? 'start-application-individual'
: 'start-application-spouse'
}
>
<h1 id="start-text">{text}</h1>
<Box id="bceid-login-square">
<h1 id="BceidLoginTitle">BCeID</h1>
<button
Expand All @@ -17,7 +26,7 @@ const BottomBanner = (props) => {
onClick={() =>
keycloak.login({
idpHint: 'bceid-basic',
redirectUri: `${window.location.origin}/form`
redirectUri: redirectUri
})
}
>
Expand Down
77 changes: 44 additions & 33 deletions frontend/src/components/Eligibility/EligibilityPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,33 @@ import EligibilityQuestions from './EligibilityQuestions';
import RebateTable from '../RebateTable';
import { useKeycloak } from '@react-keycloak/web';
import BottomBanner from '../BottomBanner';
import Box from '@mui/material/Box';

const EligibilityPage = (props) => {
const { taxYear, questions, setQuestions, handleCheckboxChange, eligible } =
props;
const { keycloak } = useKeycloak();

return (
const title = <h3>What you will need to complete this application</h3>;
const applicationText = (
<div>
<ul>
<li>Your Driver's Licence number to be associated with the rebate.</li>
<li>
A Basic BCeID, an image of your B.C. Driver's Licence and a secondary
piece of ID to upload.
</li>
<li>
Your Social Insurance Number and CRA income disclosure consent to
confirm your income.
</li>
</ul>
For a household application your spouse or common law partner will also
need to confirm their identity and provide CRA income disclosure consent,
they do not require a driver's licence.
</div>
);
return (
<Box>
<div>
<p>
Rebates of up to $4,000 are available from the B.C. Government towards
Expand All @@ -34,38 +53,30 @@ const EligibilityPage = (props) => {
</ol>
</div>
<RebateTable taxYear={taxYear} />
<Box sx={{ mt: 5, mb: 0 }}>
<h3>Determine your eligibility for a rebate</h3>
{questions.map((question, index) => (
<EligibilityQuestions
key={index}
question={question}
index={index}
setQuestions={setQuestions}
handleCheckboxChange={handleCheckboxChange}
/>
))}
</Box>

<h3>Determine your eligibility for a rebate</h3>
{questions.map((question, index) => (
<EligibilityQuestions
key={index}
question={question}
index={index}
setQuestions={setQuestions}
handleCheckboxChange={handleCheckboxChange}
/>
))}
<div id="whats-needed">
<h3>What you will need to complete this application</h3>
<ul>
<li>
Your Driver's Licence number to be associated with the rebate.
</li>
<li>
A Basic BCeID, an image of your B.C. Driver's Licence and a
secondary piece of ID to upload.
</li>
<li>
Your Social Insurance Number and CRA income disclosure consent to
confirm your income.
</li>
</ul>
For a household application your spouse or common law partner will
also need to confirm their identity and provide CRA income disclosure
consent, they do not require a driver's licence.
</div>
<Box sx={{ mt: 5, mb: 0 }} className="whats-needed-individual">
{title}
{applicationText}
</Box>
</div>
<BottomBanner eligible={eligible} taxYear={taxYear} />
<BottomBanner
eligible={eligible}
taxYear={taxYear}
text="Start your rebate application"
type="individual"
/>
<div className="asterisk-text">
<p>
* UP Until June 30 your {taxYear} notice of assessment (NOA) will be
Expand All @@ -87,7 +98,7 @@ const EligibilityPage = (props) => {
Login with IDIR
</button>
</div>
</div>
</Box>
);
};

Expand Down
26 changes: 26 additions & 0 deletions frontend/src/pages/ HouseholdForm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import jwt_decode from 'jwt-decode';
import Form from '../components/Form';
import { useKeycloak } from '@react-keycloak/web';
import Layout from '../components/Layout';
import { useSearchParams } from 'react-router-dom';

const HouseholdFormPage = () => {
const [searchParams, setSearchParams] = useSearchParams();
const householdApplicationId = searchParams.get('householdApplication');
const { keycloak } = useKeycloak();
// we can validate the token server side
const decoded = jwt_decode(keycloak.token);

return (
<div>
Hello BCeID {decoded.preferred_username}
<Layout>
application id {householdApplicationId}
<Form />
</Layout>
</div>
);
};

export default HouseholdFormPage;
48 changes: 48 additions & 0 deletions frontend/src/pages/Household.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import React from 'react';
import BottomBanner from '../components/BottomBanner';
import Layout from '../components/Layout';
import { useSearchParams } from 'react-router-dom';

const HouseholdPage = () => {
const [searchParams, setSearchParams] = useSearchParams();
const householdApplicationId = searchParams.get('householdApplication');

const title = (
<>
<h3>Complete your rebate application for your household</h3>
<h5>What you will need to complete this application</h5>
</>
);
const applicationText = (
<div>
<ul>
<li>A Basic BCeID.</li>
<li>An image of your B.C. Driver's Licence or B.C. Services Card.</li>
<li>An image of a secondary piece of ID.</li>
<li>
Your Social Insurance Number and CRA income disclosure consent to
confirm your income.
</li>
</ul>
</div>
);

return (
<Layout>
<div>
<div className="whats-needed-spouse">
{title}
{applicationText}
</div>
<BottomBanner
eligible={true}
text="Complete your rebate application"
type="spouse"
householdApplicationId={householdApplicationId}
/>
</div>
</Layout>
);
};

export default HouseholdPage;
11 changes: 11 additions & 0 deletions frontend/src/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import HomePage from '../pages';
import FormPage from '../pages/Form';
import AdminPage from '../pages/admin';
import ApplicationSummaryPage from '../pages/ApplicationSummary';
import HouseholdPage from '../pages/Household';
import HouseholdFormPage from '../pages/ HouseholdForm';

const RequireAuth = ({ children, redirectTo }) => {
const { keycloak } = useKeycloak();
Expand Down Expand Up @@ -40,6 +42,15 @@ const AppRouter = () => (
</RequireAuth>
}
/>
<Route path="/household" element={<HouseholdPage />} />
<Route
path="/householdForm"
element={
<RequireAuth redirectTo="/">
<HouseholdFormPage />
</RequireAuth>
}
/>
<Route
path="/admin"
element={
Expand Down
11 changes: 11 additions & 0 deletions frontend/src/stories/HouseholdLogin.stories.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

import HouseholdPage from '../pages/Household';

export default {
title: 'ITVR/Household',
component: HouseholdPage
};

const Template = (args) => <HouseholdPage {...args} />;
export const Default = Template.bind({});
48 changes: 1 addition & 47 deletions frontend/src/styles/EligibilityPage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,61 +16,15 @@ td {
margin-bottom: 2rem;
}
}
#whats-needed {
padding: 2rem 8rem 2rem 8rem;
margin-top: 2rem;
background: $background-grey-light;
}
#start-text {
margin-top: 2rem;
margin-bottom: 2rem;
}
#start-application {
margin-top: -2rem;
background-image: url('./images/body-graphic.svg');
background-color: $background-grey-light;
background-repeat: no-repeat;
background-position: top center;
background-size: cover;
padding-left: 6rem;
padding-top: 6rem;
min-height: 75vh;
}

.asterisk-text {
background-color: $background-grey-light;
p {
margin-top: 0;
}
}
@media (max-width: 820px) {
#whats-needed {
padding: 0;
}
.asterisk-text {
background-color: $white;
}
#start-application {
background-image: none;
margin: 0;
padding: 2rem 0 0.5rem;
min-height: 30vh;
#start-text {
margin-top: 0;
color: $text-heading-blue;
}
#bceid-login-square {
width: 15rem;
height: 15rem;
margin-left: auto;
margin-right: auto;
#BceidLoginTitle {
color: $white;
margin-bottom: 0.5rem;
}
.button {
font-size: 1.5rem;
margin-top: 0.5rem;
}
}
}
}
68 changes: 68 additions & 0 deletions frontend/src/styles/Login.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
.whats-needed {
&-individual,
&-spouse {
padding: 2rem 8rem 2rem 8rem;
margin-top: 2rem;
}
&-individual {
background: $background-grey-light;
}
&-spouse {
background: $white;
}
}

.start-application {
&-individual,
&-spouse {
margin-top: -2rem;
background-image: url('./images/body-graphic.svg');

background-repeat: no-repeat;
background-position: top center;
background-size: cover;
padding-left: 6rem;
padding-top: 6rem;
min-height: 75vh;
}
&-individual {
background-color: $background-grey-light;
}
&-spouse {
background-color: $white;
}

#start-text {
margin-top: 2rem;
margin-bottom: 2rem;
}
}
@media (max-width: 820px) {
#whats-needed {
padding: 0;
}
#start-application {
background-image: none;
margin: 0;
padding: 2rem 0 0.5rem;
min-height: 30vh;
#start-text {
margin-top: 0;
color: $text-heading-blue;
}
#bceid-login-square {
width: 15rem;
height: 15rem;
margin-left: auto;
margin-right: auto;
#BceidLoginTitle {
color: $white;
margin-bottom: 0.5rem;
}
.button {
font-size: 1.5rem;
margin-top: 0.5rem;
}
}
}
}
Loading

0 comments on commit 4e26226

Please sign in to comment.