From 6eaea3e7555880f6e4b4eb70d2597deeffbc7eab Mon Sep 17 00:00:00 2001 From: alter-eggo Date: Sat, 9 Mar 2024 22:45:47 +0400 Subject: [PATCH] fix: sip10 token default max length, closes #4930 --- .../send/send-crypto-asset-form/components/amount-field.tsx | 6 +++++- .../form/stacks-sip10/sip10-token-send-form-container.tsx | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/pages/send/send-crypto-asset-form/components/amount-field.tsx b/src/app/pages/send/send-crypto-asset-form/components/amount-field.tsx index c73c7aafa26..56e6e168bd7 100644 --- a/src/app/pages/send/send-crypto-asset-form/components/amount-field.tsx +++ b/src/app/pages/send/send-crypto-asset-form/components/amount-field.tsx @@ -40,6 +40,7 @@ interface AmountFieldProps { switchableAmount?: React.JSX.Element; tokenSymbol?: string; onSetIsSendingMax?(value: boolean): void; + tokenMaxLength?: number; } export function AmountField({ autoComplete = 'on', @@ -50,6 +51,7 @@ export function AmountField({ onSetIsSendingMax, switchableAmount, tokenSymbol, + tokenMaxLength, }: AmountFieldProps) { const [field, meta, helpers] = useField('amount'); @@ -61,7 +63,9 @@ export function AmountField({ const { decimals } = balance; const symbol = tokenSymbol || balance.symbol; - const maxLength = decimals === 0 ? maxLengthDefault : decimals + 2; + + const maxLength = tokenMaxLength || (decimals === 0 ? maxLengthDefault : decimals + 2); + const fontSizeModifier = (maxFontSize - minFontSize) / maxLength; const subtractedLengthToPositionPrefix = 0.5; diff --git a/src/app/pages/send/send-crypto-asset-form/form/stacks-sip10/sip10-token-send-form-container.tsx b/src/app/pages/send/send-crypto-asset-form/form/stacks-sip10/sip10-token-send-form-container.tsx index 607a132e312..6d8d5897f74 100644 --- a/src/app/pages/send/send-crypto-asset-form/form/stacks-sip10/sip10-token-send-form-container.tsx +++ b/src/app/pages/send/send-crypto-asset-form/form/stacks-sip10/sip10-token-send-form-container.tsx @@ -33,6 +33,7 @@ export function Sip10TokenSendFormContainer({ } tokenSymbol={symbol} autoComplete="off" + tokenMaxLength={Infinity} /> ); const selectedAssetField = (