Skip to content

Commit

Permalink
SK-27: Success screen for created / imported account (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
arty-name committed Mar 17, 2021
1 parent f15d978 commit 2ecbb46
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 9 deletions.
12 changes: 9 additions & 3 deletions src/static/_locales/en/messages.json
Expand Up @@ -113,9 +113,15 @@
"message": "Next Step"
},
"view_CreateAccountSuccess_heading": {
"message": "Congratulations"
"message": "Congratulations!"
},
"view_CreateAccountSuccess_message": {
"message": "You have successfully created a KILT-Wallet"
"view_CreateAccountSuccess_message_create": {
"message": "You have successfully created a KILT Wallet"
},
"view_CreateAccountSuccess_message_import": {
"message": "You have successfully imported your KILT Wallet"
},
"view_CreateAccountSuccess_CTA": {
"message": "See the wallet"
}
}
16 changes: 16 additions & 0 deletions src/views/CreateAccountSuccess/CreateAccountSuccess.stories.tsx
@@ -0,0 +1,16 @@
import { Meta } from '@storybook/react';

import { CreateAccountSuccess } from './CreateAccountSuccess';

export default {
title: 'Views/CreateAccountSuccess',
component: CreateAccountSuccess,
} as Meta;

export function Create(): JSX.Element {
return <CreateAccountSuccess />;
}

export function Import(): JSX.Element {
return <CreateAccountSuccess type="import" />;
}
6 changes: 5 additions & 1 deletion src/views/CreateAccountSuccess/CreateAccountSuccess.test.tsx
Expand Up @@ -2,8 +2,12 @@ import { CreateAccountSuccess } from './CreateAccountSuccess';
import { render } from '../../testing';

describe('CreateAccountSuccess', () => {
it('should render', async () => {
it('should render for create', async () => {
const { container } = render(<CreateAccountSuccess />);
expect(container).toMatchSnapshot();
});
it('should render for import', async () => {
const { container } = render(<CreateAccountSuccess type="import" />);
expect(container).toMatchSnapshot();
});
});
15 changes: 13 additions & 2 deletions src/views/CreateAccountSuccess/CreateAccountSuccess.tsx
@@ -1,11 +1,22 @@
import { browser } from 'webextension-polyfill-ts';
import { Link } from 'react-router-dom';

export function CreateAccountSuccess(): JSX.Element {
interface Props {
type?: 'create' | 'import';
}

export function CreateAccountSuccess({ type = 'create' }: Props): JSX.Element {
const t = browser.i18n.getMessage;
return (
<main>
<h1>{t('view_CreateAccountSuccess_heading')}</h1>
<p>{t('view_CreateAccountSuccess_message')}</p>

<p>
{type === 'create' && t('view_CreateAccountSuccess_message_create')}
{type === 'import' && t('view_CreateAccountSuccess_message_import')}
</p>

<Link to="/">{t('view_CreateAccountSuccess_CTA')}</Link>
</main>
);
}
@@ -1,14 +1,37 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CreateAccountSuccess should render 1`] = `
exports[`CreateAccountSuccess should render for create 1`] = `
<div>
<main>
<h1>
Congratulations
Congratulations!
</h1>
<p>
You have successfully created a KILT-Wallet
You have successfully created a KILT Wallet
</p>
<a
href="/"
>
See the wallet
</a>
</main>
</div>
`;

exports[`CreateAccountSuccess should render for import 1`] = `
<div>
<main>
<h1>
Congratulations!
</h1>
<p>
You have successfully imported your KILT Wallet
</p>
<a
href="/"
>
See the wallet
</a>
</main>
</div>
`;

0 comments on commit 2ecbb46

Please sign in to comment.