Skip to content

Commit

Permalink
Aizad/WALL-4579/Change Password Button to Forgot Password Link on MT5…
Browse files Browse the repository at this point in the history
…TradeModal (deriv-com#16379)

* chore: Replace password button with Forgot Password link

* chore: update stylings

* chore: translate new string within component

* chore: remove edit svg

* chore: made changes based on comments

* chore: added optinal value string

* chore: update default value placement
  • Loading branch information
aizad-deriv authored Aug 12, 2024
1 parent ccc9735 commit 948dff7
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@
align-items: center;
gap: 0.8rem;
padding-right: 0.8rem;
font-family: 'Courier', monospace;

& .wallets-text {
font-family: 'Courier', serif;
}

& .wallets-clipboard {
border: none;
border-radius: none;
}
}

&__edit {
cursor: pointer;
&--mono-text {
font-family: 'Courier', serif;
}

&--forgot-link {
text-decoration: underline;
cursor: pointer;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,55 +1,69 @@
import React, { FC } from 'react';
import classNames from 'classnames';
import { Tooltip } from '@deriv-com/ui';
import { WalletClipboard, WalletText } from '../../../../../components/Base';
import { Localize } from '@deriv-com/translations';
import { Text, useDevice } from '@deriv-com/ui';
import { WalletClipboard } from '../../../../../components/Base';
import { useModal } from '../../../../../components/ModalProvider';
import useDevice from '../../../../../hooks/useDevice';
import EditIcon from '../../../../../public/images/ic-edit.svg';
import { ChangePassword } from '../../ChangePassword';
import './MT5TradeDetailsItem.scss';

type TMT5TradeDetailsItemProps = {
label?: string;
value: string;
value?: string;
variant?: 'clipboard' | 'info' | 'password';
};

const MT5TradeDetailsItem: FC<TMT5TradeDetailsItemProps> = ({ label, value, variant = 'clipboard' }) => {
const MT5TradeDetailsItem: FC<TMT5TradeDetailsItemProps> = ({ label, value = '', variant = 'clipboard' }) => {
const { isDesktop } = useDevice();
const { show } = useModal();

const textSize = isDesktop ? 'xs' : 'sm';

return (
<div
className={classNames('wallets-mt5-trade-details-item', {
'wallets-mt5-trade-details-item--info': variant === 'info',
})}
>
{variant !== 'info' && (
{variant === 'clipboard' && (
<React.Fragment>
<WalletText color='less-prominent' size={isDesktop ? 'xs' : 'sm'}>
<Text color='less-prominent' size={textSize}>
{label}
</WalletText>
</Text>
<div className='wallets-mt5-trade-details-item__values'>
<WalletText size={isDesktop ? 'xs' : 'sm'} weight='bold'>
<Text
className='wallets-mt5-trade-details-item__values--mono-text'
size={textSize}
weight='bold'
>
{value}
</WalletText>
{variant === 'clipboard' && <WalletClipboard popoverAlignment='left' textCopy={value} />}
{variant === 'password' && (
<Tooltip
as='button'
onClick={() => show(<ChangePassword />)}
tooltipContent='Change password'
tooltipPosition='left'
>
<EditIcon className='wallets-mt5-trade-details-item__edit' />
</Tooltip>
)}
</Text>
<WalletClipboard popoverAlignment='left' textCopy={value} />
</div>
</React.Fragment>
)}
{variant === 'password' && (
<React.Fragment>
<Text color='less-prominent' size={textSize}>
{label}
</Text>
<div className='wallets-mt5-trade-details-item__values'>
<Text
as='a'
className='wallets-mt5-trade-details-item__values--forgot-link'
onClick={() => show(<ChangePassword />)}
size={textSize}
weight='bold'
>
<Localize i18n_default_text=' Forgot Password?' />
</Text>
</div>
</React.Fragment>
)}
{variant === 'info' && (
<WalletText color='less-prominent' size={isDesktop ? 'xs' : 'sm'}>
<Text color='less-prominent' size={textSize}>
{value}
</WalletText>
</Text>
)}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@ const MT5TradeScreen: FC<MT5TradeScreenProps> = ({ mt5Account }) => {
value={details?.server_info?.environment ?? 'Deriv-Server'}
/>
<MT5TradeDetailsItem label='Login ID' value={loginId ?? '12345678'} />
<MT5TradeDetailsItem label='Password' value='********' variant='password' />
<MT5TradeDetailsItem label='Password' variant='password' />
</Fragment>
)}
{getModalState('platform') === dxtradePlatform && (
<Fragment>
<MT5TradeDetailsItem label='Username' value={details?.login ?? '12345678'} />
<MT5TradeDetailsItem label='Password' value='********' variant='password' />
<MT5TradeDetailsItem label='Password' variant='password' />
</Fragment>
)}
{getModalState('platform') === ctraderPlatform && (
Expand Down
10 changes: 0 additions & 10 deletions packages/wallets/src/public/images/ic-edit.svg

This file was deleted.

0 comments on commit 948dff7

Please sign in to comment.