Skip to content

Commit

Permalink
fix: send crash
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsimao committed Jul 22, 2024
1 parent 643e6bd commit 3a55488
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 330 deletions.
6 changes: 3 additions & 3 deletions apps/hybrid-pay/src/lib/form/yup.custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { isAddress } from 'viem';

yup.addMethod<yup.StringSchema>(yup.string, 'requiredAmount', function (action: string, customMessage?: string) {
return this.transform((value) => (isNaN(value) ? undefined : value)).test('requiredAmount', (value, ctx) => {
if (value === undefined) {
if (value === undefined || value === '') {
const message = customMessage || `Please enter the amount to ${action}`;

return ctx.createError({ message });
Expand All @@ -27,7 +27,7 @@ yup.addMethod<yup.StringSchema>(
'maxAmount',
function ({ maxAmount }: MaxAmountValidationParams, action?: string, customMessage?: string) {
return this.test('maxAmount', (value, ctx) => {
if (value === undefined) return true;
if (value === undefined || value === '') return true;

const amount = new Big(value);

Expand All @@ -51,7 +51,7 @@ yup.addMethod<yup.StringSchema>(
'minAmount',
function ({ minAmount }: MinAmountValidationParams = {}, action: string, customMessage?: string) {
return this.test('balance', (value, ctx) => {
if (value === undefined) return true;
if (value === undefined || value === '') return true;

const amount = new Big(value);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ type InheritAttrs = Omit<FlexProps, (keyof Props & AriaAttrs) | 'children'>;

type HeaderProps = Props & AriaAttrs & InheritAttrs;

const ButtonGroup = ({ ...props }: HeaderProps): JSX.Element => {
const ButtonGroup = ({ onSelectionChange, selectionMode, ...props }: HeaderProps): JSX.Element => {
const domRef = useDOMRef<HTMLDivElement>(null);
let state = useListState(props);
let state = useListState({ ...props, onSelectionChange, selectionMode });
let { gridProps } = useTagGroup(props, state, domRef);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const TokenButtonGroup = ({ isSelected, currency, onSelectionChange }: HeaderPro

return (
<ButtonGroup
aria-label='send amount options'
flex={1}
gap='md'
justifyContent='space-between'
Expand All @@ -80,23 +81,6 @@ const TokenButtonGroup = ({ isSelected, currency, onSelectionChange }: HeaderPro
)}
</Item>
))}

{/* <Item textValue='1'>
<Flex direction='column'>
<Span size='s'>{Intl.NumberFormat(locale).format(16000)}</Span>
<Span color='grey-200' size='s'>
{format(10)}
</Span>
</Flex>
</Item>
<Item textValue='2'>
<Flex direction='column'>
<Span size='s'>{Intl.NumberFormat(locale).format(32000)}</Span>
<Span color='grey-200' size='s'>
{format(20)}
</Span>
</Flex>
</Item> */}
</ButtonGroup>
);
};
Expand Down
Loading

0 comments on commit 3a55488

Please sign in to comment.