Skip to content

Commit

Permalink
Merge pull request #165 from ipavlenko/layout
Browse files Browse the repository at this point in the history
MINT-202 Static Markup for the Wallet page
  • Loading branch information
Boris Shevchenko committed Jun 23, 2017
2 parents b690151 + 169040a commit eb9954b
Show file tree
Hide file tree
Showing 60 changed files with 1,715 additions and 522 deletions.
1 change: 1 addition & 0 deletions chronobank-smart-contracts
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"babel-preset-stage-0": "^6.24.1",
"chalk": "1.1.3",
"ethereum-bridge": "github:oraclize/ethereum-bridge",
"chronobank-smart-contracts": "ahiatsevich/SmartContracts.git#feature/exception-handling",
"chronobank-smart-contracts": "ChronoBank/SmartContracts#develop",
"classnames": "^2.2.5",
"coveralls": "^2.13.1",
"cross-env": "^5.0.0",
Expand All @@ -44,7 +44,7 @@
"jest": "20.0.3",
"jest-cli": "^20.0.3",
"material-colors-scss": "^0.2.2",
"material-ui": "^0.18.1",
"material-ui": "^0.18.3",
"node-sass": "^4.5.2",
"postcss-cssnext": "^2.11.0",
"postcss-loader": "^2.0.4",
Expand All @@ -60,6 +60,7 @@
"webpack-dev-server": "2.4.5"
},
"dependencies": {
"axios": "^0.16.2",
"babel-plugin-react-css-modules": "^2.7.1",
"bignumber.js": "^4.0.2",
"bip39": "^2.3.0",
Expand Down
5 changes: 1 addition & 4 deletions src/components/common/Transactions/Transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ class Transactions extends Component {
</TableRow>
</TableHeader>
<TableBody displayRowCheckbox={false}>
{transactions.sortBy(x => x.blockNumber)
.reverse()
.valueSeq()
.map(tx => (
{transactions.valueSeq().map(tx => (
<TableRow key={tx.id()}>
<TableRowColumn style={styles.columns.id}>{tx.blockNumber}</TableRowColumn>
<TableRowColumn style={styles.columns.hash}>
Expand Down
6 changes: 3 additions & 3 deletions src/components/dashboard/ColoredSection.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
.root {

.head {
padding: 16px 24px;
padding: 24px 16px;
}

.body { padding: 16px 24px; }
.foot { padding: 16px 24px; }
.body { padding: 0px 16px 24px 16px; }
.foot { padding: 24px 16px; }
}
111 changes: 99 additions & 12 deletions src/components/dashboard/DepositTokens.jsx
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">&nbsp;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">&nbsp;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)
13 changes: 12 additions & 1 deletion src/components/dashboard/DepositTokens.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
.root {
}


.form {
}

.balance {

margin-top: 15px;
Expand All @@ -25,10 +29,17 @@
vertical-align: baseline;
}

.value2 {
.value2, .value3 {
font-size: 16px;
vertical-align: baseline;
opacity: 0.5;
}
}
}

.actions {
text-align: right;
.action {
margin-left: 40px;
}
}
29 changes: 14 additions & 15 deletions src/components/dashboard/IconSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ import './IconSection.scss'

class IconSection extends React.Component {

static propTypes = {
title: PropTypes.string,
icon: PropTypes.string,
children: PropTypes.node,
}

static defaultProps = {
title: 'Default Title',
icon: null,
children: null
}

constructor(props) {
super(props)
}
Expand All @@ -24,9 +36,8 @@ class IconSection extends React.Component {
</div>
<div styleName="col">
<div styleName="right">
<div styleName="icon">
<div className="content">
{this.props.icon}
<div className="icon">
<div className="content" style={{ backgroundImage: `url("${this.props.icon}")` }}>
</div>
</div>
</div>
Expand All @@ -36,16 +47,4 @@ class IconSection extends React.Component {
}
}

IconSection.propTypes = {
title: PropTypes.string,
icon: PropTypes.element,
children: PropTypes.node,
}

IconSection.defaultProps = {
title: 'Default Title',
icon: null,
children: null
}

export default IconSection
18 changes: 13 additions & 5 deletions src/components/dashboard/IconSection.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
}

.left {
@include position(absolute);
position: relative;
display: flex;
min-height: 100%;
flex-direction: column;
justify-content: space-between;

Expand All @@ -41,10 +42,17 @@
}

.right {
.icon {
border-radius: 12px;
box-shadow: $box-shadow-0;
@include aspect-ratio(4, 3);
:global {
.icon {
border-radius: 12px;
box-shadow: $box-shadow-0;
@include aspect-ratio(16, 10);
.content {
background-repeat: no-repeat;
background-position: center center;
background-size: 90% 90%;
}
}
}
}
}
Loading

0 comments on commit eb9954b

Please sign in to comment.