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

2117 Notice Page Feature Flag #57

Merged
merged 1 commit into from
Aug 25, 2023
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
10 changes: 9 additions & 1 deletion packages/applicant/src/pages/index.page.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ describe('getServerSideProps', () => {
expect(response).toEqual({
props: {
loginUrl: getLoginUrl(),
oneLoginEnabled: process.env.ONE_LOGIN_ENABLED,
registerUrl: `${process.env.USER_SERVICE_URL}/register`,
},
});
});
});

const loginUrl = getLoginUrl();
const oneLoginEnabled = 'true';
const registerUrl = 'a-register-url';

describe('Apply for a grant home page', () => {
beforeEach(async () => {
Expand All @@ -26,7 +30,11 @@ describe('Apply for a grant home page', () => {
pathname: `/`,
})}
>
<Home loginUrl={loginUrl} />
<Home
loginUrl={loginUrl}
oneLoginEnabled={oneLoginEnabled}
registerUrl={registerUrl}
/>
</RouterContext.Provider>
);
});
Expand Down
114 changes: 83 additions & 31 deletions packages/applicant/src/pages/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ export const getServerSideProps: GetServerSideProps = () => {
return Promise.resolve({
props: {
loginUrl: getLoginUrl(),
registerUrl: `${process.env.USER_SERVICE_URL}/register`,
oneLoginEnabled: process.env.ONE_LOGIN_ENABLED,
},
});
};

type HomePageProps = {
loginUrl: string;
registerUrl: string;
oneLoginEnabled: string;
};

function HomePage({ loginUrl }: HomePageProps) {
function HomePage({ loginUrl, registerUrl, oneLoginEnabled }: HomePageProps) {
const { publicRuntimeConfig } = getConfig();
return (
<>
Expand All @@ -36,37 +40,85 @@ function HomePage({ loginUrl }: HomePageProps) {
funding organisations make a decision about who to award funding
to.
</p>
<p className="govuk-body">
You use GOV.UK One Login to sign into Find a grant. If you do not
have a One Login account already, you will need to create one.
</p>
<p className="govuk-body">
If you have used Find a grant before, you will still be able to
see all of your information when you register or sign in using One
Login using the same email address.
</p>
<Link href={loginUrl}>
<a
role="button"
draggable="false"
className="govuk-button govuk-button--start govuk-heading-m govuk-!-margin-bottom-4"
data-module="govuk-button"
data-cy="cy-apply-register-button"
>
Sign in with One Login
<svg
className="govuk-button__start-icon"
xmlns="http://www.w3.org/2000/svg"
width="17.5"
height="19"
viewBox="0 0 33 40"
aria-hidden="true"
focusable="false"
{oneLoginEnabled == 'true' ? (
<>
<p className="govuk-body">
You use GOV.UK One Login to sign into Find a grant. If you do
not have a One Login account already, you will need to create
one.
</p>
<p className="govuk-body">
If you have used Find a grant before, you will still be able
to see all of your information when you register or sign in
using One Login using the same email address.
</p>
<Link href={loginUrl}>
<a
role="button"
draggable="false"
className="govuk-button govuk-button--start govuk-heading-m govuk-!-margin-bottom-4"
data-module="govuk-button"
data-cy="cy-apply-register-button"
>
Sign in with One Login
<svg
className="govuk-button__start-icon"
xmlns="http://www.w3.org/2000/svg"
width="17.5"
height="19"
viewBox="0 0 33 40"
aria-hidden="true"
focusable="false"
>
<path
fill="currentColor"
d="M0 0h13l20 20-20 20H0l20-20z"
/>
</svg>
</a>
</Link>
</>
) : (
<>
<p className="govuk-body">
If you have an account you can sign in. If you do not have an
account you can register for one.
</p>
<Link href={registerUrl}>
<a
role="button"
draggable="false"
className="govuk-button govuk-button--start govuk-heading-m govuk-!-margin-bottom-4"
data-module="govuk-button"
data-cy="cy-apply-register-button"
>
Register
<svg
className="govuk-button__start-icon"
xmlns="http://www.w3.org/2000/svg"
width="17.5"
height="19"
viewBox="0 0 33 40"
aria-hidden="true"
focusable="false"
>
<path
fill="currentColor"
d="M0 0h13l20 20-20 20H0l20-20z"
/>
</svg>
</a>
</Link>
<hr className="govuk-section-break"></hr>
<a
href={loginUrl}
className="govuk-link govuk-link--no-visited-state govuk-!-font-size-19"
data-cy="cy-apply-existing-account-link"
>
<path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z" />
</svg>
</a>
</Link>
I already have an account
</a>
</>
)}
<h2
className="govuk-heading-m govuk-!-margin-top-8"
data-testid="find-a-grant-heading"
Expand Down
Loading