Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d35cab0a67 | |||
| b4a094bc89 | |||
| e43706e2a6 | |||
| 2befc91d90 | |||
| 7a35f5177c | |||
| 6efc3ea790 | |||
| ef0f3ffbfb | |||
| 1e14cc695e | |||
| c074ccf460 | |||
| 5436469128 | |||
| 32714efeb9 | |||
| cf777571dc | |||
| 44b4340a91 | |||
| 24e3171311 | |||
| 575c1a11c2 | |||
| 47b8421d35 | |||
| 38d853a272 | |||
| 0320d6149f | |||
| ba9b3530fa | |||
| e78832e2c8 | |||
| 804060ad34 | |||
| 840519a437 | |||
| 7c54ebcbd0 | |||
| d07c0d67bf | |||
| a0ee2f7bb8 | |||
| d070288e17 | |||
| 681f80f6ab | |||
| eb5c87308a |
@@ -22,7 +22,8 @@ You will need the following things properly installed on your computer.
|
|||||||
|
|
||||||
## Running / Development
|
## Running / Development
|
||||||
|
|
||||||
* `ember serve`
|
|
||||||
|
* `ember serve` - by default kredits-web connects to the Ethreum Kovan network
|
||||||
* Visit your app at [http://localhost:4200](http://localhost:4200).
|
* Visit your app at [http://localhost:4200](http://localhost:4200).
|
||||||
* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).
|
* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).
|
||||||
|
|
||||||
@@ -56,13 +57,13 @@ _(You need collaborator permissions on the 5apps Deploy project.)_
|
|||||||
## Working with locally deployed contracts
|
## Working with locally deployed contracts
|
||||||
|
|
||||||
The smart contracts and their JavaScript wrapper library are developed in the
|
The smart contracts and their JavaScript wrapper library are developed in the
|
||||||
[truffle-kredits](https://github.com/67P/truffle-kredits) repo/package.
|
[kredits-contracts](https://github.com/67P/kredits-contracts) repo/package.
|
||||||
|
|
||||||
You can run `kredits-web` on your machine, against a local, simulated Ethereum
|
You can run `kredits-web` on your machine, against a local, simulated Ethereum
|
||||||
network, provided e.g. by [ganache](http://truffleframework.com/ganache/) or
|
network, provided e.g. by [ganache](http://truffleframework.com/ganache/) or
|
||||||
[ganache-cli](https://github.com/trufflesuite/ganache-cli).
|
[ganache-cli](https://github.com/trufflesuite/ganache-cli).
|
||||||
|
|
||||||
[truffle-kredits](https://github.com/67P/truffle-kredits) holds all the tools
|
[kredits-contracts](https://github.com/67P/kredits-contracts) holds all the tools
|
||||||
to start and set up such a simulated network, as well as to deploy smart
|
to start and set up such a simulated network, as well as to deploy smart
|
||||||
contracts to it.
|
contracts to it.
|
||||||
|
|
||||||
@@ -75,22 +76,22 @@ Run a local IPFS deamon in offline mode.
|
|||||||
* Make sure CORS headers are configured. See [IPFS](#ipfs) for more info.
|
* Make sure CORS headers are configured. See [IPFS](#ipfs) for more info.
|
||||||
* `ipfs daemon --offline`
|
* `ipfs daemon --offline`
|
||||||
|
|
||||||
#### 2. truffle-kredits
|
#### 2. kredits-contracts
|
||||||
|
|
||||||
Get your local Ethereum development node running.
|
Get your local Ethereum development node running.
|
||||||
|
|
||||||
* Clone [truffle-kredits](https://github.com/67P/truffle-kredits)
|
* Clone [kredits-contracts](https://github.com/67P/kredits-contracts)
|
||||||
* `npm install`
|
* `npm install`
|
||||||
* `npm run ganache` - which is basically: `ganache-cli -p 7545 -i 100` (we use the non-default port for local networks and a fixed network id)
|
* `npm run ganache` - which is basically: `ganache-cli -p 7545 -i 100` (we use the non-default port for local networks and a fixed network id)
|
||||||
* `npm run bootstrap` - bootstrap runs fresh migrations, adds some seed data and writes the address/abi information to JSON that will be used by kredits-web
|
* `npm run bootstrap` - bootstrap runs fresh migrations, adds some seed data and writes the address/abi information to JSON that will be used by kredits-web
|
||||||
* `npm link` - make the `truffle-kredits` module linkable as `kredits-contracts` on your machine
|
* `npm link` - make the `kredits-contracts` module linkable as `kredits-contracts` on your machine
|
||||||
|
|
||||||
#### 3. kredits-web
|
#### 3. kredits-web
|
||||||
|
|
||||||
With IPFS and Ethereum/ganache running, you can now start this Ember app.
|
With IPFS and Ethereum/ganache running, you can now start this Ember app.
|
||||||
|
|
||||||
* `npm link kredits-contracts` - link the local `truffle-kredits` package (it will become `kredits-contracts` soon)
|
* `npm link kredits-contracts` - link the local `kredits-contracts` package
|
||||||
* `npm start`
|
* `npm run start:local` - NETWORK_ID=100 and WEB3_PROVIDER_URL=http://localhost:7545 must be set for local settings
|
||||||
|
|
||||||
#### IPFS
|
#### IPFS
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
import Component from '@ember/component';
|
||||||
|
import { computed } from '@ember/object';
|
||||||
|
|
||||||
|
let categoryColors = {
|
||||||
|
community: "#fb6868",
|
||||||
|
design: "#fbe468",
|
||||||
|
dev: "#e068fb",
|
||||||
|
docs: "#97fb68",
|
||||||
|
ops: "#8f68fb",
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Component.extend({
|
||||||
|
|
||||||
|
contributions: null,
|
||||||
|
|
||||||
|
chartData: computed('contributions', function() {
|
||||||
|
let kredits = this.get('contributions')
|
||||||
|
.map(c => {
|
||||||
|
return { kind: c.kind, amount: c.amount }
|
||||||
|
}).reduce(function (kinds, c) {
|
||||||
|
kinds[c.kind] = (kinds[c.kind] || 0) + c.amount;
|
||||||
|
return kinds;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
return {
|
||||||
|
datasets: [{
|
||||||
|
data: [
|
||||||
|
kredits['community'],
|
||||||
|
kredits['design'],
|
||||||
|
kredits['dev'],
|
||||||
|
kredits['ops'],
|
||||||
|
kredits['docs'],
|
||||||
|
],
|
||||||
|
borderColor: [
|
||||||
|
categoryColors.community,
|
||||||
|
categoryColors.design,
|
||||||
|
categoryColors.dev,
|
||||||
|
categoryColors.ops,
|
||||||
|
categoryColors.docs,
|
||||||
|
],
|
||||||
|
borderWidth: 1
|
||||||
|
}],
|
||||||
|
labels: [
|
||||||
|
'Community',
|
||||||
|
'Design',
|
||||||
|
'Development',
|
||||||
|
'Operations & Infrastructure',
|
||||||
|
'Documentation'
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
|
chartOptions: {
|
||||||
|
legend: {
|
||||||
|
display: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<div class="chart">
|
||||||
|
{{ember-chart type='doughnut'
|
||||||
|
data=chartData
|
||||||
|
options=chartOptions
|
||||||
|
width=200
|
||||||
|
height=200}}
|
||||||
|
</div>
|
||||||
@@ -1,12 +1,20 @@
|
|||||||
{{#each proposals as |proposal|}}
|
{{#each proposals as |proposal|}}
|
||||||
<li data-proposal-id={{proposal.id}} title="({{proposal.kind}}) {{proposal.description}}">
|
<li data-proposal-id={{proposal.id}} class={{if proposal.isExecuted "confirmed" "unconfirmed"}}>
|
||||||
<span class="category {{proposal.kind}}">♥</span>
|
<p class="meta">
|
||||||
<span class="amount">{{proposal.amount}}</span><span class="symbol">₭S</span>
|
<span class="category {{proposal.kind}}">♥ ({{proposal.kind}})</span>
|
||||||
for <span class="recipient">{{proposal.contributor.name}}</span>
|
<span class="recipient">{{proposal.contributor.name}}:</span>
|
||||||
<span class="votes">({{proposal.votesCount}}/{{proposal.votesNeeded}} votes)</span>
|
</p>
|
||||||
|
<p class="kredits-amount">
|
||||||
{{#unless proposal.isExecuted}}
|
<span class="amount">{{proposal.amount}}</span><span class="symbol">₭S</span>
|
||||||
<button {{action "confirm" proposal.id}}>+1</button>
|
</p>
|
||||||
{{/unless}}
|
<p class="description">
|
||||||
|
<span class="description">{{proposal.description}}</span>
|
||||||
|
</p>
|
||||||
|
<p class="voting">
|
||||||
|
{{#unless proposal.isExecuted}}
|
||||||
|
<span class="votes">({{proposal.votesCount}}/{{proposal.votesNeeded}} votes)</span>
|
||||||
|
<button {{action "confirm" proposal.id}}>+1</button>
|
||||||
|
{{/unless}}
|
||||||
|
</p>
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import Controller from '@ember/controller';
|
import Controller from '@ember/controller';
|
||||||
|
import { inject as injectService } from '@ember/service';
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
|
kredits: injectService(),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ const Router = EmberRouter.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
Router.map(function() {
|
Router.map(function() {
|
||||||
this.route('spinner');
|
|
||||||
this.route('proposals', function() {
|
this.route('proposals', function() {
|
||||||
this.route('new');
|
this.route('new');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
import Route from '@ember/routing/route';
|
|
||||||
|
|
||||||
export default Route.extend({
|
|
||||||
});
|
|
||||||
+19
-9
@@ -29,7 +29,6 @@ export default Service.extend({
|
|||||||
return new RSVP.Promise((resolve) => {
|
return new RSVP.Promise((resolve) => {
|
||||||
let ethProvider;
|
let ethProvider;
|
||||||
let networkId;
|
let networkId;
|
||||||
let networkName;
|
|
||||||
if (typeof window.web3 !== 'undefined') {
|
if (typeof window.web3 !== 'undefined') {
|
||||||
console.debug('[kredits] Using user-provided instance, e.g. from Mist browser or Metamask');
|
console.debug('[kredits] Using user-provided instance, e.g. from Mist browser or Metamask');
|
||||||
networkId = parseInt(window.web3.version.network);
|
networkId = parseInt(window.web3.version.network);
|
||||||
@@ -39,27 +38,38 @@ export default Service.extend({
|
|||||||
);
|
);
|
||||||
ethProvider.listAccounts().then((accounts) => {
|
ethProvider.listAccounts().then((accounts) => {
|
||||||
this.set('currentUserAccounts', accounts);
|
this.set('currentUserAccounts', accounts);
|
||||||
resolve(ethProvider, ethProvider.getSigner());
|
const ethSigner = accounts.length === 0 ? null : ethProvider.getSigner();
|
||||||
|
resolve({
|
||||||
|
ethProvider,
|
||||||
|
ethSigner
|
||||||
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.debug('[kredits] Creating new instance from npm module class');
|
console.debug('[kredits] Creating new instance from npm module class');
|
||||||
networkId = parseInt(config.contractMetadata.networkId);
|
networkId = parseInt(config.contractMetadata.networkId);
|
||||||
networkName = config.contractMetadata.networkName;
|
console.debug(`[kredits] networkId=${networkId} providerURL: ${config.web3ProviderUrl}`);
|
||||||
console.log(networkName);
|
ethProvider = new ethers.providers.JsonRpcProvider(
|
||||||
ethProvider = new ethers.providers.InfuraProvider({ chainId: networkId, name: networkName });
|
config.web3ProviderUrl,
|
||||||
resolve(ethProvider, null);
|
{ chainId: networkId }
|
||||||
|
);
|
||||||
|
resolve({
|
||||||
|
ethProvider: ethProvider,
|
||||||
|
ethSigner: null
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
return this.getEthProvider().then((ethProvider, ethSigner) => {
|
return this.getEthProvider().then((providerAndSigner) => {
|
||||||
let kredits = new Kredits(ethProvider, ethSigner);
|
|
||||||
|
let kredits = new Kredits(providerAndSigner.ethProvider, providerAndSigner.ethSigner, {
|
||||||
|
ipfsConfig: config.ipfs
|
||||||
|
});
|
||||||
return kredits
|
return kredits
|
||||||
.init()
|
.init()
|
||||||
.then((kredits) => {
|
.then((kredits) => {
|
||||||
this.set('kredits', kredits);
|
this.set('kredits', kredits);
|
||||||
|
|
||||||
if (this.currentUserAccounts && this.currentUserAccounts.length > 0) {
|
if (this.currentUserAccounts && this.currentUserAccounts.length > 0) {
|
||||||
this.getCurrentUser.then((contributorData) => {
|
this.getCurrentUser.then((contributorData) => {
|
||||||
this.set('currentUser', contributorData);
|
this.set('currentUser', contributorData);
|
||||||
|
|||||||
+14
-1
@@ -5,4 +5,17 @@ $green: #97fb68;
|
|||||||
$yellow: #fbe468;
|
$yellow: #fbe468;
|
||||||
$red: #fb6868;
|
$red: #fb6868;
|
||||||
|
|
||||||
$primaryColor: $blue;
|
$primary-color: $blue;
|
||||||
|
|
||||||
|
$body-text-color: #fff;
|
||||||
|
|
||||||
|
@mixin body-background {
|
||||||
|
background-image: linear-gradient(to bottom, rgba(22, 21, 40, .4), rgba(0, 0, 0, .75)), url('/img/bg.jpg');
|
||||||
|
background-repeat: none;
|
||||||
|
background-attachment: fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
#topbar {
|
||||||
|
background-color: rgba(255, 0, 255, .2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
+36
-14
@@ -1,31 +1,53 @@
|
|||||||
section {
|
#topbar {
|
||||||
@include outer-container;
|
height: 3rem;
|
||||||
margin-bottom: 8rem;
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
padding: 1rem;
|
||||||
|
|
||||||
|
&#index {
|
||||||
|
width: 100%;
|
||||||
|
display: grid;
|
||||||
|
grid-row-gap: 2rem;
|
||||||
|
grid-template-areas:
|
||||||
|
"stats"
|
||||||
|
"contributions";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 550px) {
|
||||||
|
main {
|
||||||
|
&#index {
|
||||||
|
grid-column-gap: 4rem;
|
||||||
|
grid-row-gap: 2rem;
|
||||||
|
grid-template-columns: 2fr 4fr;
|
||||||
|
grid-template-areas:
|
||||||
|
"stats contributions";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
main section {
|
||||||
|
margin-bottom: 5rem;
|
||||||
|
|
||||||
&:first-of-type {
|
&:first-of-type {
|
||||||
margin-top: 6rem;
|
margin-top: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@include media($mobile) {
|
@include media($mobile) {
|
||||||
margin-bottom: 5rem;
|
margin-bottom: 5rem;
|
||||||
&:first-of-type {
|
|
||||||
margin-top: 2rem;
|
&#proposals-open, &#proposals-closed {
|
||||||
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
header {
|
header {
|
||||||
@include span-columns(12);
|
|
||||||
padding-bottom: 3rem;
|
padding-bottom: 3rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
// background-color: purple;
|
|
||||||
|
|
||||||
@include media($mobile) {
|
@include media($mobile) {
|
||||||
@include span-columns(10);
|
|
||||||
@include shift(1);
|
|
||||||
padding-bottom: 2rem;
|
padding-bottom: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.content {
|
|
||||||
@include span-columns(12);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+30
-14
@@ -2,6 +2,7 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
*:hover, *:active, *:focus {
|
*:hover, *:active, *:focus {
|
||||||
@@ -20,13 +21,10 @@
|
|||||||
$font-family-sans: 'Open Sans', sans-serif;
|
$font-family-sans: 'Open Sans', sans-serif;
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-image: url('/img/bg.jpg');
|
@include body-background;
|
||||||
background-repeat: none;
|
|
||||||
background-attachment: fixed;
|
|
||||||
font-family: $font-family-sans;
|
font-family: $font-family-sans;
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
color: #fff;
|
color: $body-text-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 900px) {
|
@media screen and (min-width: 900px) {
|
||||||
@@ -43,14 +41,11 @@ h1, h2, h3, h4, h5, input, button {
|
|||||||
|
|
||||||
section {
|
section {
|
||||||
h2 {
|
h2 {
|
||||||
font-size: 2.8rem;
|
font-size: 1.4rem;
|
||||||
color: $primaryColor;
|
color: $primary-color;
|
||||||
@include media($mobile) {
|
|
||||||
font-size: 2rem;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&#contributors {
|
&#people {
|
||||||
.content {
|
.content {
|
||||||
p.stats {
|
p.stats {
|
||||||
padding-top: 3rem;
|
padding-top: 3rem;
|
||||||
@@ -67,18 +62,30 @@ section {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&#contributions-by-type {
|
||||||
|
.chart {
|
||||||
|
width: 50%;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include media($mobile) {
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&#proposals-open, &#proposals-closed {
|
&#proposals-open, &#proposals-closed {
|
||||||
.actions {
|
.actions {
|
||||||
padding-top: 3rem;
|
padding-top: 3rem;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
color: $primaryColor;
|
color: $primary-color;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@include media($mobile) {
|
@include media($mobile) {
|
||||||
padding-top: 2rem;
|
padding-top: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: $primaryColor;
|
color: $primary-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,7 +95,7 @@ button, input[type=submit] {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
border: 1px solid rgba(22, 21, 40, 1);
|
border: 1px solid rgba(22, 21, 40, 1);
|
||||||
background-color: rgba(22, 21, 40, 0.6);
|
background-color: rgba(22, 21, 40, 0.6);
|
||||||
color: $primaryColor;
|
color: $primary-color;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
@@ -100,6 +107,15 @@ button, input[type=submit] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width: 550px) {
|
||||||
|
section {
|
||||||
|
h2 {
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@import "components/topbar";
|
||||||
@import "components/loading-spinner";
|
@import "components/loading-spinner";
|
||||||
@import "components/contributor-list";
|
@import "components/contributor-list";
|
||||||
@import "components/add-contributor";
|
@import "components/add-contributor";
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ section#add-contributor, section#add-proposal {
|
|||||||
padding-top: 1rem;
|
padding-top: 1rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
a {
|
a {
|
||||||
color: $primaryColor;
|
color: $primary-color;
|
||||||
margin-left: 1rem;
|
margin-left: 1rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ table.contributor-list {
|
|||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: $primaryColor;
|
color: $primary-color;
|
||||||
&:hover, &:active {
|
&:hover, &:active {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
margin-top: 12rem;
|
margin-top: 12rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 1.4rem;
|
font-size: 1.4rem;
|
||||||
color: $primaryColor;
|
color: $primary-color;
|
||||||
|
|
||||||
@include media($mobile) {
|
@include media($mobile) {
|
||||||
margin-top: 6rem;
|
margin-top: 6rem;
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
|
|
||||||
#path-comet {
|
#path-comet {
|
||||||
fill: $primaryColor;
|
fill: $primary-color;
|
||||||
opacity: 0.1;
|
opacity: 0.1;
|
||||||
|
|
||||||
animation-name: pulse;
|
animation-name: pulse;
|
||||||
|
|||||||
@@ -4,16 +4,46 @@ ul.proposal-list {
|
|||||||
list-style: none;
|
list-style: none;
|
||||||
|
|
||||||
li {
|
li {
|
||||||
// display: block;
|
display: grid;
|
||||||
padding: 0 1.2rem;
|
grid-template-columns: auto 5rem;
|
||||||
line-height: 4.2rem;
|
grid-row-gap: 0.5rem;
|
||||||
|
padding: 1rem 1.2rem;
|
||||||
background-color: rgba(255,255,255,0.1);
|
background-color: rgba(255,255,255,0.1);
|
||||||
font-size: 1.4rem;
|
font-size: 1.2rem;
|
||||||
border-bottom: 1px solid rgba(255,255,255,0.2);
|
border-bottom: 1px solid rgba(255,255,255,0.2);
|
||||||
|
|
||||||
&: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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
align-self: center;
|
||||||
|
margin: 0;
|
||||||
|
font-size: inherit;
|
||||||
|
line-height: 2rem;
|
||||||
|
|
||||||
|
&.kredits-amount, &.voting {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.description {
|
||||||
|
grid-column-start: span 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.voting {
|
||||||
|
grid-column-start: span 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.description {
|
||||||
|
line-height: 1.4em;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.category {
|
.category {
|
||||||
color: $blue;
|
color: $blue;
|
||||||
padding-right: 0.2rem;
|
padding-right: 0.2rem;
|
||||||
@@ -23,26 +53,28 @@ ul.proposal-list {
|
|||||||
&.docs { color: $green; }
|
&.docs { color: $green; }
|
||||||
&.ops { color: $purple; }
|
&.ops { color: $purple; }
|
||||||
}
|
}
|
||||||
|
|
||||||
.amount {
|
.amount {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.symbol {
|
.symbol {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
padding-left: 0.2rem;
|
padding-left: 0.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.recipient {
|
.recipient {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.votes {
|
.votes {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
color: $primaryColor;
|
color: $primary-color;
|
||||||
padding-left: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
float: right;
|
|
||||||
margin-top: 1.1rem;
|
|
||||||
height: 2rem;
|
height: 2rem;
|
||||||
line-height: 2rem;
|
line-height: 2rem;
|
||||||
padding: 0 0.6rem;
|
padding: 0 0.6rem;
|
||||||
@@ -50,3 +82,39 @@ ul.proposal-list {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width: 550px) {
|
||||||
|
ul.proposal-list {
|
||||||
|
li {
|
||||||
|
grid-template-columns: auto 10rem;
|
||||||
|
grid-row-gap: 0.5rem;
|
||||||
|
|
||||||
|
p {
|
||||||
|
&.kredits-amount, &.voting {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.unconfirmed {
|
||||||
|
p {
|
||||||
|
&.kredits-amount, &.voting {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.description {
|
||||||
|
grid-column-start: span 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.voting {
|
||||||
|
grid-column-start: span 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.description {
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#topbar {
|
||||||
|
padding: 0 1rem;
|
||||||
|
line-height: 3rem;
|
||||||
|
background-color: rgba(0,0,0,.3);
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
display: inline-block;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
section#user-account {
|
||||||
|
display: inline-block;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,4 +2,4 @@
|
|||||||
// $visual-grid-color: red;
|
// $visual-grid-color: red;
|
||||||
// $visual-grid-index: front;
|
// $visual-grid-index: front;
|
||||||
// $visual-grid-opacity: 0.5;
|
// $visual-grid-opacity: 0.5;
|
||||||
$max-width: em(500, 12);
|
$max-width: em(1200, 12);
|
||||||
|
|||||||
@@ -1,3 +1,16 @@
|
|||||||
<main>
|
<header id="topbar">
|
||||||
{{outlet}}
|
<h1>Kosmos Kredits</h1>
|
||||||
</main>
|
|
||||||
|
<section id="user-account">
|
||||||
|
{{#if kredits.hasAccounts }}
|
||||||
|
{{#if kredits.currentUser}}
|
||||||
|
{{kredits.currentUser.name}}
|
||||||
|
{{#if kredits.currentUserIsCore}}(core){{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
|
Anonymous
|
||||||
|
{{/if}}
|
||||||
|
</section>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
{{outlet}}
|
||||||
|
|||||||
+63
-63
@@ -1,39 +1,53 @@
|
|||||||
{{#if kredits.hasAccounts }}
|
<main id="index">
|
||||||
<section id="user-account">
|
|
||||||
{{#if kredits.currentUser }}
|
|
||||||
{{ kredits.currentUser.name }}
|
|
||||||
{{#if kredits.currentUserIsCore }}
|
|
||||||
(core)
|
|
||||||
{{/if}}
|
|
||||||
Account: {{kredits.currentUser.account}}
|
|
||||||
{{/if}}
|
|
||||||
</section>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<section id="contributors">
|
<div id="stats">
|
||||||
<header>
|
<section id="people">
|
||||||
<h2>Kosmos Contributors</h2>
|
<header>
|
||||||
</header>
|
<h2>Contributors</h2>
|
||||||
<div class="content">
|
</header>
|
||||||
{{contributor-list contributors=contributorsSorted}}
|
<div class="content">
|
||||||
|
{{contributor-list contributors=contributorsSorted}}
|
||||||
|
|
||||||
<p class="stats">
|
<p class="stats">
|
||||||
<span class="number">{{await kredits.totalSupply}}</span> kredits issued and distributed among
|
<span class="number">{{await kredits.totalSupply}}</span> kredits issued and distributed among
|
||||||
<span class="number">{{contributorsWithKredits.length}}</span> contributors.
|
<span class="number">{{contributorsWithKredits.length}}</span> contributors.
|
||||||
</p>
|
</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="contributions-by-type">
|
||||||
|
<header>
|
||||||
|
<h2>Contributions by type</h2>
|
||||||
|
</header>
|
||||||
|
<div class="content">
|
||||||
|
{{chart-contributions-by-type contributions=proposals}}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
|
||||||
|
|
||||||
{{#if proposalsOpen}}
|
<div id="contributions">
|
||||||
<section id="proposals-open">
|
{{#if proposalsOpen}}
|
||||||
<header>
|
<section id="proposals-open">
|
||||||
<h2>Open Proposals</h2>
|
<header>
|
||||||
</header>
|
<h2>Unconfirmed Contributions</h2>
|
||||||
<div class="content">
|
</header>
|
||||||
{{!-- TODO: We need a better naming for kredits.hasAccounts --}}
|
<div class="content">
|
||||||
{{proposal-list proposals=proposalsOpenSorted
|
{{!-- TODO: We need a better naming for kredits.hasAccounts --}}
|
||||||
confirmProposal=(action "confirmProposal")
|
{{proposal-list proposals=proposalsOpenSorted
|
||||||
contractInteractionEnabled=kredits.hasAccounts}}
|
confirmProposal=(action "confirmProposal")
|
||||||
|
contractInteractionEnabled=kredits.hasAccounts}}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<section id="proposals-closed">
|
||||||
|
<header>
|
||||||
|
<h2>Confirmed Contributions</h2>
|
||||||
|
</header>
|
||||||
|
<div class="content">
|
||||||
|
{{proposal-list proposals=proposalsClosedSorted
|
||||||
|
confirmProposal=(action "confirmProposal")}}
|
||||||
|
</div>
|
||||||
|
|
||||||
{{!-- TODO: We need a better naming --}}
|
{{!-- TODO: We need a better naming --}}
|
||||||
{{#if kredits.hasAccounts}}
|
{{#if kredits.hasAccounts}}
|
||||||
@@ -41,37 +55,23 @@
|
|||||||
{{#link-to 'proposals.new'}}Create new proposal{{/link-to}}
|
{{#link-to 'proposals.new'}}Create new proposal{{/link-to}}
|
||||||
</p>
|
</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</section>
|
||||||
</section>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<section id="proposals-closed">
|
|
||||||
<header>
|
|
||||||
<h2>Closed Proposals</h2>
|
|
||||||
</header>
|
|
||||||
<div class="content">
|
|
||||||
{{proposal-list proposals=proposalsClosedSorted
|
|
||||||
confirmProposal=(action "confirmProposal")}}
|
|
||||||
|
|
||||||
{{!-- TODO: We need a better naming --}}
|
|
||||||
{{#if kredits.hasAccounts}}
|
|
||||||
<p class="actions">
|
|
||||||
{{#link-to 'proposals.new'}}Create new proposal{{/link-to}}
|
|
||||||
</p>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
|
||||||
|
|
||||||
<section id="add-contributor">
|
{{#if kredits.hasAccounts}}
|
||||||
<header>
|
<section id="add-contributor">
|
||||||
<h2>Add Contributor</h2>
|
<header>
|
||||||
</header>
|
<h2>Add Contributor</h2>
|
||||||
|
</header>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{{#if kredits.currentUser.isCore}}
|
{{#if kredits.currentUser.isCore}}
|
||||||
{{add-contributor contributors=contributors save=(action 'save')}}
|
{{add-contributor contributors=contributors save=(action 'save')}}
|
||||||
{{else}}
|
{{else}}
|
||||||
Only core team members can add new contributors. Please ask someone to set you up.
|
Only core team members can add new contributors. Please ask someone to set you up.
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
{{loading-spinner}}
|
|
||||||
@@ -35,9 +35,9 @@ module.exports = function(environment) {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
contractMetadata: { networkId: '42', networkName: 'kovan' },
|
contractMetadata: { networkId: '42' },
|
||||||
|
|
||||||
web3ProviderUrl: 'https://parity.kosmos.org:8545',
|
web3ProviderUrl: 'https://kovan.infura.io/keUVk6OMaAvpmRF3m57n',
|
||||||
|
|
||||||
ipfs: {
|
ipfs: {
|
||||||
host: 'ipfs.kosmos.org',
|
host: 'ipfs.kosmos.org',
|
||||||
@@ -52,8 +52,8 @@ module.exports = function(environment) {
|
|||||||
// ENV.APP.LOG_TRANSITIONS = true;
|
// ENV.APP.LOG_TRANSITIONS = true;
|
||||||
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
|
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
|
||||||
// ENV.APP.LOG_VIEW_LOOKUPS = true;
|
// ENV.APP.LOG_VIEW_LOOKUPS = true;
|
||||||
ENV.contractMetadata['networkId'] = '100';
|
ENV.contractMetadata['networkId'] = '42';
|
||||||
ENV.web3ProviderUrl = 'http://localhost:7545';
|
ENV.web3ProviderUrl = 'https://kovan.infura.io/keUVk6OMaAvpmRF3m57n';
|
||||||
|
|
||||||
ENV.ipfs = {
|
ENV.ipfs = {
|
||||||
host: 'localhost',
|
host: 'localhost',
|
||||||
@@ -81,9 +81,6 @@ module.exports = function(environment) {
|
|||||||
if (process.env.NETWORK_ID) {
|
if (process.env.NETWORK_ID) {
|
||||||
ENV.contractMetadata['networkId'] = process.env.NETWORK_ID;
|
ENV.contractMetadata['networkId'] = process.env.NETWORK_ID;
|
||||||
}
|
}
|
||||||
if (process.env.NETWORK_NAME) {
|
|
||||||
ENV.contractMetadata['networkName'] = process.env.NETWORK_NAME;
|
|
||||||
}
|
|
||||||
if (process.env.WEB3_PROVIDER_URL) {
|
if (process.env.WEB3_PROVIDER_URL) {
|
||||||
ENV.web3ProviderUrl = process.env.WEB3_PROVIDER_URL;
|
ENV.web3ProviderUrl = process.env.WEB3_PROVIDER_URL;
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+4392
-4237
File diff suppressed because it is too large
Load Diff
+3
-2
@@ -13,7 +13,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"lint:js": "eslint ./*.js app config lib server tests",
|
"lint:js": "eslint ./*.js app config lib server tests",
|
||||||
"start": "ember serve",
|
"start": "ember serve",
|
||||||
"kovan": "NETWORK_ID=42 ember serve",
|
"start:local": "NETWORK_ID=100 WEB3_PROVIDER_URL=http://localhost:7545 ember s",
|
||||||
"test": "ember test",
|
"test": "ember test",
|
||||||
"build": "ember build",
|
"build": "ember build",
|
||||||
"build-prod": "ember build --environment production",
|
"build-prod": "ember build --environment production",
|
||||||
@@ -30,6 +30,7 @@
|
|||||||
"ember-cli": "~3.1.2",
|
"ember-cli": "~3.1.2",
|
||||||
"ember-cli-app-version": "^3.0.0",
|
"ember-cli-app-version": "^3.0.0",
|
||||||
"ember-cli-babel": "^6.6.0",
|
"ember-cli-babel": "^6.6.0",
|
||||||
|
"ember-cli-chart": "^3.4.0",
|
||||||
"ember-cli-dependency-checker": "^2.0.0",
|
"ember-cli-dependency-checker": "^2.0.0",
|
||||||
"ember-cli-eslint": "^4.2.1",
|
"ember-cli-eslint": "^4.2.1",
|
||||||
"ember-cli-htmlbars": "^2.0.1",
|
"ember-cli-htmlbars": "^2.0.1",
|
||||||
@@ -51,7 +52,7 @@
|
|||||||
"eslint-plugin-ember": "^5.0.0",
|
"eslint-plugin-ember": "^5.0.0",
|
||||||
"ethers": "3.0.15",
|
"ethers": "3.0.15",
|
||||||
"kosmos-schemas": "^1.1.2",
|
"kosmos-schemas": "^1.1.2",
|
||||||
"kredits-contracts": "github:67P/truffle-kredits",
|
"kredits-contracts": "^3.x",
|
||||||
"loader.js": "^4.2.3",
|
"loader.js": "^4.2.3",
|
||||||
"tv4": "^1.3.0"
|
"tv4": "^1.3.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { module, test } from 'qunit';
|
||||||
|
import { setupRenderingTest } from 'ember-qunit';
|
||||||
|
import { render } from '@ember/test-helpers';
|
||||||
|
import hbs from 'htmlbars-inline-precompile';
|
||||||
|
|
||||||
|
module('Integration | Component | chart-contributions-by-type', function(hooks) {
|
||||||
|
setupRenderingTest(hooks);
|
||||||
|
|
||||||
|
let proposals = [
|
||||||
|
{ kind: 'dev', amount: 500 },
|
||||||
|
{ kind: 'dev', amount: 1500 },
|
||||||
|
{ kind: 'ops', amount: 1500 },
|
||||||
|
{ kind: 'design', amount: 5000 },
|
||||||
|
{ kind: 'ops', amount: 1500 },
|
||||||
|
{ kind: 'dev', amount: 5000 },
|
||||||
|
{ kind: 'community', amount: 5000 },
|
||||||
|
{ kind: 'docs', amount: 500 },
|
||||||
|
{ kind: 'docs', amount: 500 },
|
||||||
|
{ kind: 'docs', amount: 500 },
|
||||||
|
];
|
||||||
|
|
||||||
|
test('it renders', async function(assert) {
|
||||||
|
this.set('proposals', proposals);
|
||||||
|
|
||||||
|
await render(hbs`{{chart-contributions-by-type contributions=proposals}}`);
|
||||||
|
|
||||||
|
assert.equal(this.element.textContent.trim(), '');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import { module, test } from 'qunit';
|
||||||
|
import { setupTest } from 'ember-qunit';
|
||||||
|
|
||||||
|
module('Unit | Component | chart-contributions-by-type', function(hooks) {
|
||||||
|
setupTest(hooks);
|
||||||
|
|
||||||
|
let proposals = [
|
||||||
|
{ kind: 'dev', amount: 500 },
|
||||||
|
{ kind: 'dev', amount: 1500 },
|
||||||
|
{ kind: 'ops', amount: 1500 },
|
||||||
|
{ kind: 'design', amount: 5000 },
|
||||||
|
{ kind: 'ops', amount: 1500 },
|
||||||
|
{ kind: 'dev', amount: 5000 },
|
||||||
|
{ kind: 'community', amount: 5000 },
|
||||||
|
{ kind: 'docs', amount: 500 },
|
||||||
|
{ kind: 'docs', amount: 500 },
|
||||||
|
{ kind: 'docs', amount: 500 },
|
||||||
|
];
|
||||||
|
|
||||||
|
test('#chartData', function(assert) {
|
||||||
|
let component = this.owner.factoryFor('component:chart-contributions-by-type').create();
|
||||||
|
component.set('contributions', proposals);
|
||||||
|
|
||||||
|
let data = component.get('chartData');
|
||||||
|
|
||||||
|
assert.deepEqual(
|
||||||
|
data.labels,
|
||||||
|
['Community', 'Design', 'Development', 'Operations & Infrastructure', 'Documentation'],
|
||||||
|
'returns the correct labels'
|
||||||
|
);
|
||||||
|
assert.deepEqual(
|
||||||
|
data.datasets[0].data,
|
||||||
|
[5000, 5000, 7000, 3000, 1500],
|
||||||
|
'returns the correct kredit sums'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import { module, test } from 'qunit';
|
|
||||||
import { setupTest } from 'ember-qunit';
|
|
||||||
|
|
||||||
module('Unit | Route | spinner', function(hooks) {
|
|
||||||
setupTest(hooks);
|
|
||||||
|
|
||||||
test('it exists', function(assert) {
|
|
||||||
let route = this.owner.lookup('route:spinner');
|
|
||||||
assert.ok(route);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user