-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from liquality/refund_flow
Refund flow for swaps
- Loading branch information
Showing
14 changed files
with
544 additions
and
359 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,24 @@ | ||
import React, { Component } from 'react' | ||
import { shortenAddress } from '../../utils/address' | ||
|
||
import './HexaDisplay.css' | ||
|
||
class HexaDisplay extends Component { | ||
onCopyLink () { | ||
const tempInput = document.createElement('input') | ||
tempInput.value = this.props.address | ||
tempInput.style = 'position: absolute; top: -2000px;' | ||
document.body.appendChild(tempInput) | ||
tempInput.select() | ||
document.execCommand('copy') | ||
document.body.removeChild(tempInput) | ||
} | ||
|
||
render () { | ||
return <span onClick={() => this.onCopyLink.bind(this)()} className='HexaDisplay'> | ||
{shortenAddress(this.props.address)} | ||
</span> | ||
} | ||
} | ||
|
||
export default HexaDisplay |
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,4 @@ | ||
.HexaDisplay { | ||
color: #8D46E2; | ||
cursor: pointer; | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React, { Component } from 'react' | ||
import BrandCard from '../../components/BrandCard/BrandCard' | ||
import HexaDisplay from '../../components/HexaDisplay/HexaDisplay' | ||
import Button from '../../components/Button/Button' | ||
import cryptoassets from '@liquality/cryptoassets' | ||
import { APP_BASE_URL } from '../../utils/app-links' | ||
|
||
import './SwapRefunded.css' | ||
|
||
class SwapRefunded extends Component { | ||
render () { | ||
const title = cryptoassets[this.props.assets.a.currency].code + ' SUCCESFULLY RECLAIMED' | ||
return <div> | ||
<BrandCard className='SwapRefunded' title={title}> | ||
<div className='SwapRefunded_expiredFrame'> | ||
<div className='SwapRefunded_expiredFrame_content'> | ||
|
||
<p className='SwapRefunded_expiredFrame_content_title'> | ||
Expired Swap offer | ||
</p> | ||
<hr /> | ||
<p> | ||
Receive: <span className='SwapRefunded_expiredFrame_content_value'>{this.props.assets.b.value} {cryptoassets[this.props.assets.b.currency].code}</span> | ||
</p> | ||
<p> | ||
For: <span className='SwapRefunded_expiredFrame_content_value'>{this.props.assets.a.value} {cryptoassets[this.props.assets.a.currency].code}</span> | ||
</p> | ||
<p> | ||
Expired: <span className='SwapRefunded_expiredFrame_content_value'>{this.props.expiration.format('DD/MM/YYYY h:mm a')}</span> | ||
</p> | ||
<hr /> | ||
</div> | ||
</div> | ||
<div className='SwapRefunded_confirmation'> | ||
<p className='SwapRefunded_terms'> | ||
{this.props.assets.a.value} {cryptoassets[this.props.assets.a.currency].code} Returned | ||
</p> | ||
<p>Address: <HexaDisplay address={this.props.wallets.a.addresses[0]} /></p> | ||
<p>Transaction: <HexaDisplay address={this.props.refundTransaction.hash} /></p> | ||
</div> | ||
<Button className='SwapRefunded_button' wide primary onClick={() => window.location.replace(APP_BASE_URL)}>Start another Swap</Button> | ||
</BrandCard> | ||
</div> | ||
} | ||
} | ||
|
||
export default SwapRefunded |
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,40 @@ | ||
@import '../../scss/variables.scss'; | ||
|
||
.SwapRefunded { | ||
text-align: center; | ||
|
||
&_terms { | ||
font-size: $h1-font-size; | ||
} | ||
|
||
&_button { | ||
margin-top: 50px; | ||
} | ||
|
||
&_expiredFrame { | ||
text-align: center; | ||
width: 100%; | ||
color: #A4AAB6; | ||
margin-top: -20px; | ||
border-radius: 0px 0px 22px 22px; | ||
padding: 50px; | ||
|
||
&_content { | ||
margin-left: 30%; | ||
width: 40%; | ||
text-align: left; | ||
|
||
&_title { | ||
text-align: center; | ||
color: #494949; | ||
} | ||
|
||
&_value { | ||
color: #5F5F5F; | ||
} | ||
} | ||
|
||
} | ||
|
||
|
||
} |
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,16 @@ | ||
import { connect } from 'react-redux' | ||
import SwapRefunded from './SwapRefunded' | ||
|
||
const mapStateToProps = state => { | ||
return { | ||
assets: state.swap.assets, | ||
wallets: state.swap.wallets, | ||
expiration: state.swap.expiration, | ||
isPartyB: state.swap.isPartyB, | ||
refundTransaction: state.swap.transactions.a.refund | ||
} | ||
} | ||
|
||
export default connect( | ||
mapStateToProps | ||
)(SwapRefunded) |
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