From bbfda65bccacdd512bade61cfeb0c48784309725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20G=C5=82ownia?= Date: Wed, 12 Apr 2023 11:21:24 +0200 Subject: [PATCH] feat(withdraws): improve ux surrounding withdraw balances thresholds and delays (#3402) Co-authored-by: m.ray <16125548+MadalinaRaicu@users.noreply.github.com> --- libs/assets/src/lib/asset-details-table.tsx | 5 +- libs/assets/src/lib/constants.ts | 4 ++ libs/assets/src/lib/index.ts | 1 + .../components/notification/notification.tsx | 11 +++- libs/withdraws/src/lib/withdraw-form.tsx | 62 +++++++++++++++++++ libs/withdraws/src/lib/withdraw-limits.tsx | 46 ++++++++++---- .../src/lib/withdraw-manager.spec.tsx | 39 +++++++++--- package.json | 2 +- yarn.lock | 8 +-- 9 files changed, 148 insertions(+), 30 deletions(-) create mode 100644 libs/assets/src/lib/constants.ts diff --git a/libs/assets/src/lib/asset-details-table.tsx b/libs/assets/src/lib/asset-details-table.tsx index 42df743ac..5b2ec7cf8 100644 --- a/libs/assets/src/lib/asset-details-table.tsx +++ b/libs/assets/src/lib/asset-details-table.tsx @@ -11,6 +11,7 @@ import { } from '@vegaprotocol/ui-toolkit'; import type { ReactNode } from 'react'; import type { Asset } from './asset-data-provider'; +import { WITHDRAW_THRESHOLD_TOOLTIP_TEXT } from './constants'; type Rows = { key: AssetDetail; @@ -121,9 +122,7 @@ export const rows: Rows = [ { key: AssetDetail.WITHDRAWAL_THRESHOLD, label: t('Withdrawal threshold'), - tooltip: t( - 'The maximum you can withdraw instantly. There’s no limit on the size of a withdrawal, but all withdrawals over the threshold will have a delay time added to them' - ), + tooltip: WITHDRAW_THRESHOLD_TOOLTIP_TEXT, value: (asset) => num(asset, (asset.source as Schema.ERC20).withdrawThreshold), }, diff --git a/libs/assets/src/lib/constants.ts b/libs/assets/src/lib/constants.ts new file mode 100644 index 000000000..30a138ab4 --- /dev/null +++ b/libs/assets/src/lib/constants.ts @@ -0,0 +1,4 @@ +import { t } from '@vegaprotocol/i18n'; +export const WITHDRAW_THRESHOLD_TOOLTIP_TEXT = t( + "The maximum you can withdraw instantly. There's no limit on the size of a withdrawal, but all withdrawals over the threshold will have a delay time added to them" +); diff --git a/libs/assets/src/lib/index.ts b/libs/assets/src/lib/index.ts index 5f4424aab..de6516378 100644 --- a/libs/assets/src/lib/index.ts +++ b/libs/assets/src/lib/index.ts @@ -5,3 +5,4 @@ export * from './assets-data-provider'; export * from './asset-details-dialog'; export * from './asset-details-table'; export * from './asset-option'; +export * from './constants'; diff --git a/libs/ui-toolkit/src/components/notification/notification.tsx b/libs/ui-toolkit/src/components/notification/notification.tsx index 3672ba576..792cc3f09 100644 --- a/libs/ui-toolkit/src/components/notification/notification.tsx +++ b/libs/ui-toolkit/src/components/notification/notification.tsx @@ -70,6 +70,8 @@ export const Notification = ({ 'text-vega-green dark:text-vega-green': intent === Intent.Success, 'text-yellow-600 dark:text-yellow': intent === Intent.Warning, 'text-vega-pink': intent === Intent.Danger, + 'mt-1': !!title, + 'mt-[0.125rem]': !title, }, 'flex items-start mt-1' )} @@ -78,11 +80,16 @@ export const Notification = ({
{title && ( -
+
{title}
)} -
{message}
+
+ {message} +
{buttonProps && (