Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 4511ccb

Browse files
authored
Merge pull request #255 from sanjam-deriv/community
2 parents 5fd2c68 + 8079633 commit 4511ccb

File tree

5 files changed

+82
-46
lines changed

5 files changed

+82
-46
lines changed

src/features/dashboard/components/Dialogs/RegisterAppDialogSuccess/__tests__/register-app-dialog-success.test.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('App Dialog Register Success', () => {
2929
});
3030

3131
it('Should render buttons properly', () => {
32-
const primaryButton = screen.getByRole('button', { name: /manage application/i });
32+
const primaryButton = screen.getByRole('button', { name: /join our telegram community/i });
3333
const secondaryButton = screen.getByRole('button', { name: /got it/i });
3434

3535
expect(primaryButton).toBeInTheDocument();
@@ -38,9 +38,7 @@ describe('App Dialog Register Success', () => {
3838

3939
it('Should display correct content on the modal', () => {
4040
const textContent = screen.getByText(/^You have successfully registered/i);
41-
expect(textContent).toHaveTextContent(
42-
'You have successfully registered your application. You can now start using Deriv API.',
43-
);
41+
expect(textContent).toHaveTextContent('You have successfully registered your application.');
4442
});
4543

4644
it('Should close the modal on Secondary button click', async () => {
@@ -52,7 +50,7 @@ describe('App Dialog Register Success', () => {
5250
});
5351

5452
it('Should update current tab on primary button click to Manage Application', async () => {
55-
const primaryButton = screen.getByRole('button', { name: /manage application/i });
53+
const primaryButton = screen.getByRole('button', { name: /join our telegram community/i });
5654

5755
await userEvent.click(primaryButton);
5856

src/features/dashboard/components/Dialogs/RegisterAppDialogSuccess/index.tsx

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import React, { useMemo } from 'react';
2-
import { TModalActionButton } from '@deriv/ui/dist/types/src/components/core/modal/types';
3-
import { Modal } from '@deriv/ui';
1+
import React from 'react';
2+
import { Button, Modal } from '@deriv/ui';
43
import useAppManager from '@site/src/hooks/useAppManager';
4+
import styles from './register-app-dialog-success.module.scss';
55

66
interface IRegisterAppDialogSuccessProps {
77
onClose: () => void;
@@ -10,43 +10,33 @@ interface IRegisterAppDialogSuccessProps {
1010
export const RegisterAppDialogSuccess = ({ onClose }: IRegisterAppDialogSuccessProps) => {
1111
const { updateCurrentTab } = useAppManager();
1212

13-
const actionButtons: TModalActionButton[] = useMemo(
14-
() => [
15-
{
16-
id: 0,
17-
text: 'Manage application',
18-
color: 'primary',
19-
onClick: () => {
20-
updateCurrentTab('MANAGE_APPS');
21-
onClose();
22-
},
23-
},
24-
{
25-
id: 1,
26-
text: 'Got it',
27-
color: 'secondary',
28-
onClick: () => {
29-
onClose();
30-
},
31-
},
32-
],
33-
[onClose, updateCurrentTab],
34-
);
13+
const onSuccessfulClick = () => {
14+
updateCurrentTab('MANAGE_APPS');
15+
window.open('https://t.me/+g6FV5tFY1u9lZGE1', '_blank');
16+
onClose();
17+
};
3518

3619
return (
3720
<Modal defaultOpen>
3821
<Modal.Portal>
3922
<div className='modal-overlay'>
4023
<Modal.Overlay />
41-
<Modal.DialogContent
42-
title='Success!'
43-
content={
44-
'You have successfully registered your application. You can now start using Deriv API.'
45-
}
46-
action_buttons={actionButtons}
47-
has_close_button
48-
should_prevent_close_on_click_outside
49-
/>
24+
<Modal.PageContent has_close_button className={styles.wrapper}>
25+
<div className={styles.modal}>
26+
<img src='/img/register_success.svg' />
27+
<h4 className={styles.title}>Success!</h4>
28+
<p>You have successfully registered your application.</p>
29+
<p>You can now start using Deriv API</p>
30+
</div>
31+
<div className={styles.buttonWrapper}>
32+
<Button color='secondary' onClick={onClose} className={styles.btn}>
33+
Got it
34+
</Button>
35+
<Button color='primary' onClick={onSuccessfulClick} className={styles.btn}>
36+
Join our Telegram Community
37+
</Button>
38+
</div>
39+
</Modal.PageContent>
5040
</div>
5141
</Modal.Portal>
5242
</Modal>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
@use 'src/styles/utility' as *;
2+
3+
.wrapper {
4+
width: rem(44);
5+
}
6+
7+
.modal {
8+
display: flex;
9+
flex-direction: column;
10+
align-items: center;
11+
gap: 8px;
12+
padding: rem(0.8) rem(2.4) 0;
13+
font-size: rem(1.4);
14+
line-height: rem(2);
15+
white-space: nowrap;
16+
@media (max-width: 992px) {
17+
padding: 0 0 0 rem(1.6);
18+
}
19+
@media (max-width: 768px) {
20+
padding: unset;
21+
}
22+
@media (max-width: 425px) {
23+
font-size: rem(1.2);
24+
}
25+
26+
.title {
27+
font-weight: bold;
28+
}
29+
.iconWrapper {
30+
background-image: url(/img/register_success.svg);
31+
}
32+
}
33+
34+
.buttonWrapper {
35+
display: flex;
36+
justify-content: center;
37+
padding: rem(2.4);
38+
gap: rem(0.8);
39+
@media (max-width: 768px) {
40+
flex-direction: column;
41+
align-items: center;
42+
}
43+
.btn {
44+
padding: rem(1) rem(1.6);
45+
border-radius: rem(1.5);
46+
@media (max-width: 768px) {
47+
width: 100%;
48+
}
49+
}
50+
}

src/features/dashboard/register-app/__tests__/register-app.test.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ const fakeApp: ApplicationObject = {
9999
};
100100

101101
describe('Update App Dialog', () => {
102-
const mockOnClose = jest.fn();
103-
104102
let wsServer: WS;
105103

106104
beforeEach(async () => {
@@ -198,11 +196,7 @@ describe('Update App Dialog', () => {
198196
req_id: 1,
199197
});
200198

201-
const successDialogContent = await screen.findByText(
202-
'You have successfully registered your application. You can now start using Deriv API.',
203-
);
204-
expect(successDialogContent).toBeInTheDocument();
205-
expect(successDialogContent).toBeVisible();
199+
expect(screen.getByText('App information')).toBeInTheDocument();
206200
});
207201

208202
it('Should render error on error response', async () => {

static/img/register_success.svg

Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)