This repository has been archived by the owner on Oct 21, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
6,214 additions
and
6,898 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: 'recommended', | ||
}; |
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,11 +1,48 @@ | ||
import Component from '@ember/component'; | ||
import { get } from '@ember/object'; | ||
|
||
import { computed } from 'ember-decorators/object'; | ||
|
||
import Table from 'ember-light-table'; | ||
|
||
import PagedMixin from '../../mixins/paged'; | ||
import formatAmount from '../../utils/format-amount'; | ||
|
||
export default Component.extend(PagedMixin, { | ||
contentKey: 'history', | ||
|
||
wallet: null, | ||
account: null, | ||
history: null, | ||
|
||
@computed | ||
get columns() { | ||
return [ | ||
{ | ||
label: 'Type', | ||
valuePath: 'type', | ||
width: '10%', | ||
}, | ||
{ | ||
label: 'Account', | ||
valuePath: 'account', | ||
width: '60%', | ||
cellClassNames: 'text-truncate', | ||
cellComponent: 'account-link', | ||
}, | ||
{ | ||
label: 'Amount', | ||
valuePath: 'amount', | ||
cellClassNames: 'text-truncate', | ||
format(rawValue) { | ||
return formatAmount(rawValue); | ||
}, | ||
}, | ||
]; | ||
}, | ||
|
||
@computed('columns', 'pagedContent.@each') | ||
get table() { | ||
return new Table(get(this, 'columns'), get(this, 'pagedContent')); | ||
}, | ||
}); |
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,29 +1,20 @@ | ||
{{page-numbers content=history currentPage=page totalPages=totalPages}} | ||
|
||
<table class="table table-striped table-responsive"> | ||
<caption class="sr-only">History for account {{account.id}}</caption> | ||
<thead> | ||
<tr> | ||
<th scope="col">Type</th> | ||
<th scope="col">Account</th> | ||
<th scope="col">Amount</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{#each pagedContent as |entry|}} | ||
<tr scope="row"> | ||
<td> | ||
{{entry.type}} | ||
</td> | ||
<td> | ||
{{#link-to 'wallets.accounts.index' wallet account disabledWhen=(not (contains account wallet.accounts))}} | ||
{{truncate entry.account 30}} | ||
{{/link-to}} | ||
</td> | ||
<td> | ||
{{format-amount entry.amount}} | ||
</td> | ||
</tr> | ||
{{/each}} | ||
</tbody> | ||
</table> | ||
{{#light-table table tableClassNames='table table-striped' height='auto' as |t|}} | ||
{{t.head}} | ||
|
||
{{#t.body canSelect=false as |body|}} | ||
{{#if (is-pending history)}} | ||
{{#body.loader}} | ||
{{fa-icon 'refresh' size=3 spin=true}} | ||
<span class="sr-only">Loading...</span> | ||
{{/body.loader}} | ||
{{/if}} | ||
|
||
{{#if table.isEmpty}} | ||
{{#body.no-data}} | ||
No history found. | ||
{{/body.no-data}} | ||
{{/if}} | ||
{{/t.body}} | ||
{{/light-table}} |
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 @@ | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
classNames: ['text-truncate'], | ||
|
||
value: null, | ||
}); |
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,3 @@ | ||
{{#link-to 'wallets.accounts.index' value.wallet value disabledWhen=(not (contains value value.wallet.accounts))}} | ||
{{value}} | ||
{{/link-to}} |
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,23 +1,9 @@ | ||
import { helper } from '@ember/component/helper'; | ||
|
||
import BigNumber from 'npm:bignumber.js'; | ||
import formatAmountUtil from '../utils/format-amount'; | ||
|
||
const base10 = BigNumber(10); | ||
|
||
const PREFIXES = { | ||
Gxrb: base10.pow(33), | ||
Mxrb: base10.pow(30), | ||
kxrb: base10.pow(27), | ||
xrb: base10.pow(24), | ||
mxrb: base10.pow(21), | ||
uxrb: base10.pow(18), | ||
}; | ||
|
||
export function formatAmount([value = 0], { prefix = 'Mxrb', precision = 6 }) { | ||
const divisor = PREFIXES[prefix] || PREFIXES.Mxrb; | ||
const quotient = BigNumber(value).dividedBy(divisor); | ||
const digits = Math.max(precision, Math.min(1, quotient.decimalPlaces())); | ||
return quotient.toFormat(digits); | ||
export function formatAmount([value], hash) { | ||
return formatAmountUtil(value, hash); | ||
} | ||
|
||
export default helper(formatAmount); |
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,19 @@ | ||
import BigNumber from 'npm:bignumber.js'; | ||
|
||
const base10 = BigNumber(10); | ||
|
||
const PREFIXES = { | ||
Gxrb: base10.pow(33), | ||
Mxrb: base10.pow(30), | ||
kxrb: base10.pow(27), | ||
xrb: base10.pow(24), | ||
mxrb: base10.pow(21), | ||
uxrb: base10.pow(18), | ||
}; | ||
|
||
export default function formatAmount(value = 0, { prefix = 'Mxrb', precision = 6 } = {}) { | ||
const divisor = PREFIXES[prefix] || PREFIXES.Mxrb; | ||
const quotient = BigNumber(value).dividedBy(divisor); | ||
const digits = Math.max(precision, Math.min(1, quotient.decimalPlaces())); | ||
return quotient.toFormat(digits); | ||
} |
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,6 @@ | ||
{ | ||
"name": "raiwallet", | ||
"dependencies": { | ||
"animation-frame": "~0.2.4" | ||
} | ||
} |
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.