diff --git a/src/views/menus/AccountMenu.tsx b/src/views/menus/AccountMenu.tsx index fc882df..27d886f 100644 --- a/src/views/menus/AccountMenu.tsx +++ b/src/views/menus/AccountMenu.tsx @@ -1,5 +1,7 @@ +import { memo } from 'react'; import styled, { AnyStyledComponent } from 'styled-components'; import { shallowEqual, useDispatch, useSelector } from 'react-redux'; +import type { Dispatch } from '@reduxjs/toolkit'; import { OnboardingState } from '@/constants/account'; import { ButtonAction, ButtonShape, ButtonSize, ButtonType } from '@/constants/buttons'; @@ -110,12 +112,7 @@ export const AccountMenu = () => { - dispatch(openDialog({ type: DialogTypes.Transfer }))} - shape={ButtonShape.Square} - /> +
@@ -129,34 +126,7 @@ export const AccountMenu = () => { fractionDigits={2} />
- - - dispatch( - openDialog({ - type: DialogTypes.Receive, - dialogProps: { selectedAsset: DydxChainAsset.USDC }, - }) - ) - } - shape={ButtonShape.Square} - /> - - dispatch( - openDialog({ - type: DialogTypes.Transfer, - dialogProps: { selectedAsset: DydxChainAsset.USDC }, - }) - ) - } - shape={ButtonShape.Square} - /> - +
@@ -229,6 +199,29 @@ export const AccountMenu = () => { ); }; +const AssetActions = memo(({ asset, dispatch }: { asset: DydxChainAsset; dispatch: Dispatch }) => ( + + {[ + // TODO(@rosepuppy): Add withdraw action for USDC + { + dialogType: DialogTypes.Receive, + iconName: IconName.Qr, + }, + { dialogType: DialogTypes.Transfer, iconName: IconName.Send }, + ].map(({ iconName, dialogType }) => ( + + dispatch(openDialog({ type: dialogType, dialogProps: { selectedAsset: asset } })) + } + shape={ButtonShape.Square} + /> + ))} + +)); + const Styled: Record = {}; Styled.AccountInfo = styled.div`