diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index 4c8d00c94..9ae792917 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -831,10 +831,11 @@ "guild-voting-addresses": "Voters", "replica-person": "Profile.", "replica-score": "Personhood", - "replica-detail-very-human": "🤠 Definitely a human.", - "replica-detail-likely-human": "🐵 Certainly a human.", + "replica-detail-very-human": "🤠 Definitely human.", + "replica-detail-likely-human": "🐵 Certainly human.", "replica-detail-maybe-human": "👽 Uncertain if human or robot.", - "replica-detail-unlikely-human": "🤖 Certainly a robot.", - "replica-detail-not-human": "👾 Definitely a robot.", - "replica-detail-unknown-human": "😔 Unknown score." + "replica-detail-unlikely-human": "🤖 Certainly robot.", + "replica-detail-not-human": "👾 Definitely robot.", + "replica-detail-unknown-human": "😔 Unknown score.", + "sign-out-prompt": "Sign out from current account?" } diff --git a/imports/ui/templates/components/collective/collective.js b/imports/ui/templates/components/collective/collective.js index 79a07a5c6..abbe30838 100644 --- a/imports/ui/templates/components/collective/collective.js +++ b/imports/ui/templates/components/collective/collective.js @@ -1,6 +1,8 @@ import { Meteor } from 'meteor/meteor'; import { Template } from 'meteor/templating'; import { Session } from 'meteor/session'; +import { Router } from 'meteor/iron:router'; + import { $ } from 'meteor/jquery'; import { Collectives } from '/imports/api/collectives/Collectives'; diff --git a/imports/ui/templates/layout/authentication/authentication.js b/imports/ui/templates/layout/authentication/authentication.js index 1806147ef..17964b304 100644 --- a/imports/ui/templates/layout/authentication/authentication.js +++ b/imports/ui/templates/layout/authentication/authentication.js @@ -4,6 +4,9 @@ import { $ } from 'meteor/jquery'; import { Meteor } from 'meteor/meteor'; import { Router } from 'meteor/iron:router'; +import { TAPi18n } from 'meteor/tap:i18n'; +import { displayModal } from '/imports/ui/modules/modal'; + import { publishContract, createContract, contractURI, entangle, getURLDate } from '/imports/startup/both/modules/Contract'; import { editorFadeOut } from '/imports/ui/templates/components/decision/editor/editor'; import { displayPopup, animatePopup } from '/imports/ui/modules/popup'; @@ -11,6 +14,14 @@ import { displayPopup, animatePopup } from '/imports/ui/modules/popup'; import '/imports/ui/templates/layout/authentication/authentication.html'; import '/imports/ui/templates/components/identity/avatar/avatar.js'; + +const modal = { + icon: Meteor.settings.public.app.logo, + title: TAPi18n.__('wallet'), + cancel: TAPi18n.__('close'), + alertMode: true, +}; + function _isDisabled() { if (Meteor.user().profile.wallet.reserves) { return (entangle(Session.get('draftContract')) === undefined) || @@ -106,7 +117,33 @@ Template.authentication.helpers({ Template.authentication.events({ 'click #loggedUser'(event) { event.stopPropagation(); - promptLogin((!Session.get('user-login') || !Session.get('user-login').visible), event); + if (Meteor.user()) { + Router.go(`/address/${Meteor.user().username}`); + + displayModal( + true, + { + icon: Meteor.settings.public.app.logo, + title: TAPi18n.__('sign-out'), + message: TAPi18n.__('sign-out-prompt'), + cancel: TAPi18n.__('close'), + action: TAPi18n.__('sign-out'), + alertMode: false, + }, + () => { + Router.go('/'); + Meteor.logout(); + } + ); + } else { + Session.set('userLoginVisible', true); + Meteor.loginWithMetamask({}, function (err) { + if (err.reason) { + throw new Meteor.Error('Metamask login failed', err.reason); + } + Session.set('userLoginVisible', false); + }); + } }, 'click #navbar-post-button'() { _publish(); diff --git a/imports/ui/templates/layout/url/home/home.js b/imports/ui/templates/layout/url/home/home.js index e51fa4d74..bdf0c0d12 100644 --- a/imports/ui/templates/layout/url/home/home.js +++ b/imports/ui/templates/layout/url/home/home.js @@ -243,6 +243,8 @@ Template.homeFeed.onCreated(function () { if (subscription.ready()) { _generateReplica(instance); + console.log(Contracts.findOne()); + const collectiveId = Contracts.findOne().collectiveId; Session.set('search', { input: '', diff --git a/imports/ui/templates/layout/url/topbar/topbar.html b/imports/ui/templates/layout/url/topbar/topbar.html index bdbbc8ce9..cfbd5b3b5 100644 --- a/imports/ui/templates/layout/url/topbar/topbar.html +++ b/imports/ui/templates/layout/url/topbar/topbar.html @@ -8,8 +8,13 @@