diff --git a/imports/ui/templates/components/decision/countdown/countdown.js b/imports/ui/templates/components/decision/countdown/countdown.js
index 25e1eb517..482b68335 100644
--- a/imports/ui/templates/components/decision/countdown/countdown.js
+++ b/imports/ui/templates/components/decision/countdown/countdown.js
@@ -5,6 +5,7 @@ import { ReactiveVar } from 'meteor/reactive-var';
import { blocktimes } from '/lib/const';
import { sync } from '/imports/ui/templates/layout/sync';
+import { templetize, getImage } from '/imports/ui/templates/layout/templater';
import '/imports/ui/templates/components/decision/countdown/countdown.html';
@@ -158,6 +159,9 @@ const _currentBlock = async (instance) => {
Template.countdown.onCreated(function () {
Template.instance().now = new ReactiveVar();
_currentBlock(Template.instance());
+
+ Template.instance().imageTemplate = new ReactiveVar();
+ templetize(Template.instance());
});
/**
@@ -256,6 +260,9 @@ Template.countdown.helpers({
}
return style;
},
+ getImage(pic) {
+ return getImage(Template.instance().imageTemplate.get(), pic);
+ },
});
export const currentBlock = _currentBlock;
diff --git a/imports/ui/templates/components/decision/ledger/ledger.js b/imports/ui/templates/components/decision/ledger/ledger.js
index 8b7f58010..73460e4d7 100644
--- a/imports/ui/templates/components/decision/ledger/ledger.js
+++ b/imports/ui/templates/components/decision/ledger/ledger.js
@@ -31,6 +31,9 @@ const _convertQuery = (instance) => {
case 'peer':
tally.options.view = 'transactionsPeer';
break;
+ case 'dao':
+ tally.options.view = 'transactionsDao';
+ break;
default:
}
return tally;
diff --git a/imports/ui/templates/components/identity/avatar/avatar.js b/imports/ui/templates/components/identity/avatar/avatar.js
index 849bd71a6..611ced1b2 100644
--- a/imports/ui/templates/components/identity/avatar/avatar.js
+++ b/imports/ui/templates/components/identity/avatar/avatar.js
@@ -15,6 +15,7 @@ import { uploadToAmazonS3 } from '/imports/ui/modules/Files';
import { displayModal } from '/imports/ui/modules/modal';
import { templetize, getImage } from '/imports/ui/templates/layout/templater';
import { displayPopup, cancelPopup } from '/imports/ui/modules/popup';
+import { shortenCryptoName } from '/imports/startup/both/modules/metamask';
import { defaults } from '/lib/const';
import '/imports/ui/templates/components/identity/avatar/avatar.html';
@@ -67,18 +68,6 @@ const _getAddress = (user) => {
return undefined;
};
-/**
-* @summary shortens the username if its a crypto address
-* @param {object} publicAddress string of username to check
-* @returns {string} username string
-*/
-const _shortenCryptoName = (publicAddress) => {
- if (publicAddress.length === 42 && publicAddress.slice(0, 2) === '0x') {
- return `${publicAddress.slice(0, 6)}...${publicAddress.slice(38, 42)}`.toLowerCase();
- }
- return publicAddress;
-};
-
/**
* @summary describes nationality of user in ux
* @param {object} profile user to parse
@@ -355,14 +344,14 @@ Template.avatar.helpers({
username(profile) {
if (profile === undefined) {
if (Meteor.user()) {
- return _shortenCryptoName(Meteor.user().username);
+ return shortenCryptoName(Meteor.user().username);
}
}
const user = Meteor.users.findOne(_getDynamicID(this));
if (!user) {
return '';
}
- return `${_shortenCryptoName(user.username)}`;
+ return `${shortenCryptoName(user.username)}`;
},
nationality(profile) {
return getNation(profile);
@@ -448,4 +437,3 @@ Template.avatar.events({
export const getFlag = getNation;
export const getUser = _getUser;
-export const shortenCryptoName = _shortenCryptoName;
diff --git a/imports/ui/templates/components/identity/login/ForgotPassword.jsx b/imports/ui/templates/components/identity/login/ForgotPassword.jsx
index 6fef5a571..3b1a6cf39 100644
--- a/imports/ui/templates/components/identity/login/ForgotPassword.jsx
+++ b/imports/ui/templates/components/identity/login/ForgotPassword.jsx
@@ -1,4 +1,5 @@
-import React, { Component, PropTypes } from 'react';
+import React, { Component } from 'react';
+import { PropTypes } from 'prop-types';
import { TAPi18n } from 'meteor/tap:i18n';
import { Accounts } from 'meteor/accounts-base';
import { Session } from 'meteor/session';
diff --git a/imports/ui/templates/components/identity/login/SocialMediaLogin.jsx b/imports/ui/templates/components/identity/login/SocialMediaLogin.jsx
index 002e4c9ce..bcda8824f 100644
--- a/imports/ui/templates/components/identity/login/SocialMediaLogin.jsx
+++ b/imports/ui/templates/components/identity/login/SocialMediaLogin.jsx
@@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
-import React, { Component, PropTypes } from 'react';
+import React, { Component } from 'react';
+import { PropTypes } from 'prop-types';
import { TAPi18n } from 'meteor/tap:i18n';
import { displayLogin } from '/imports/ui/modules/popup';
diff --git a/imports/ui/templates/components/identity/replica/replica.js b/imports/ui/templates/components/identity/replica/replica.js
index 316b5d33a..385af59e3 100644
--- a/imports/ui/templates/components/identity/replica/replica.js
+++ b/imports/ui/templates/components/identity/replica/replica.js
@@ -5,7 +5,7 @@ import { TAPi18n } from 'meteor/tap:i18n';
import { replicaThreshold } from '/lib/const';
import { templetize, getImage } from '/imports/ui/templates/layout/templater';
-import { shortenCryptoName } from '/imports/ui/templates/components/identity/avatar/avatar';
+import { shortenCryptoName } from '/imports/startup/both/modules/metamask';
import '/imports/ui/templates/components/identity/replica/replica.html';
import '/imports/ui/templates/widgets/qr/qr.js';
diff --git a/imports/ui/templates/components/identity/signup/Signup.jsx b/imports/ui/templates/components/identity/signup/Signup.jsx
index 8e086106a..d4afa55c2 100644
--- a/imports/ui/templates/components/identity/signup/Signup.jsx
+++ b/imports/ui/templates/components/identity/signup/Signup.jsx
@@ -1,4 +1,5 @@
-import React, { Component, PropTypes } from 'react';
+import React, { Component } from 'react';
+import { PropTypes } from 'prop-types';
import { TAPi18n } from 'meteor/tap:i18n';
import { getImageTemplate } from '/imports/ui/templates/layout/templater';
diff --git a/imports/ui/templates/layout/sidebar/sidebar.js b/imports/ui/templates/layout/sidebar/sidebar.js
index cf7ab51e3..9ed2a0b41 100644
--- a/imports/ui/templates/layout/sidebar/sidebar.js
+++ b/imports/ui/templates/layout/sidebar/sidebar.js
@@ -6,10 +6,8 @@ import { gui } from '/lib/const';
import { TAPi18n } from 'meteor/tap:i18n';
import { ReactiveVar } from 'meteor/reactive-var';
-import { sidebarWidth, sidebarPercentage, getDelegatesMenu, toggleSidebar } from '/imports/ui/modules/menu';
-import { getFlag, getUser } from '/imports/ui/templates/components/identity/avatar/avatar';
-import { getCoin } from '/imports/api/blockchain/modules/web3Util';
-import { Collectives } from '/imports/api/collectives/Collectives';
+import { sidebarWidth, sidebarPercentage, toggleSidebar } from '/imports/ui/modules/menu';
+import { getFlag } from '/imports/ui/templates/components/identity/avatar/avatar';
import '/imports/ui/templates/layout/sidebar/sidebar.html';
import '/imports/ui/templates/components/collective/collective.js';
@@ -58,6 +56,7 @@ const _dataToMenu = (user) => {
* @param {object} db data to parse for menu options
* @param {boolean} sort if do alphabetical sort or not
*/
+/*
function getList(db, sort) {
const members = [];
for (const i in db) {
@@ -68,12 +67,14 @@ function getList(db, sort) {
}
return members;
}
+*/
/**
* @summary gets list of delegats for current user
* @param {object} contractFeed
* @param {object} transactionFeed
*/
+/*
function getDelegates(contractFeed, transactionFeed) {
const delegates = _.sortBy(getDelegatesMenu(contractFeed, transactionFeed), (user) => { return parseInt(0 - (user.sent + user.received), 10); });
let delegateList = [];
@@ -102,11 +103,13 @@ function getDelegates(contractFeed, transactionFeed) {
return getList(delegateList, false);
}
+*/
/**
* @summary all members of the collective without the delegates
* @param {object} currentDelegates list of delegates
*/
+/*
const _otherMembers = (currentDelegates) => {
const members = getList(Meteor.users.find({}, { limit: 10 }).fetch(), true);
const delegates = currentDelegates;
@@ -132,12 +135,14 @@ const _otherMembers = (currentDelegates) => {
}
return finalList;
};
+*/
/**
* @summary formats delegate list for sidebar menu
* @param {object} list list of delegates
*/
+/*
const _adapt = (list) => {
const menu = [];
for (let i = 0; i < list.length; i += 1) {
@@ -145,7 +150,7 @@ const _adapt = (list) => {
}
return menu;
};
-
+*/
/**
* @summary displays the sidebar if logged
@@ -164,12 +169,10 @@ const _showSidebar = () => {
toggleSidebar(true);
}
} else {
- console.log(`percentage ${percentage}`);
$('.left').width(`${percentage}%`);
}
if (!Session.get('sidebar')) {
const newMargin = parseInt((Meteor.Device.isPhone() ? 0 : -10) - sidebarWidth(), 10);
- console.log(`newMargin: ${newMargin}`);
$('#menu').css('margin-left', `${newMargin}px`);
if (newMargin < 0) {
Session.set('removedSidebar', true);
@@ -181,7 +184,6 @@ const _showSidebar = () => {
}
if (Meteor.Device.isPhone()) {
- console.log(`sidebarWidth(): ${sidebarWidth()}`);
$('#content').css('left', sidebarWidth());
$('#content').css('right', newRight);
$('#menu').css('margin-left', '0px');
@@ -197,18 +199,20 @@ const _showSidebar = () => {
};
Template.sidebar.onCreated(function () {
- Template.instance().delegates = new ReactiveVar();
+ /* Template.instance().delegates = new ReactiveVar();
Template.instance().members = new ReactiveVar(0);
Template.instance().participants = new ReactiveVar();
Template.instance().memberCount = new ReactiveVar(0);
- Template.instance().daoList = new ReactiveVar();
+ Template.instance().daoList = new ReactiveVar(); */
+ Template.instance().menu = new ReactiveVar();
+ Template.instance().resizing = false;
- const instance = this;
+ /* const collectives = instance.subscribe('collectives', { view: 'daoList' });
Meteor.call('userCount', function (error, result) {
instance.memberCount.set(result);
});
- const collectives = instance.subscribe('collectives', { view: 'daoList' });
+
instance.autorun(function () {
let delegateList;
@@ -234,7 +238,7 @@ Template.sidebar.onCreated(function () {
if (!delegateList) {
Template.instance().participants.set(_otherMembers());
}
- });
+ });*/
});
/**
@@ -242,6 +246,7 @@ Template.sidebar.onCreated(function () {
* @param {object} user to parse
* @returns {object} menu
*/
+/*
const _getMenu = () => {
// dao feeds
const menu = [];
@@ -263,10 +268,7 @@ const _getMenu = () => {
// subjectivity
return menu;
};
-
-Template.sidebar.onCreated(function () {
- Template.instance().resizing = false;
-});
+*/
let resizeId;
const _doneResizing = (instance) => {
@@ -329,7 +331,7 @@ Template.sidebar.helpers({
return 0;
},
menu() {
- return _getMenu();
+ return Session.get('sidebarMenu');
},
style() {
if (!Meteor.Device.isPhone() && Meteor.user()) {
diff --git a/imports/ui/templates/layout/url/home/home.html b/imports/ui/templates/layout/url/home/home.html
index 3de53ae27..b38bd8843 100644
--- a/imports/ui/templates/layout/url/home/home.html
+++ b/imports/ui/templates/layout/url/home/home.html
@@ -88,16 +88,18 @@
{{_ 'replica-person'}}
{{> replica this}}
{{/with}}
{{else}}
- {{#unless isPhone}}
-
-
{{_ 'moloch-guild'}}
-
- {{else}}
-
- {{/unless}}
- {{#with collective}}
- {{> guild this}}
- {{/with}}
+ {{#if isDAO}}
+ {{#unless isPhone}}
+
+
{{_ 'moloch-guild'}}
+
+ {{else}}
+
+ {{/unless}}
+ {{#with collective}}
+ {{> guild this}}
+ {{/with}}
+ {{/if}}
{{/if}}
{{#with mainLedger}}
diff --git a/imports/ui/templates/layout/url/home/home.js b/imports/ui/templates/layout/url/home/home.js
index de315fff2..d0e2bde4c 100644
--- a/imports/ui/templates/layout/url/home/home.js
+++ b/imports/ui/templates/layout/url/home/home.js
@@ -7,8 +7,10 @@ import { Meteor } from 'meteor/meteor';
import { TAPi18n } from 'meteor/tap:i18n';
import { Contracts } from '/imports/api/contracts/Contracts';
+import { Collectives } from '/imports/api/collectives/Collectives';
import { introEditor } from '/imports/ui/templates/widgets/compose/compose';
-import { shortenCryptoName, getUser } from '/imports/ui/templates/components/identity/avatar/avatar';
+import { getUser } from '/imports/ui/templates/components/identity/avatar/avatar';
+import { shortenCryptoName } from '/imports/startup/both/modules/metamask';
import { getCoin } from '/imports/api/blockchain/modules/web3Util.js';
import { Tokens } from '/imports/api/tokens/tokens';
@@ -55,6 +57,26 @@ const _landingMode = (style) => {
return css;
};
+/**
+* @summary subscribes to user data
+* @param {object} user user to parse
+* @param {object} instance template running this
+* @param {function} callback when ready take this action
+* @returns {string} country
+*/
+const _getDao = (daoId) => {
+ const daoList = Session.get('daoList');
+ if (daoId && daoList) {
+ if (!_.contains(daoList, daoId)) {
+ daoList.push(daoId);
+ Session.set('daoList', daoList);
+ }
+ } else if (daoId) {
+ Session.set('daoList', [daoList]);
+ }
+};
+
+
/**
* @summary creates a replica object based on available data or requests it
* @param {object} instance with data to persist the replica
@@ -99,6 +121,15 @@ Template.home.onCreated(function () {
this.subscription = instance.subscribe('singleUser', { $or: query });
}
+ const daoList = Session.get('daoList');
+ if (daoList) {
+ const daoQuery = [];
+ for (const i in daoList) {
+ daoQuery.push({ _id: daoList[i] });
+ }
+ this.subscription = instance.subscribe('singleDao', { $or: daoQuery });
+ }
+
if (tokenFeed.ready()) {
const tokenList = {};
tokenList.coin = Tokens.find().fetch();
@@ -253,16 +284,6 @@ Template.homeFeed.onCreated(function () {
instance.autorun(function (computation) {
if (subscription.ready()) {
_generateReplica(instance);
-
- const collectiveId = Contracts.findOne().collectiveId;
- Session.set('search', {
- input: '',
- query: [
- {
- collectiveId,
- },
- ],
- });
instance.feedReady.set(true);
computation.stop();
}
@@ -301,6 +322,11 @@ const _getTitle = (options, ledgerMode) => {
return TAPi18n.__('ledger-peer-posts').replace('{{asset}}', shortenCryptoName(username).toUpperCase());
}
return TAPi18n.__('feed-peer-posts').replace('{{asset}}', shortenCryptoName(username).toUpperCase());
+ case 'dao':
+ if (ledgerMode) {
+ return TAPi18n.__('dao-events');
+ }
+ return TAPi18n.__('dao-proposals');
default:
if (ledgerMode) {
return TAPi18n.__('recent-activity');
@@ -387,9 +413,12 @@ Template.homeFeed.helpers({
}
return false;
},
+ isDAO() {
+ return (this.options.view === 'dao');
+ },
collective() {
- const search = Session.get('search');
- const collectiveId = _.pluck(search.query, 'collectiveId')[0];
+ const collective = Collectives.findOne({ name: this.options.name });
+ const collectiveId = collective._id;
return {
collectiveId,
};
@@ -599,3 +628,4 @@ Template.periodFeed.events({
});
export const getLandingMode = _getLandingMode;
+export const getDao = _getDao;
diff --git a/imports/ui/templates/layout/url/topbar/topbar.html b/imports/ui/templates/layout/url/topbar/topbar.html
index 270ed3275..e478724ac 100644
--- a/imports/ui/templates/layout/url/topbar/topbar.html
+++ b/imports/ui/templates/layout/url/topbar/topbar.html
@@ -25,6 +25,7 @@