-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(offers): cancel offer successfully
- Loading branch information
plondon
committed
Dec 27, 2021
1 parent
40feca3
commit 3418025
Showing
6 changed files
with
134 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
packages/blockchain-wallet-v4-frontend/src/modals/Nfts/NftOrder/CancelOffer/fees.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React, { useEffect } from 'react' | ||
import { FormattedMessage } from 'react-intl' | ||
import BigNumber from 'bignumber.js' | ||
|
||
import { GasCalculationOperations, SellOrder } from '@core/network/api/nfts/types' | ||
import { SpinningLoader, TooltipHost, TooltipIcon } from 'blockchain-info-components' | ||
import CoinDisplay from 'components/Display/CoinDisplay' | ||
import FiatDisplay from 'components/Display/FiatDisplay' | ||
import { Title, Value } from 'components/Flyout/model' | ||
|
||
import { CTARow } from '../../components' | ||
import { Props as OwnProps } from '..' | ||
|
||
const Fees: React.FC<Props> = (props) => { | ||
const { nftActions, orderFlow } = props | ||
const { activeOffer } = orderFlow | ||
|
||
useEffect(() => { | ||
if (activeOffer && props.operation === 'cancel') { | ||
nftActions.fetchFees({ | ||
operation: GasCalculationOperations.Cancel, | ||
order: activeOffer as unknown as SellOrder | ||
}) | ||
} | ||
}, []) | ||
|
||
if (!activeOffer) return null | ||
|
||
return ( | ||
<> | ||
{orderFlow.fees.cata({ | ||
Failure: () => null, | ||
Loading: () => ( | ||
<CTARow> | ||
<SpinningLoader width='14px' height='14px' borderWidth='3px' /> | ||
</CTARow> | ||
), | ||
NotAsked: () => null, | ||
Success: (val) => { | ||
return ( | ||
<> | ||
<CTARow> | ||
<Title style={{ display: 'flex' }}> | ||
<FormattedMessage id='copy.fees' defaultMessage='Fees' /> | ||
</Title> | ||
<Value> | ||
<div style={{ display: 'flex' }}> | ||
<CoinDisplay size='14px' color='black' weight={600} coin='ETH'> | ||
{new BigNumber(val.totalFees).multipliedBy(val.gasPrice).toString()} | ||
</CoinDisplay> | ||
- | ||
<FiatDisplay size='12px' color='grey600' weight={600} coin='ETH'> | ||
{new BigNumber(val.totalFees).multipliedBy(val.gasPrice).toString()} | ||
</FiatDisplay> | ||
</div> | ||
</Value> | ||
</CTARow> | ||
</> | ||
) | ||
} | ||
})} | ||
</> | ||
) | ||
} | ||
|
||
type Props = OwnProps & { operation: 'cancel' | 'accept' } | ||
|
||
export default Fees |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters