Fix contributor details view in toplist

This commit is contained in:
2019-04-28 11:58:58 +01:00
parent 7d5b93a62c
commit 109ffd2898
3 changed files with 13 additions and 8 deletions
+2 -2
View File
@@ -9,10 +9,10 @@ export default Component.extend({
actions: { actions: {
toggleContributorInfo(contributor) { toggleContributorInfo(contributor) {
if (contributor.get('showMetadata')) { if (contributor.showMetadata) {
contributor.set('showMetadata', false); contributor.set('showMetadata', false);
} else { } else {
this.contributors.setEach('showMetadata', false); this.contributorList.setEach('showMetadata', false);
contributor.set('showMetadata', true); contributor.set('showMetadata', true);
} }
} }
+8 -4
View File
@@ -1,6 +1,6 @@
<tbody> <tbody>
{{#each contributorList as |c|}} {{#each contributorList as |c|}}
<tr role="button" class={{if (is-current-user c.contributor) "current-user"}} {{action "toggleContributorInfo" c.contributor}}> <tr role="button" class={{if (is-current-user c.contributor) "current-user"}} {{action "toggleContributorInfo" c}}>
<td class="person"> <td class="person">
{{user-avatar contributor=c.contributor}} {{c.contributor.name}} {{user-avatar contributor=c.contributor}} {{c.contributor.name}}
</td> </td>
@@ -18,12 +18,16 @@
<tr class="metadata {{if (is-current-user c.contributor) "current-user"}} {{if c.showMetadata "visible"}}"> <tr class="metadata {{if (is-current-user c.contributor) "current-user"}} {{if c.showMetadata "visible"}}">
<td colspan="2"> <td colspan="2">
<ul> <ul>
<li><a href="https://testnet.etherscan.io/address/{{c.contributor.account}}">Inspect Ethereum transactions</a></li> <li>
<a href="https://testnet.etherscan.io/address/{{c.contributor.account}}" target="_blank" rel="noopener">Inspect Ethereum transactions</a>
</li>
{{#if c.contributor.ipfsHash}} {{#if c.contributor.ipfsHash}}
<li><a href="https://ipfs.io/ipfs/{{c.contributor.ipfsHash}}">Inspect IPFS profile</a></li> <li>
<a href="https://ipfs.io/ipfs/{{c.contributor.ipfsHash}}" target="_blank" rel="noopener">Inspect IPFS profile</a>
</li>
{{/if}} {{/if}}
</ul> </ul>
{{#if c.contributor.showMetadata}} {{#if c.showMetadata}}
<pre>{{c.contributor.ipfsData}}</pre> <pre>{{c.contributor.ipfsData}}</pre>
{{/if}} {{/if}}
</td> </td>
+3 -2
View File
@@ -3,6 +3,7 @@ import Kredits from 'npm:kredits-contracts';
import RSVP from 'rsvp'; import RSVP from 'rsvp';
import Service from '@ember/service'; import Service from '@ember/service';
import EmberObject from '@ember/object';
import { computed } from '@ember/object'; import { computed } from '@ember/object';
import { alias, notEmpty } from '@ember/object/computed'; import { alias, notEmpty } from '@ember/object/computed';
import { isEmpty } from '@ember/utils'; import { isEmpty } from '@ember/utils';
@@ -50,12 +51,12 @@ export default Service.extend({
return contributionsGrouped.map(c => { return contributionsGrouped.map(c => {
const amountUnconfirmed = c.items.mapBy('amount').reduce((a, b) => a + b); const amountUnconfirmed = c.items.mapBy('amount').reduce((a, b) => a + b);
const contributor = this.contributors.findBy('id', c.value.toString()); const contributor = this.contributors.findBy('id', c.value.toString());
return { return EmberObject.create({
contributor: contributor, contributor: contributor,
amountUnconfirmed: amountUnconfirmed, amountUnconfirmed: amountUnconfirmed,
amountConfirmed: contributor.totalKreditsEarned, amountConfirmed: contributor.totalKreditsEarned,
amountTotal: contributor.totalKreditsEarned + amountUnconfirmed amountTotal: contributor.totalKreditsEarned + amountUnconfirmed
} })
}) })
}), }),