Skip to content

Commit

Permalink
fix: Prevent coercing symbols to zero in the edit spending cap modal
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronfigueiredo committed Oct 30, 2024
1 parent 5227d6f commit 3a8039d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ export const EditSpendingCapModal = ({
decimals &&
parseInt(decimals, 10) < countDecimalDigits(customSpendingCapInputValue);

const showSpecialCharacterError = /[-+e]/.test(customSpendingCapInputValue);

return (
<Modal
isOpen={isOpenEditSpendingCapModal}
Expand Down Expand Up @@ -171,6 +173,15 @@ export const EditSpendingCapModal = ({
{t('editSpendingCapError', [decimals])}
</Text>
)}
{showSpecialCharacterError && (
<Text
variant={TextVariant.bodySm}
color={TextColor.errorDefault}
paddingTop={1}
>
{t('editSpendingCapSpecialCharError')}
</Text>
)}
<Text
variant={TextVariant.bodySm}
color={TextColor.textAlternative}
Expand All @@ -188,7 +199,10 @@ export const EditSpendingCapModal = ({
submitButtonProps={{
children: t('save'),
loading: isModalSaving,
disabled: showDecimalError,
disabled:
showDecimalError ||
showSpecialCharacterError ||
customSpendingCapInputValue === '',
}}
/>
</ModalContent>
Expand Down

0 comments on commit 3a8039d

Please sign in to comment.