Skip to content

Commit

Permalink
feat: Update additional date in reg/login prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
kriscooke committed May 25, 2020
1 parent af4e3ce commit e1050b2
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 8 deletions.
14 changes: 10 additions & 4 deletions app/components/RegistrationLoginButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import React from 'react';
import {Col, Card} from 'react-bootstrap';
import LoginButton from './LoginButton';

const RegistrationLoginButtons = () => {
interface Props {
applicationDeadline: string;
}

const RegistrationLoginButtons: React.FunctionComponent<Props> = ({
applicationDeadline
}) => {
return (
<Col md={{span: 5, offset: 1}}>
<Card style={{width: '100%', margin: '30px 0'}}>
Expand All @@ -11,9 +17,9 @@ const RegistrationLoginButtons = () => {
Apply for the CleanBC Industrial Incentive Program (CIIP)
</Card.Title>
<Card.Text style={{padding: '10px 0 10px 0'}}>
Operators must submit a CIIP application form by June 30, 2019. As
part of the application, information about the operation’s energy
use, emissions, and production is required.
Operators must submit a CIIP application form by{' '}
{applicationDeadline}. As part of the application, information about
the operation’s energy use, emissions, and production is required.
</Card.Text>
<LoginButton
style={{padding: '15px'}}
Expand Down
4 changes: 3 additions & 1 deletion app/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ export default class Index extends Component<Props> {
emissions benchmarks.
</p>
</Col>
<RegistrationLoginButtons />
<RegistrationLoginButtons
applicationDeadline={endDate.format('MMMM DD, YYYY')}
/>
</Row>

<Row style={{marginTop: '100px'}} id="value-props">
Expand Down
23 changes: 21 additions & 2 deletions app/pages/login-redirect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import {loginRedirectQueryResponse} from 'loginRedirectQuery.graphql';
import {CiipPageComponentProps} from 'next-env';
import DefaultLayout from 'layouts/default-layout';
import RegistrationLoginButtons from 'components/RegistrationLoginButtons';
import moment from 'moment-timezone';

const TIME_ZONE = 'America/Vancouver';

interface Props extends CiipPageComponentProps {
query: loginRedirectQueryResponse['query'];
}
Expand All @@ -16,13 +20,28 @@ export default class LoginRedirect extends Component<Props> {
session {
...defaultLayout_session
}
openedReportingYear {
applicationCloseTime
}
nextReportingYear {
applicationCloseTime
}
}
}
`;

render() {
const {query} = this.props;
const {session} = query || {};
const {session, openedReportingYear, nextReportingYear} = query || {};

const deadline = moment
.tz(
openedReportingYear?.applicationCloseTime ??
nextReportingYear?.applicationCloseTime,
TIME_ZONE
)
.format('MMMM DD, YYYY');

return (
<DefaultLayout
showSubheader={false}
Expand All @@ -41,7 +60,7 @@ export default class LoginRedirect extends Component<Props> {
You will be redirected to the requested page after doing so.
</p>
</Col>
<RegistrationLoginButtons />
<RegistrationLoginButtons applicationDeadline={deadline} />
</Row>
</DefaultLayout>
);
Expand Down
4 changes: 3 additions & 1 deletion app/tests/unit/pages/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ exports[`landing It matches the last accepted Snapshot 1`] = `
The CIIP helps industrial operations across the province by reducing net carbon-tax costs for facilities near world-leading emissions benchmarks.
</p>
</Col>
<RegistrationLoginButtons />
<RegistrationLoginButtons
applicationDeadline="December 30, 2019"
/>
</Row>
<Row
id="value-props"
Expand Down

0 comments on commit e1050b2

Please sign in to comment.