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

Fix: derived and forex account limits structure #6856

Merged
merged 1 commit into from
Nov 4, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';
import classNames from 'classnames';
import { Text } from '@deriv/components';

const AccountLimitsTableCell = ({ align, children, is_hint, renderExtraInfo }) => {
const AccountLimitsTableCell = ({ align, children, is_hint, level, renderExtraInfo }) => {
const text_size = is_hint ? 'xxxs' : 'xxs';

return (
Expand All @@ -12,6 +12,7 @@ const AccountLimitsTableCell = ({ align, children, is_hint, renderExtraInfo }) =
className={classNames('da-account-limits__table-cell', {
'da-account-limits__table-cell--left': align !== 'right',
'da-account-limits__table-cell--right': align === 'right',
'da-account-limits__table-cell--submarket': level === 'submarket',
})}
data-testid='account_limit_table_cell'
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const AccountLimitsTurnoverLimitRow = ({ collection, title }) => {

return collection.map(item => (
<tr key={item.name} data-testid='account-limits-turnover-limit-row'>
<AccountLimitsTableCell>
<AccountLimitsTableCell level={item.level}>
{title && `${title} - `}
{item.name}
</AccountLimitsTableCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,8 @@ const AccountLimits = ({
}

const { commodities, forex, indices, synthetic_index } = { ...market_specific };
const forex_ordered = forex?.slice().sort((a, b) => (a.name < b.name ? 1 : -1));

if (forex_ordered && forex_ordered.push) {
forex_ordered.push(forex_ordered.shift());
}
const forex_ordered = forex?.slice().sort((a, b) => (a.name > b.name ? 1 : b.name > a.name ? -1 : 0));
const derived_ordered = synthetic_index?.slice().sort((b, a) => (a.level < b.level ? 1 : -1));

const context_value = {
currency,
Expand Down Expand Up @@ -207,12 +204,9 @@ const AccountLimits = ({
</thead>
<tbody>
<AccountLimitsTurnoverLimitRow collection={commodities} />
<AccountLimitsTurnoverLimitRow
collection={forex_ordered}
title={localize('Forex')}
/>
<AccountLimitsTurnoverLimitRow collection={forex_ordered} />
<AccountLimitsTurnoverLimitRow collection={indices} />
<AccountLimitsTurnoverLimitRow collection={synthetic_index} />
<AccountLimitsTurnoverLimitRow collection={derived_ordered} />
</tbody>
</table>
{/* We only show "Withdrawal Limits" on account-wide settings pages. */}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
&--right {
text-align: right;
}
&--submarket {
padding-left: 1rem;
}
}

&-wrapper {
Expand Down