-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #17
- Loading branch information
Showing
16 changed files
with
118 additions
and
10 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,26 @@ | ||
import React from 'react' | ||
|
||
import { connect } from 'react-redux' | ||
|
||
import Payments from '../../views/payments/index' | ||
|
||
import { | ||
|
||
} from '../../actions/payments' | ||
|
||
import { | ||
getAllPayments | ||
} from '../../reducers' | ||
|
||
const render = props => { | ||
return <Payments {...props} /> | ||
} | ||
|
||
const mapStateToProps = (state, { match }) => ({ | ||
payments: getAllPayments(state) | ||
}) | ||
|
||
const mapDispatchToProps = (dispatch, { history, match }) => ({ | ||
}) | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(render) |
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 |
---|---|---|
|
@@ -23,3 +23,9 @@ | |
} | ||
} | ||
} | ||
|
||
.c-payments__item { | ||
&:not(:last-child) { | ||
border-bottom: 1px solid $divider-color; | ||
} | ||
} |
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,5 @@ | ||
.o-circle { | ||
width: $base-spacing-unit * 1.5; | ||
height: $base-spacing-unit * 1.5; | ||
border-radius: 50%; | ||
} |
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,7 @@ | ||
.u-notice--success { | ||
background-color: $success-color; | ||
} | ||
|
||
.u-notice--error { | ||
background-color: $error-color; | ||
} |
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 |
---|---|---|
|
@@ -21,3 +21,8 @@ | |
.u-brand-primary { | ||
color: $brand-primary; | ||
} | ||
|
||
.u-smaller { | ||
font-size: $label-font-size; | ||
line-height: 24px; | ||
} |
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,15 +1,61 @@ | ||
import Big from 'big.js' | ||
import React, { Fragment } from 'react' | ||
|
||
import Icon from '../../components/Icon' | ||
|
||
export default () => ( | ||
const { | ||
Blob, | ||
URL | ||
} = window | ||
|
||
const formatDate = (dateString) => new Date(dateString).toLocaleString() | ||
// { | ||
// const date = new Date(dateString) | ||
// return `${date.toLocaleDateString()} – ${date.toLocaleTimeString()}` | ||
// } | ||
|
||
const getAmount = (receivedAmount, rate, fiatCurrency) => { | ||
try { | ||
return `${new Big(receivedAmount).times(rate).toFixed(2)} ${fiatCurrency}` | ||
} catch (e) { | ||
return '—' | ||
} | ||
} | ||
|
||
const ListItem = ({id, receivedAmount, rate, fiatCurrency, updatedAt, paymentId}) => ( | ||
<li className='c-payments__item o-list-bare__item u-padding-vertical u-padding-horizontal-small o-flex o-flex--ai-center'> | ||
<span className={`o-circle u-notice--${receivedAmount ? 'success' : 'error'}`} /> | ||
<span className='o-flex__stretch u-margin-horizontal o-flex o-flex--col o-flex--jc-center u-smaller'> | ||
<span>{formatDate(updatedAt)}</span> | ||
<span>{paymentId || '—'}</span> | ||
</span> | ||
<span className='u-medium'> | ||
{getAmount(receivedAmount, rate, fiatCurrency)} | ||
</span> | ||
</li> | ||
) | ||
|
||
const download = (json) => { | ||
const blob = new Blob([JSON.stringify(json, null, 2)], { type: 'application/json' }) | ||
return URL.createObjectURL(blob) | ||
} | ||
|
||
export default ({ payments }) => ( | ||
<Fragment> | ||
<div className='o-app__content o-content'> | ||
<span>Coming soon™</span> | ||
<div className='o-app__content' style={{margin: '54px 0'}}> | ||
<ul className='c-payments o-list-bare u-margin-horizontal-small u-margin-vertical-none'> | ||
{ payments.map(payment => <ListItem key={payment.id} {...payment} />) } | ||
</ul> | ||
</div> | ||
<div className='o-app__top-left'> | ||
<Icon href='/' name='back' /> | ||
</div> | ||
<div className='o-app__header'>History</div> | ||
<a className='c-btn o-app__footer' | ||
href={download(payments)} | ||
download={`kasisto-payments-${new Date().toISOString()}.json`} | ||
> | ||
Download | ||
</a> | ||
</Fragment> | ||
) |
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