Mark current user in contrib list if available

This commit is contained in:
2017-02-08 14:22:49 +08:00
parent ad76fb2369
commit cd6fbfe17c
4 changed files with 41 additions and 26 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<tbody> <tbody>
{{#each contributors as |contributor|}} {{#each contributors as |contributor|}}
<tr> <tr class="{{if contributor.isCurrentUser 'current-user'}}">
<td class="person"> <td class="person">
<img class="avatar" src={{contributor.avatarURL}}> <img class="avatar" src={{contributor.avatarURL}}>
{{contributor.github_username}} {{contributor.github_username}}
+3 -1
View File
@@ -2,10 +2,12 @@ import Ember from 'ember';
export default Ember.Object.extend({ export default Ember.Object.extend({
address: null,
github_username: null, github_username: null,
github_uid: null, github_uid: null,
ipfsHash: null,
kredits: null, kredits: null,
address: null, isCurrentUser: false,
avatarURL: function() { avatarURL: function() {
return `https\:\/\/avatars2.githubusercontent.com/u/${this.get('github_uid')}?v=3&s=128`; return `https\:\/\/avatars2.githubusercontent.com/u/${this.get('github_uid')}?v=3&s=128`;
+8 -2
View File
@@ -33,6 +33,10 @@ export default Ember.Service.extend({
return web3Instance; return web3Instance;
}.property('web3Instance'), }.property('web3Instance'),
currentUserAccounts: function() {
return (this.get('web3Provided') && this.get('web3').eth.accounts) || [];
}.property('web3', 'web3Provided'),
kreditsContract: function() { kreditsContract: function() {
if (this.get('kreditsContractInstance')) { if (this.get('kreditsContractInstance')) {
return this.get('kreditsContractInstance'); return this.get('kreditsContractInstance');
@@ -64,7 +68,8 @@ export default Ember.Service.extend({
github_username: person[1], github_username: person[1],
github_uid: person[0], github_uid: person[0],
ipfsHash: person[3], ipfsHash: person[3],
kredits: balance.toNumber() kredits: balance.toNumber(),
isCurrentUser: this.get('currentUserAccounts').includes(address)
}); });
Ember.Logger.debug('[kredits] contributor', contributor); Ember.Logger.debug('[kredits] contributor', contributor);
resolve(contributor); resolve(contributor);
@@ -142,7 +147,8 @@ export default Ember.Service.extend({
github_username: name, github_username: name,
github_uid: id, github_uid: id,
ipfsHash: ipfsHash, ipfsHash: ipfsHash,
kredits: 0 kredits: 0,
isCurrentUser: this.get('currentUserAccounts').includes(address)
}); });
resolve(contributor); resolve(contributor);
}); });
+8 -1
View File
@@ -7,7 +7,6 @@ table.contributor-list {
&:first-of-type { &:first-of-type {
border-top: 1px solid rgba(255,255,255,0.2); border-top: 1px solid rgba(255,255,255,0.2);
} }
}
td { td {
padding: 0 1.2rem; padding: 0 1.2rem;
@@ -25,6 +24,7 @@ table.contributor-list {
border-radius: 1rem; border-radius: 1rem;
} }
} }
&.kredits { &.kredits {
text-align: right; text-align: right;
.amount { .amount {
@@ -36,4 +36,11 @@ table.contributor-list {
} }
} }
} }
&.current-user {
td {
background-color: rgba(255,255,255,0.2);
}
}
}
} }