-
Notifications
You must be signed in to change notification settings - Fork 31
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 #165 from ipavlenko/layout
MINT-202 Static Markup for the Wallet page
- Loading branch information
Showing
60 changed files
with
1,715 additions
and
522 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/chronobank-smart-contracts |
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 |
---|---|---|
@@ -1,53 +1,140 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import { connect } from 'react-redux' | ||
|
||
import { TextField, RaisedButton, FlatButton } from 'material-ui' | ||
|
||
import { depositTIME, withdrawTIME } from 'redux/wallet/actions' | ||
|
||
import IconSection from './IconSection' | ||
import ColoredSection from './ColoredSection' | ||
|
||
import './DepositTokens.scss' | ||
|
||
class DepositTokens extends React.Component { | ||
export class DepositTokens extends React.Component { | ||
|
||
static propTypes = { | ||
title: PropTypes.string, | ||
account: PropTypes.string, | ||
amount: PropTypes.string, | ||
deposit: PropTypes.string, | ||
balance: PropTypes.string, | ||
isFetching: PropTypes.bool, | ||
handleDepositTIME: PropTypes.func, | ||
handleWithdrawTIME: PropTypes.func | ||
} | ||
|
||
static defaultProps = { | ||
amount: '' | ||
} | ||
|
||
constructor(props) { | ||
super(props) | ||
this.state = { | ||
amount: props.amount | ||
} | ||
} | ||
|
||
render() { | ||
return ( | ||
<ColoredSection styleName="root" | ||
head={this.renderHead()} | ||
headStyle={this.props.headStyle} | ||
/> | ||
body={this.renderBody()} | ||
foot={this.renderFoot()} /> | ||
) | ||
} | ||
|
||
renderHead() { | ||
|
||
// Sometimes we use strings to store balance and transaction volume, Sometimes we are not | ||
const [ balance1, balance2 ] = ('' + this.props.balance).split('.') | ||
const [ deposit1, deposit2 ] = ('' + this.props.deposit).split('.') | ||
|
||
return ( | ||
<div> | ||
<IconSection title={this.props.title}> | ||
<div styleName="balance"> | ||
<div styleName="label">Your time deposit:</div> | ||
<div styleName="value"> | ||
<span styleName="value1">1 512 000</span> | ||
<span styleName="value2">.00123 TIME</span> | ||
<span styleName="value1">{deposit1}</span> | ||
{!balance2 ? null : ( | ||
<span styleName="value2">.{deposit2}</span> | ||
)} | ||
<span styleName="value3"> TIME</span> | ||
</div> | ||
</div> | ||
<div styleName="balance"> | ||
<div styleName="label">Total time deposit:</div> | ||
<div styleName="label">Total time balance:</div> | ||
<div styleName="value"> | ||
<span styleName="value1">1 512 000</span> | ||
<span styleName="value2">.00123 TIME</span> | ||
<span styleName="value1">{balance1}</span> | ||
{!balance2 ? null : ( | ||
<span styleName="value2">.{balance2}</span> | ||
)} | ||
<span styleName="value3"> TIME</span> | ||
</div> | ||
</div> | ||
</IconSection> | ||
</div> | ||
) | ||
} | ||
|
||
renderBody() { | ||
return ( | ||
<div styleName="form"> | ||
<div> | ||
<TextField onChange={(event, value) => this.handleAmountChange(value)} | ||
floatingLabelText="Amount" | ||
value={this.state.amount} | ||
style={{width: '150px'}} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
renderFoot() { | ||
return ( | ||
<div styleName="actions"> | ||
<span styleName="action"> | ||
<FlatButton label="Require time"/> | ||
</span> | ||
<span styleName="action"> | ||
<RaisedButton label="Lock" onTouchTap={() => this.props.handleDepositTIME(this.state.amount)}/> | ||
</span> | ||
<span styleName="action"> | ||
<RaisedButton label="Withdraw" primary/> | ||
</span> | ||
</div> | ||
) | ||
} | ||
|
||
handleAmountChange(amount) { | ||
this.setState({ | ||
amount | ||
}) | ||
} | ||
} | ||
|
||
DepositTokens.propTypes = { | ||
title: PropTypes.string, | ||
headStyle: PropTypes.object | ||
export const TIME = 'TIME' | ||
|
||
function mapStateToProps (state) { | ||
let session = state.get('session') | ||
let wallet = state.get('wallet') | ||
let time = wallet.tokens.get(TIME) | ||
|
||
return { | ||
account: session.account, | ||
balance: time.balance(), | ||
deposit: wallet.timeDeposit, | ||
isFetching: time.isFetching() | ||
} | ||
} | ||
|
||
function mapDispatchToProps (dispatch) { | ||
return { | ||
handleDepositTIME: (amount) => dispatch(depositTIME(amount)), | ||
handleWithdrawTIME: (amount) => dispatch(withdrawTIME(amount)) | ||
} | ||
} | ||
|
||
export default DepositTokens | ||
export default connect(mapStateToProps, mapDispatchToProps)(DepositTokens) |
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
Oops, something went wrong.