Merge pull request #320 from oxen-io/sort-sn-staked-list

Sorts the "MY STAKES" service node list alphabetically
This commit is contained in:
Sean 2022-08-23 07:17:45 +10:00 committed by GitHub
commit fbc06a407b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 7 deletions

View File

@ -72,13 +72,20 @@ export default {
node.contributors.find(
c => c.address === this.our_address && c.amount > 0
);
return nodes.filter(getOurContribution).map(n => {
const ourContribution = getOurContribution(n);
return {
...n,
ourContributionAmount: ourContribution.amount
};
});
return nodes
.filter(getOurContribution)
.sort((a, b) => {
if (a.service_node_pubkey < b.service_node_pubkey) return -1;
if (a.service_node_pubkey > b.service_node_pubkey) return 1;
return 0;
})
.map(n => {
const ourContribution = getOurContribution(n);
return {
...n,
ourContributionAmount: ourContribution.amount
};
});
},
fetching: state => state.gateway.daemon.service_nodes.fetching
}),