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

Matin/Aizad: Acuity Social Trading #6798

Merged
merged 38 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7771a2f
Acuity social trading notification implementation
matin-deriv Oct 21, 2022
f9a6639
Chore: Close notification on download
matin-deriv Oct 21, 2022
5eb3771
task: implement components in mt5 dashboard
aizad-deriv Oct 21, 2022
31df5d7
Chore: Make notification disposable and display it only in DTrader
matin-deriv Oct 25, 2022
6d20284
task: create acuity download modal and update ui store
aizad-deriv Oct 26, 2022
9cf5229
fix: remove unnecessary files and update png
aizad-deriv Oct 26, 2022
246d64f
fix: added props to acuity banner
aizad-deriv Oct 26, 2022
7db47fa
add dark close button for notification acuity
aizad-deriv Oct 26, 2022
1cdf7d4
task: create notification for acuity on mt5
aizad-deriv Oct 26, 2022
ff2d0cf
Merge branch 'matin/79302/acuity' into aizad/social-trading-acquity
aizad-deriv Oct 26, 2022
ac5e0af
Merge pull request #33 from aizad-deriv/aizad/social-trading-acquity
matin-deriv Oct 27, 2022
1bb1c47
Chore: Fix nitpicks
matin-deriv Oct 27, 2022
d6bfd59
Merge branch 'master' into matin/79302/acuity
matin-deriv Oct 27, 2022
49a4f61
Chore: Moved Acuity download modal to core and lazyload it
matin-deriv Oct 27, 2022
53bd935
Merge branch 'master' into matin/79302/acuity
matin-deriv Oct 28, 2022
70fd1c8
fix: remove extra padding on demo account
aizad-deriv Oct 28, 2022
d1ada1a
fix: fix cfd card height
aizad-deriv Oct 28, 2022
0f37276
Merge branch 'master' into matin/79302/acuity
matin-deriv Oct 31, 2022
4dd9673
Merge pull request #34 from aizad-deriv/aizad/fix-mt5/account-card
matin-deriv Oct 31, 2022
f65d8ee
Chore: Added Acuity for Demo accounts
matin-deriv Oct 31, 2022
b8f8f83
Merge branch 'master' into matin/79302/acuity
matin-deriv Oct 31, 2022
9da69a7
Merge branch 'master' into matin/79302/acuity
matin-deriv Nov 1, 2022
031b0fb
Fix: Display Acuity on MT5 dashboard
matin-deriv Nov 1, 2022
e2bb423
Fix: Display notifications on a specific platform
matin-deriv Nov 1, 2022
9c479ab
Fix: small bug
matin-deriv Nov 1, 2022
2c03129
Chore: updated a test file
matin-deriv Nov 1, 2022
a33fd70
fix: updated download link in modal
aizad-deriv Nov 1, 2022
41a6e82
Merge pull request #36 from aizad-deriv/aizad/social-trading-acquity
matin-deriv Nov 1, 2022
5584d07
Merge branch 'master' into matin/79302/acuity
matin-deriv Nov 1, 2022
0fe5da4
Chore: address code reviews
matin-deriv Nov 2, 2022
bc60eb0
Chore: address code reviews
matin-deriv Nov 2, 2022
29a270d
Fix: typo
matin-deriv Nov 2, 2022
eea407e
Chore: Display notifications for both Demo and Real accounts
matin-deriv Nov 2, 2022
519aeed
Chore: small fix
matin-deriv Nov 2, 2022
a44c69a
Chore: Display Acuity banners for all clients including EU
matin-deriv Nov 5, 2022
5c0b429
Chore: To display notification only on MT5 page
matin-deriv Nov 5, 2022
fd8ff3f
Merge branch 'master' into matin/79302/acuity
matin-deriv Nov 5, 2022
0b7802d
Chore: Added a new link for EU users
matin-deriv Nov 8, 2022
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
32 changes: 25 additions & 7 deletions packages/cfd/src/Components/cfd-account-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,18 @@ const CFDAccountCardComponent = ({
is_eu,
isEligibleForMoreDemoMt5Svg,
isEligibleForMoreRealMt5,
platform,
title,
type,
specs,
onSelectAccount,
onClickFund,
onPasswordManager,
onSelectAccount,
platform,
setIsAcuityModalOpen,
setMT5TradeAccount,
specs,
title,
toggleAccountsDialog,
toggleMT5TradeModal,
toggleShouldShowRealAccountsList,
setMT5TradeAccount,
type,
}: TCFDAccountCard) => {
const existing_data = existing_accounts_data?.length ? existing_accounts_data?.[0] : existing_accounts_data;
const all_svg_acc: DetailsOfEachMT5Loginid[] = [];
Expand Down Expand Up @@ -329,6 +330,22 @@ const CFDAccountCardComponent = ({
)}
</div>
</div>
{platform === CFD_PLATFORMS.MT5 && type.type === 'financial' && !isMobile() && is_logged_in && (
<Button
onClick={() => setIsAcuityModalOpen(true)}
className='cfd-account-card__acuity-banner'
type='button'
transparent
>
<div className='cfd-account-card__acuity-banner--wrapper'>
<Icon icon='icMt5Acuity' />
<Text as='p' size='xxs' weight='bold' color='prominent'>
<Localize i18n_default_text='Get Acuity trading tools' />
</Text>
<Icon icon='IcAddOutline' color='secondary' />
</div>
</Button>
)}
{existing_data && <div className='cfd-account-card__divider' />}

<div className='cfd-account-card__cta' style={!existing_data?.login ? { marginTop: 'auto' } : {}}>
Expand Down Expand Up @@ -676,10 +693,11 @@ const CFDAccountCardComponent = ({
);
};

const CFDAccountCard = connect(({ modules: { cfd }, client }: RootStore) => ({
const CFDAccountCard = connect(({ modules: { cfd }, client, ui }: RootStore) => ({
dxtrade_tokens: cfd.dxtrade_tokens,
isEligibleForMoreDemoMt5Svg: client.isEligibleForMoreDemoMt5Svg,
isEligibleForMoreRealMt5: client.isEligibleForMoreRealMt5,
setIsAcuityModalOpen: ui.setIsAcuityModalOpen,
setMT5TradeAccount: cfd.setMT5TradeAccount,
}))(CFDAccountCardComponent);

Expand Down
4 changes: 2 additions & 2 deletions packages/cfd/src/Components/cfd-mt5-demo-account-display.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const CFDMT5DemoAccountDisplay = ({
}, [is_logged_in, is_eu, is_eu_country, residence, platform]);

return (
<div className='cfd-demo-accounts-display' data-testid='dt_cfd_demo_accounts_display'>
<React.Fragment>
{is_loading ? (
<Loading />
) : (
Expand Down Expand Up @@ -176,7 +176,7 @@ const CFDMT5DemoAccountDisplay = ({
)}
</div>
)}
</div>
</React.Fragment>
);
};

Expand Down
3 changes: 3 additions & 0 deletions packages/cfd/src/Components/cfd-real-account-display.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ type TCFDRealAccountDisplayProps = {
account_status?: object;
openDerivRealAccountNeededModal: () => void;
should_enable_add_button?: boolean;
setIsAcuityModalOpen: (value: boolean) => void;
};

const CFDRealAccountDisplay = ({
Expand Down Expand Up @@ -88,6 +89,7 @@ const CFDRealAccountDisplay = ({
residence,
openDerivRealAccountNeededModal,
should_enable_add_button,
setIsAcuityModalOpen,
}: TCFDRealAccountDisplayProps) => {
const is_eu_user = (is_logged_in && is_eu) || (!is_logged_in && is_eu_country);

Expand Down Expand Up @@ -231,6 +233,7 @@ const CFDRealAccountDisplay = ({
toggleShouldShowRealAccountsList={toggleShouldShowRealAccountsList}
toggleAccountsDialog={toggleAccountsDialog}
toggleMT5TradeModal={toggleMT5TradeModal}
setIsAcuityModalOpen={setIsAcuityModalOpen}
/>
);

Expand Down
1 change: 1 addition & 0 deletions packages/cfd/src/Components/props.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export type TCFDAccountCard = {
toggleMT5TradeModal: (arg?: boolean) => void;
toggleShouldShowRealAccountsList?: (arg?: boolean) => void;
setMT5TradeAccount: (arg: any) => void;
setIsAcuityModalOpen: (value: boolean) => void;
};

export type TTradingPlatformAccounts = {
Expand Down
2 changes: 2 additions & 0 deletions packages/cfd/src/Containers/__tests__/cfd-dashboard.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ describe('<CFDDashboard />', () => {
onUnmount: jest.fn(),
openAccountNeededModal: jest.fn(),
openDerivRealAccountNeededModal: jest.fn(),
refreshNotifications: jest.fn(),
openPasswordModal: jest.fn(),
openTopUpModal: jest.fn(),
platform: CFD_PLATFORMS.MT5,
Expand Down Expand Up @@ -179,6 +180,7 @@ describe('<CFDDashboard />', () => {
],
setAccountType: jest.fn(),
setCFDPasswordResetModal: jest.fn(),
setIsAcuityModalOpen: jest.fn(),
setCurrentAccount: jest.fn(),
standpoint: {
financial_company: 'svg',
Expand Down
9 changes: 8 additions & 1 deletion packages/cfd/src/Containers/cfd-dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ export type TCFDDashboardProps = RouteComponentProps & {
getRealSyntheticAccountsExistingData: DetailsOfEachMT5Loginid[] | undefined
) => void;
openDerivRealAccountNeededModal: () => void;
setIsAcuityModalOpen: (value: boolean) => void;
refreshNotifications: () => void;
};

const CFDDashboard = (props: TCFDDashboardProps) => {
Expand Down Expand Up @@ -200,6 +202,7 @@ const CFDDashboard = (props: TCFDDashboardProps) => {
React.useEffect(() => {
updateActiveIndex(getIndexToSet());
openResetPassword();
props.refreshNotifications();
props.onMount();
return () => {
props.onUnmount();
Expand Down Expand Up @@ -393,6 +396,7 @@ const CFDDashboard = (props: TCFDDashboardProps) => {
getRealSyntheticAccountsExistingData,
getRealFinancialAccountsExistingData,
openDerivRealAccountNeededModal,
setIsAcuityModalOpen,
} = props;

const should_show_missing_real_account =
Expand Down Expand Up @@ -524,6 +528,7 @@ const CFDDashboard = (props: TCFDDashboardProps) => {
residence={residence}
openDerivRealAccountNeededModal={openDerivRealAccountNeededModal}
should_enable_add_button={should_enable_add_button}
setIsAcuityModalOpen={setIsAcuityModalOpen}
/>
</React.Fragment>
</div>
Expand Down Expand Up @@ -668,7 +673,7 @@ const CFDDashboard = (props: TCFDDashboardProps) => {
};

export default withRouter(
connect(({ client, modules, ui }: RootStore) => ({
connect(({ client, modules, notifications, ui }: RootStore) => ({
beginRealSignupForMt5: modules.cfd.beginRealSignupForMt5,
checkShouldOpenAccount: modules.cfd.checkShouldOpenAccount,
country: client.account_settings.residence,
Expand Down Expand Up @@ -716,6 +721,7 @@ export default withRouter(
NotificationMessages: ui.notification_messages_ui,
onMount: modules.cfd.onMount,
onUnmount: modules.cfd.onUnmount,
refreshNotifications: notifications.refreshNotifications,
toggleAccountsDialog: ui.toggleAccountsDialog,
toggleShouldShowRealAccountsList: ui.toggleShouldShowRealAccountsList,
upgradeable_landing_companies: client.upgradeable_landing_companies,
Expand All @@ -728,5 +734,6 @@ export default withRouter(
dxtrade_verification_code: client.verification_code.trading_platform_dxtrade_password_reset,
mt5_status_server: client.website_status.mt5_status,
openDerivRealAccountNeededModal: ui.openDerivRealAccountNeededModal,
setIsAcuityModalOpen: ui.setIsAcuityModalOpen,
}))(CFDDashboard)
);
62 changes: 53 additions & 9 deletions packages/cfd/src/sass/cfd-dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,41 @@
}
}

&__social-banner {
width: 100%;
background-color: var(--general-section-1);
opacity: 95%;
top: 0;
position: absolute;
z-index: 1;

&--close-icon {
position: absolute;
top: 1.6rem;
right: 1.6rem;
}

&--wrapper {
display: flex;
flex-direction: row;
gap: 2.4rem;
align-items: center;
justify-content: center;
padding: 0.8rem 0;
margin-inline: 2.4rem;

&__image {
width: 16rem;
height: 12rem;
}

&__button {
float: right;
padding: 0.8rem;
}
}
}

&__download-container {
border-top: 2px solid var(--general-section-1);
padding-top: 2rem;
Expand Down Expand Up @@ -440,7 +475,7 @@
grid-gap: 2.4rem;
justify-content: center;
padding-top: 2.4em;
height: 100%;
height: fit-content;

@include mobile {
display: flex;
Expand All @@ -451,12 +486,6 @@
}
}

.cfd-demo-accounts-display .cfd-account-card__wrapper {
@include desktop {
height: auto;
}
}

.cfd-jurisdiction-card--synthetic,
.cfd-jurisdiction-card--financial {
border: solid 1px var(--border-normal);
Expand Down Expand Up @@ -698,11 +727,10 @@
display: grid;
grid-template-rows: 1fr;
justify-content: center;
height: 100%;
height: fit-content;

@include mobile {
grid-template-rows: 1fr;
height: fit-content;

&:not(:last-child) {
margin-bottom: 2.4rem;
Expand Down Expand Up @@ -1057,6 +1085,22 @@
}
}
}

&__acuity-banner {
background: var(--general-section-1);
height: 3.4rem;
border-radius: 0.8rem;
margin: 1.6rem;

&--wrapper {
display: flex;
flex-direction: row;
align-items: center;
gap: 1.6rem;
padding: 0.8rem 2.65rem;
}
}

&__divider {
width: calc(100% - 3.2rem);
margin-left: 1.6rem;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions packages/components/src/components/icon/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ import './common/ic-clock-outline.svg';
import './common/ic-clock.svg';
import './common/ic-close-circle-red.svg';
import './common/ic-close-circle.svg';
import './common/ic-close-dark.svg';
import './common/ic-close-light.svg';
import './common/ic-cloud-upload.svg';
import './common/ic-confirm-details.svg';
Expand Down Expand Up @@ -537,6 +538,7 @@ import './flag/ic-flag-uk.svg';
import './flag/ic-flag-vi.svg';
import './flag/ic-flag-zh-cn.svg';
import './flag/ic-flag-zh-tw.svg';
import './mt5/ic-mt5-acuity.svg';
import './mt5/ic-mt5-cfd-platform.svg';
import './mt5/ic-mt5-cfds.svg';
import './mt5/ic-mt5-derived.svg';
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions packages/components/stories/icon/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ export const icons =
'IcClock',
'IcCloseCircleRed',
'IcCloseCircle',
'IcCloseDark',
'IcCloseLight',
'IcCloudUpload',
'IcConfirmDetails',
Expand Down Expand Up @@ -555,6 +556,7 @@ export const icons =
'IcFlagZhTw',
],
'mt5': [
'IcMt5Acuity',
'IcMt5CfdPlatform',
'IcMt5Cfds',
'IcMt5Derived',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ import classNames from 'classnames';
import { isMobile } from '@deriv/shared';
import { Button, Icon, Text } from '@deriv/components';

const NotificationBanner = ({ className, header, message, primary_btn, secondary_btn, img_src, img_alt, onClose }) => (
const NotificationBanner = ({
className,
header,
message,
primary_btn,
secondary_btn,
img_src,
img_alt,
onClose,
icon,
}) => (
<div
className={classNames('notification-banner', {
[`notification-banner__${className}`]: className,
Expand Down Expand Up @@ -35,7 +45,7 @@ const NotificationBanner = ({ className, header, message, primary_btn, secondary
<div className='notification-banner--right'>
<div className='notification-banner__bg' />
<img className='notification-banner__img' src={img_src} alt={img_alt} />
<Icon className='notification-banner__close-icon' icon='IcCloseLight' onClick={onClose} />
<Icon className='notification-banner__close-icon' icon={icon ?? 'IcCloseLight'} onClick={onClose} />
</div>
</div>
);
Expand All @@ -52,6 +62,7 @@ NotificationBanner.propTypes = {
text: PropTypes.string,
onClick: PropTypes.func,
}),
icon: PropTypes.string,
};

export default NotificationBanner;
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const Notification = ({ data, removeNotificationMessage }) => {
img_src={data.img_src}
img_alt={data.img_alt}
onClose={destroy}
icon={data.icon}
/>
);
case 'trustpilot':
Expand Down Expand Up @@ -176,6 +177,7 @@ Notification.propTypes = {
img_src: PropTypes.string,
is_auto_close: PropTypes.bool,
key: PropTypes.string,
icon: PropTypes.string,
message: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
message_popup: PropTypes.string,
primary_btn: PropTypes.object,
Expand Down
Loading