diff --git a/src/assets/Asset.tsx b/src/assets/Asset.tsx index 6fdba40..504de96 100644 --- a/src/assets/Asset.tsx +++ b/src/assets/Asset.tsx @@ -46,7 +46,7 @@ class Asset extends React.Component { } render() { - let { asset, sync, wallet, actions: { send } } = this.props + let { asset, sync, wallet, actions: { send }, sendAssetsStage } = this.props return ( @@ -54,7 +54,7 @@ class Asset extends React.Component { , - + ]} @@ -67,6 +67,7 @@ namespace Asset { export type Props = { asset: Summary.Balance | { deck: Deck } sync: SyncButton.Logic + sendAssetsStage: string | undefined actions: { send: SendAsset.Props['send'] } diff --git a/src/assets/AssetContainer.tsx b/src/assets/AssetContainer.tsx index 1deaea5..63c08f1 100644 --- a/src/assets/AssetContainer.tsx +++ b/src/assets/AssetContainer.tsx @@ -35,11 +35,11 @@ export default connect( ({ wallet: { wallet }, assets: { routineStages, decks, balances } }: RootState, { match }: RouterProps): MappedProps => { let balance = (balances || []).filter(b => b.deck.id === match.params.id)[0] if(balance){ - return { asset: balance, wallet, stage: routineStages.syncAsset } + return { asset: balance, wallet, stage: routineStages.syncAsset, sendAssetsStage: routineStages.sendAssets } } let deck = (decks || []).filter(deck => deck.id === match.params.id)[0] if(deck){ - return { asset: { deck }, wallet, stage: routineStages.syncAsset } + return { asset: { deck }, wallet, stage: routineStages.syncAsset, sendAssetsStage: routineStages.sendAssets } } return { redirect: true as true } }, diff --git a/src/assets/SendAsset.tsx b/src/assets/SendAsset.tsx index b422931..c37dbfe 100644 --- a/src/assets/SendAsset.tsx +++ b/src/assets/SendAsset.tsx @@ -141,6 +141,17 @@ class AddRecipient extends React.Component<{ decimals: number, add: (r: Recipien } } +function SendButton(props: { stage: undefined | string, DEFAULT: string, disabled: boolean, onPress: () => any }){ + return ( + + ) +} + class SendAsset extends React.Component { state: SendAsset.Data = { amountsMap: {}, @@ -163,18 +174,6 @@ class SendAsset extends React.Component { let transactionType = type === 'RECEIVED' ? 'Send' : 'Issue' let canSendAmount = (transactionType === 'Issue' || (totalAmount < balance)) - let SendButton = (props: { onPress: () => any }) => - - - let remove = (address: string) => () => { let { [address]: _, ...amountsMap } = this.state.amountsMap this.setState({ amountsMap }) @@ -210,6 +209,11 @@ class SendAsset extends React.Component { actionProp='onPress' action={this.send} Component={SendButton} + componentProps={{ + disabled: (!isFilled(this.state)) || (!canSendAmount) || !Deck.isFull(this.props.asset.deck), + stage: this.props.stage, + DEFAULT: !canSendAmount ? 'Insufficient Funds!' : `${transactionType} Asset`, + }} />