diff --git a/app/components/add-contributor/component.js b/app/components/add-contributor/component.js
index 36c2097..118aba3 100644
--- a/app/components/add-contributor/component.js
+++ b/app/components/add-contributor/component.js
@@ -1,7 +1,9 @@
import Component from '@ember/component';
+import { computed } from '@ember/object';
import { and, notEmpty } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import { isPresent } from '@ember/utils';
+import { isAddress } from 'web3-utils';
export default Component.extend({
@@ -9,14 +11,17 @@ export default Component.extend({
attributes: null,
- // TODO: add proper address validation
- isValidAccount: notEmpty('account'),
+ isValidAccount: computed('account', function() {
+ return isAddress(this.account);
+ }),
+
isValidName: notEmpty('name'),
isValidURL: notEmpty('url'),
isValidGithubUID: notEmpty('github_uid'),
isValidGithubUsername: notEmpty('github_username'),
isValidGiteaUsername: notEmpty('gitea_username'),
isValidWikiUsername: notEmpty('wiki_username'),
+
isValid: and(
'isValidAccount',
'isValidName',
diff --git a/app/components/topbar-account-panel/component.js b/app/components/topbar-account-panel/component.js
new file mode 100644
index 0000000..65185e7
--- /dev/null
+++ b/app/components/topbar-account-panel/component.js
@@ -0,0 +1,19 @@
+import Component from '@ember/component';
+import { inject as service } from '@ember/service';
+
+export default Component.extend({
+
+ tagName: '',
+
+ kredits: service(),
+ router: service(),
+
+ actions: {
+
+ signup() {
+ this.router.transitionTo('signup');
+ }
+
+ }
+
+});
diff --git a/app/components/topbar-account-panel/template.hbs b/app/components/topbar-account-panel/template.hbs
new file mode 100644
index 0000000..0731a4c
--- /dev/null
+++ b/app/components/topbar-account-panel/template.hbs
@@ -0,0 +1,11 @@
+
+ {{#if (and kredits.hasAccounts kredits.currentUser)}}
+ {{kredits.currentUser.name}}
+ {{#if kredits.currentUserIsCore}}
+ (core)
+ {{/if}}
+ {{else}}
+ Anonymous
+ Sign up
+ {{/if}}
+
\ No newline at end of file
diff --git a/app/controllers/signup/eth-account.js b/app/controllers/signup/eth-account.js
new file mode 100644
index 0000000..1a29880
--- /dev/null
+++ b/app/controllers/signup/eth-account.js
@@ -0,0 +1,49 @@
+import Controller from '@ember/controller';
+import { computed } from '@ember/object';
+import { alias, not } from '@ember/object/computed';
+import { isAddress } from 'web3-utils';
+import { inject as service } from '@ember/service';
+import config from 'kredits-web/config/environment';
+
+export default Controller.extend({
+
+ kredits: service(),
+
+ ethAddress: null,
+ githubAccessToken: alias('kredits.githubAccessToken'),
+
+ isValidEthAccount: computed('ethAddress', function() {
+ return isAddress(this.ethAddress);
+ }),
+
+ signupButtonDisabled: not('isValidEthAccount'),
+
+ actions: {
+
+ completeSignup () {
+ const payload = {
+ accessToken: this.githubAccessToken,
+ account: this.ethAddress
+ }
+
+ fetch(config.githubSignupUrl, {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify(payload)
+ })
+ .then(res => res.json())
+ .then(data => {
+ console.log('Created contributor:', data);
+
+ this.setProperties({
+ githubAccessToken: null,
+ ethAddress: null
+ });
+
+ this.transitionToRoute('signup.complete');
+ });
+ }
+
+ }
+
+});
diff --git a/app/controllers/signup/index.js b/app/controllers/signup/index.js
new file mode 100644
index 0000000..d90035c
--- /dev/null
+++ b/app/controllers/signup/index.js
@@ -0,0 +1,14 @@
+import Controller from '@ember/controller';
+import config from 'kredits-web/config/environment';
+
+export default Controller.extend({
+
+ actions: {
+
+ connectGithub () {
+ window.location = config.githubConnectUrl;
+ }
+
+ }
+
+});
diff --git a/app/router.js b/app/router.js
index 339fd9e..e2c6349 100644
--- a/app/router.js
+++ b/app/router.js
@@ -26,6 +26,11 @@ Router.map(function() {
this.route('new');
this.route('edit', { path: ':id/edit' });
});
+ this.route('signup', function() {
+ this.route('github');
+ this.route('eth-account');
+ this.route('complete');
+ });
});
export default Router;
diff --git a/app/routes/signup.js b/app/routes/signup.js
new file mode 100644
index 0000000..6c74252
--- /dev/null
+++ b/app/routes/signup.js
@@ -0,0 +1,4 @@
+import Route from '@ember/routing/route';
+
+export default Route.extend({
+});
diff --git a/app/routes/signup/complete.js b/app/routes/signup/complete.js
new file mode 100644
index 0000000..6c74252
--- /dev/null
+++ b/app/routes/signup/complete.js
@@ -0,0 +1,4 @@
+import Route from '@ember/routing/route';
+
+export default Route.extend({
+});
diff --git a/app/routes/signup/eth-account.js b/app/routes/signup/eth-account.js
new file mode 100644
index 0000000..078a109
--- /dev/null
+++ b/app/routes/signup/eth-account.js
@@ -0,0 +1,17 @@
+import Route from '@ember/routing/route';
+import { inject as service } from '@ember/service';
+import { isEmpty } from '@ember/utils';
+
+export default Route.extend({
+
+ kredits: service(),
+
+ redirect () {
+ this._super(...arguments);
+
+ if (isEmpty(this.kredits.githubAccessToken)) {
+ this.transitionTo('signup.index');
+ }
+ }
+
+});
diff --git a/app/routes/signup/github.js b/app/routes/signup/github.js
new file mode 100644
index 0000000..7ad6798
--- /dev/null
+++ b/app/routes/signup/github.js
@@ -0,0 +1,29 @@
+import Route from '@ember/routing/route';
+import { inject as service } from '@ember/service';
+import { isEmpty } from '@ember/utils';
+
+export default Route.extend({
+
+ kredits: service(),
+
+ redirect () {
+ this._super(...arguments);
+
+ let accessToken;
+ try {
+ accessToken = window.location.hash.match(/access_token=(.+)/)[1];
+ } catch (error) { /* ignore */ }
+
+ if (isEmpty(accessToken) || accessToken === 'undefined') {
+ console.error('No GitHub access token found.');
+ this.transitionTo('signup');
+ return;
+ }
+
+ this.kredits.set('githubAccessToken', accessToken);
+
+ this.transitionTo('signup.eth-account');
+ }
+
+});
+
diff --git a/app/services/kredits.js b/app/services/kredits.js
index e31e714..a1b9ec2 100644
--- a/app/services/kredits.js
+++ b/app/services/kredits.js
@@ -24,6 +24,7 @@ export default Service.extend({
contributors: null,
contributions: null,
proposals: null,
+ githubAccessToken: null,
currentUserIsContributor: notEmpty('currentUser'),
currentUserIsCore: alias('currentUser.isCore'),
diff --git a/app/styles/_buttons.scss b/app/styles/_buttons.scss
index 0e80146..eea2c90 100644
--- a/app/styles/_buttons.scss
+++ b/app/styles/_buttons.scss
@@ -23,6 +23,10 @@ button, input[type=submit], .button {
border-color: $primary-color;
}
+ &[disabled] {
+ color: rgba(255,255,255,0.5);
+ }
+
&.small {
font-size: 0.8rem;
padding: 0.2rem 0.8rem;
@@ -53,4 +57,17 @@ button, input[type=submit], .button {
border-color: $green;
}
}
+
+ &.icon {
+ svg {
+ width: 2rem;
+ height: 2rem;
+ vertical-align: middle;
+ margin-right: 1rem;
+
+ .fg {
+ fill: $primary-color;
+ }
+ }
+ }
}
diff --git a/app/styles/_forms.scss b/app/styles/_forms.scss
index 75f3067..1de0966 100644
--- a/app/styles/_forms.scss
+++ b/app/styles/_forms.scss
@@ -1,12 +1,17 @@
section#add-contributor,
section#add-contribution,
-section#add-proposal {
+section#add-proposal,
+section#signup {
form {
p {
margin-bottom: 1.5rem;
+ &.mg-bottom-md {
+ margin-bottom: 2rem;
+ }
+
&.label {
margin-bottom: .5rem;
}
diff --git a/app/styles/_layout.scss b/app/styles/_layout.scss
index f025692..bd95fe8 100644
--- a/app/styles/_layout.scss
+++ b/app/styles/_layout.scss
@@ -28,6 +28,37 @@ main {
}
}
}
+
+ section {
+ .content {
+ a {
+ font-size: inherit;
+ }
+
+ &.text-lg {
+ p {
+ font-size: 1.2rem;
+ margin-bottom: 1em;
+ line-height: 1.5em;
+ }
+ }
+
+ &.text-center {
+ text-align: center;
+ }
+
+ p {
+ &.mg-bottom-md {
+ margin-bottom: 2rem;
+ }
+
+ &.actions {
+ text-align: center;
+ padding-top: 2rem;
+ }
+ }
+ }
+ }
}
@media (min-width: 550px) {
diff --git a/app/styles/app.scss b/app/styles/app.scss
index 5db3cf8..8396a20 100644
--- a/app/styles/app.scss
+++ b/app/styles/app.scss
@@ -38,6 +38,10 @@ h1, h2, h3, h4, h5, input, button {
font-weight: 300;
}
+a {
+ color: $primary-color;
+}
+
section {
h2 {
font-size: 1.4rem;
@@ -106,4 +110,5 @@ section {
@import "components/loading-spinner";
@import "components/proposal-list";
@import "components/topbar";
+@import "components/topbar-account-panel";
@import "components/user-avatar";
diff --git a/app/styles/components/_topbar-account-panel.scss b/app/styles/components/_topbar-account-panel.scss
new file mode 100644
index 0000000..900eb04
--- /dev/null
+++ b/app/styles/components/_topbar-account-panel.scss
@@ -0,0 +1,7 @@
+header#topbar section#user-account {
+
+ button {
+ margin-left: 1.2rem;
+ }
+
+}
diff --git a/app/templates/application.hbs b/app/templates/application.hbs
index d82b972..11b8e12 100644
--- a/app/templates/application.hbs
+++ b/app/templates/application.hbs
@@ -1,16 +1,6 @@
{{link-to "Kosmos Kredits" "dashboard"}}
-
-
- {{#if kredits.hasAccounts }}
- {{#if kredits.currentUser}}
- {{kredits.currentUser.name}}
- {{#if kredits.currentUserIsCore}}(core){{/if}}
- {{/if}}
- {{else}}
- Anonymous
- {{/if}}
-
+ {{topbar-account-panel}}
{{outlet}}
diff --git a/app/templates/signup.hbs b/app/templates/signup.hbs
new file mode 100644
index 0000000..2e18661
--- /dev/null
+++ b/app/templates/signup.hbs
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/app/templates/signup/complete.hbs b/app/templates/signup/complete.hbs
new file mode 100644
index 0000000..189db7a
--- /dev/null
+++ b/app/templates/signup/complete.hbs
@@ -0,0 +1,15 @@
+
+
+
+ Congratulations. Your initial profile is now complete.
+
+
+ Why not say hi to your fellow contributors
+ in one of our chat rooms ?.
+
+
+ {{#link-to "dashboard" class="button small"}}Return to dashboard{{/link-to}}
+
+
\ No newline at end of file
diff --git a/app/templates/signup/eth-account.hbs b/app/templates/signup/eth-account.hbs
new file mode 100644
index 0000000..b69dca9
--- /dev/null
+++ b/app/templates/signup/eth-account.hbs
@@ -0,0 +1,25 @@
+
+ Complete your contributor profile
+
+
+
+ Kredits allow you to take part in project governance, and to earn rewards for
+ your contributions. For both, you will need an Ethereum wallet/account.
+
+
+
+
+ Complete my profile
+
+
+
\ No newline at end of file
diff --git a/app/templates/signup/index.hbs b/app/templates/signup/index.hbs
new file mode 100644
index 0000000..b3296e6
--- /dev/null
+++ b/app/templates/signup/index.hbs
@@ -0,0 +1,20 @@
+
+ Create your contributor profile
+
+
+
+ You have already contributed to a Kosmos project, or you are interested
+ in contributing in the near future? Fantastic!
+
+
+ In order to earn kredits for your contributions, you will need a
+ registered contributor profile. The quickest way to register is by
+ connecting one of the following accounts:
+
+
+
+ {{icon-account-github-com}}
+ Connect GitHub
+
+
+
diff --git a/config/environment.js b/config/environment.js
index 8c2d067..393e14d 100644
--- a/config/environment.js
+++ b/config/environment.js
@@ -37,6 +37,9 @@ module.exports = function(environment) {
web3ProviderUrl: 'https://rinkeby.infura.io/v3/d4f788b7a6584f7db2fc3c268d4d09e9',
+ githubConnectUrl: 'https://hal8000.chat.kosmos.org/kredits/signup/connect/github',
+ githubSignupUrl: 'https://hal8000.chat.kosmos.org/kredits/signup/github',
+
ipfs: {
host: 'ipfs.kosmos.org',
port: '5444',
@@ -53,6 +56,9 @@ module.exports = function(environment) {
// ENV.APP.LOG_VIEW_LOOKUPS = true;
ENV.web3ProviderUrl = 'https://rinkeby.infura.io/v3/d4f788b7a6584f7db2fc3c268d4d09e9';
+ ENV.githubConnectUrl = 'http://localhost:8888/kredits/signup/connect/github';
+ ENV.githubSignupUrl = 'http://localhost:8888/kredits/signup/github';
+
ENV.ipfs = {
host: 'localhost',
port: '5001',
diff --git a/package-lock.json b/package-lock.json
index 67dba2e..cce2b9f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4241,6 +4241,12 @@
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
"dev": true
},
+ "buffer-to-arraybuffer": {
+ "version": "0.0.5",
+ "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz",
+ "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=",
+ "dev": true
+ },
"buffer-xor": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz",
@@ -5636,6 +5642,12 @@
"esutils": "^2.0.2"
}
},
+ "dom-walk": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz",
+ "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=",
+ "dev": true
+ },
"domain-browser": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.1.7.tgz",
@@ -8414,6 +8426,17 @@
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=",
"dev": true
},
+ "eth-lib": {
+ "version": "0.2.7",
+ "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz",
+ "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=",
+ "dev": true,
+ "requires": {
+ "bn.js": "^4.11.6",
+ "elliptic": "^6.4.0",
+ "xhr-request-promise": "^0.1.2"
+ }
+ },
"ethers": {
"version": "4.0.27",
"resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.27.tgz",
@@ -8468,6 +8491,24 @@
}
}
},
+ "ethjs-unit": {
+ "version": "0.1.6",
+ "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz",
+ "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=",
+ "dev": true,
+ "requires": {
+ "bn.js": "4.11.6",
+ "number-to-bn": "1.7.0"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.6",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz",
+ "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=",
+ "dev": true
+ }
+ }
+ },
"event-emitter": {
"version": "0.3.5",
"resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz",
@@ -9245,6 +9286,15 @@
}
}
},
+ "for-each": {
+ "version": "0.3.3",
+ "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
+ "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==",
+ "dev": true,
+ "requires": {
+ "is-callable": "^1.1.3"
+ }
+ },
"for-in": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
@@ -10073,6 +10123,24 @@
"integrity": "sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=",
"dev": true
},
+ "global": {
+ "version": "4.3.2",
+ "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz",
+ "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=",
+ "dev": true,
+ "requires": {
+ "min-document": "^2.19.0",
+ "process": "~0.5.1"
+ },
+ "dependencies": {
+ "process": {
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz",
+ "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=",
+ "dev": true
+ }
+ }
+ },
"global-modules": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz",
@@ -11111,6 +11179,12 @@
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
"dev": true
},
+ "is-function": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz",
+ "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=",
+ "dev": true
+ },
"is-git-url": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-git-url/-/is-git-url-1.0.0.tgz",
@@ -11126,6 +11200,12 @@
"is-extglob": "^2.1.0"
}
},
+ "is-hex-prefixed": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz",
+ "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=",
+ "dev": true
+ },
"is-ip": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-ip/-/is-ip-2.0.0.tgz",
@@ -12765,6 +12845,15 @@
"integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==",
"dev": true
},
+ "min-document": {
+ "version": "2.19.0",
+ "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz",
+ "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=",
+ "dev": true,
+ "requires": {
+ "dom-walk": "^0.1.0"
+ }
+ },
"minimalistic-assert": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
@@ -13433,6 +13522,24 @@
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
"dev": true
},
+ "number-to-bn": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz",
+ "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=",
+ "dev": true,
+ "requires": {
+ "bn.js": "4.11.6",
+ "strip-hex-prefix": "1.0.0"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.6",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz",
+ "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=",
+ "dev": true
+ }
+ }
+ },
"nwsapi": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.1.4.tgz",
@@ -13781,6 +13888,16 @@
"safe-buffer": "^5.1.1"
}
},
+ "parse-headers": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.2.tgz",
+ "integrity": "sha512-/LypJhzFmyBIDYP9aDVgeyEb5sQfbfY5mnDq4hVhlQ69js87wXfmEI5V3xI6vvXasqebp0oCytYFLxsBVfCzSg==",
+ "dev": true,
+ "requires": {
+ "for-each": "^0.3.3",
+ "string.prototype.trim": "^1.1.2"
+ }
+ },
"parse-json": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",
@@ -14500,6 +14617,12 @@
"safe-buffer": "^5.1.0"
}
},
+ "randomhex": {
+ "version": "0.1.5",
+ "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz",
+ "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=",
+ "dev": true
+ },
"range-parser": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
@@ -15430,6 +15553,23 @@
"debug": "^2.2.0"
}
},
+ "simple-concat": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz",
+ "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=",
+ "dev": true
+ },
+ "simple-get": {
+ "version": "2.8.1",
+ "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.1.tgz",
+ "integrity": "sha512-lSSHRSw3mQNUGPAYRqo7xy9dhKmxFXIjLjp4KHpf99GEH2VH7C3AM+Qfx6du6jhfUi6Vm7XnbEVEf7Wb6N8jRw==",
+ "dev": true,
+ "requires": {
+ "decompress-response": "^3.3.0",
+ "once": "^1.3.1",
+ "simple-concat": "^1.0.0"
+ }
+ },
"simple-html-tokenizer": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/simple-html-tokenizer/-/simple-html-tokenizer-0.5.7.tgz",
@@ -16118,6 +16258,17 @@
}
}
},
+ "string.prototype.trim": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz",
+ "integrity": "sha1-0E3iyJ4Tf019IG8Ia17S+ua+jOo=",
+ "dev": true,
+ "requires": {
+ "define-properties": "^1.1.2",
+ "es-abstract": "^1.5.0",
+ "function-bind": "^1.0.2"
+ }
+ },
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
@@ -16148,6 +16299,15 @@
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=",
"dev": true
},
+ "strip-hex-prefix": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz",
+ "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=",
+ "dev": true,
+ "requires": {
+ "is-hex-prefixed": "1.0.0"
+ }
+ },
"strip-indent": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz",
@@ -17039,6 +17199,12 @@
"prepend-http": "^2.0.0"
}
},
+ "url-set-query": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz",
+ "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=",
+ "dev": true
+ },
"url-to-options": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz",
@@ -17067,6 +17233,12 @@
"integrity": "sha512-ayNkOJdoNSGNDBE46Nkc+l6IXmeugbzahZLSMkwvgRWv5y5ZqNY2IrzcgmkR4z32sj1W3tM3TuTUMqkqBzO+RA==",
"dev": true
},
+ "utf8": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz",
+ "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==",
+ "dev": true
+ },
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
@@ -17212,6 +17384,21 @@
"defaults": "^1.0.3"
}
},
+ "web3-utils": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0.tgz",
+ "integrity": "sha512-zm0gdLXLk54ldwxxBMNPS62EuqHI2PaJohEGijTowacNS0BS2vEXdriNA8gp1+EplP2WgoHE0uRVmQIfpAyV+Q==",
+ "dev": true,
+ "requires": {
+ "bn.js": "4.11.8",
+ "eth-lib": "0.2.7",
+ "ethjs-unit": "0.1.6",
+ "number-to-bn": "1.7.0",
+ "randomhex": "0.1.5",
+ "underscore": "1.9.1",
+ "utf8": "3.0.0"
+ }
+ },
"webidl-conversions": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz",
@@ -17483,6 +17670,42 @@
"integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=",
"dev": true
},
+ "xhr": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz",
+ "integrity": "sha512-4nlO/14t3BNUZRXIXfXe+3N6w3s1KoxcJUUURctd64BLRe67E4gRwp4PjywtDY72fXpZ1y6Ch0VZQRY/gMPzzQ==",
+ "dev": true,
+ "requires": {
+ "global": "~4.3.0",
+ "is-function": "^1.0.1",
+ "parse-headers": "^2.0.0",
+ "xtend": "^4.0.0"
+ }
+ },
+ "xhr-request": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz",
+ "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==",
+ "dev": true,
+ "requires": {
+ "buffer-to-arraybuffer": "^0.0.5",
+ "object-assign": "^4.1.1",
+ "query-string": "^5.0.1",
+ "simple-get": "^2.7.0",
+ "timed-out": "^4.0.1",
+ "url-set-query": "^1.0.0",
+ "xhr": "^2.0.4"
+ }
+ },
+ "xhr-request-promise": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz",
+ "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=",
+ "dev": true,
+ "requires": {
+ "xhr-request": "^1.0.1"
+ }
+ },
"xml-name-validator": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz",
diff --git a/package.json b/package.json
index c5633ee..b01601b 100644
--- a/package.json
+++ b/package.json
@@ -67,7 +67,8 @@
"ndjson": "github:hugomrdias/ndjson#feat/readable-stream3",
"qunit-dom": "^0.8.4",
"transform-loader": "^0.2.4",
- "tv4": "^1.3.0"
+ "tv4": "^1.3.0",
+ "web3-utils": "^1.0.0"
},
"engines": {
"node": "8.* || >= 10.*"
diff --git a/tests/integration/components/topbar-account-panel/component-test.js b/tests/integration/components/topbar-account-panel/component-test.js
new file mode 100644
index 0000000..f194f73
--- /dev/null
+++ b/tests/integration/components/topbar-account-panel/component-test.js
@@ -0,0 +1,39 @@
+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 | topbar-account-panel', function(hooks) {
+ setupRenderingTest(hooks);
+
+ test('unknown user without wallet (or no permission to get wallet/account info)', async function(assert) {
+ await render(hbs` `);
+
+ assert.ok(this.element.textContent.trim().match(/^Anonymous/));
+ });
+
+ test('unknown user with Ethereum wallet', async function(assert) {
+ let service = this.owner.lookup('service:kredits');
+ service.set('currentUserAccounts', [{ foo: 'bar' }]);
+ await render(hbs` `);
+
+ assert.ok(this.element.textContent.trim().match(/^Anonymous/));
+ });
+
+ test('known contributor', async function(assert) {
+ let service = this.owner.lookup('service:kredits');
+ service.set('currentUserAccounts', [{ foo: 'bar' }]);
+ service.set('currentUser', {
+ name: 'Dorian Nakamoto',
+ isCore: false
+ });
+ await render(hbs` `);
+
+ assert.equal(this.element.textContent.trim(), 'Dorian Nakamoto');
+
+ service.set('currentUser.isCore', true);
+ await render(hbs` `);
+
+ assert.equal(this.element.querySelectorAll('span.core-flag').length, 1);
+ });
+});
diff --git a/tests/unit/routes/signup-test.js b/tests/unit/routes/signup-test.js
new file mode 100644
index 0000000..72e0efd
--- /dev/null
+++ b/tests/unit/routes/signup-test.js
@@ -0,0 +1,11 @@
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+
+module('Unit | Route | signup', function(hooks) {
+ setupTest(hooks);
+
+ test('it exists', function(assert) {
+ let route = this.owner.lookup('route:signup');
+ assert.ok(route);
+ });
+});
diff --git a/tests/unit/routes/signup/complete-test.js b/tests/unit/routes/signup/complete-test.js
new file mode 100644
index 0000000..199e6b9
--- /dev/null
+++ b/tests/unit/routes/signup/complete-test.js
@@ -0,0 +1,11 @@
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+
+module('Unit | Route | signup/complete', function(hooks) {
+ setupTest(hooks);
+
+ test('it exists', function(assert) {
+ let route = this.owner.lookup('route:signup/complete');
+ assert.ok(route);
+ });
+});
diff --git a/tests/unit/routes/signup/eth-account-test.js b/tests/unit/routes/signup/eth-account-test.js
new file mode 100644
index 0000000..4c4f714
--- /dev/null
+++ b/tests/unit/routes/signup/eth-account-test.js
@@ -0,0 +1,11 @@
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+
+module('Unit | Route | signup/eth-account', function(hooks) {
+ setupTest(hooks);
+
+ test('it exists', function(assert) {
+ let route = this.owner.lookup('route:signup/eth-account');
+ assert.ok(route);
+ });
+});