Instantly share code, notes, and snippets.

Embed
What would you like to do?
new ClipboardJS('.copy-btn');
let tuemilio = Tuemilio.new('44722aad-f267-4e78-ba81-2c644830b425');
tuemilio.on('submitted', () => {
tuemilio.button.classList.add('disabled');
});
tuemilio.on('subscribed', (dashboard) => {
tuemilio.button.classList.remove('disabled');
});
tuemilio.on('dashboard', (dashboard) => {
tuemilio.buildShareable({
link: dashboard.referral_link,
facebookQuote:'I just joined this awesome payment system!',
twitterQuote:'I just joined this awesome payment system!',
hashTags: 'wecognitive,newbitcoin',
whatsappQuote: 'I just joined this awesome payment system!',
redditQuote:'I just joined this awesome payment system!',
telegramQuote:'I just joined this awesome payment system!',
emailBody: 'Here is my link',
emailSubject: 'I just joined this awesome payment system!',
linkQuote: 'Share the link below'
});
let ul = document.getElementById('referred-friends');
dashboard.referreds.forEach((referred) => {
let li = document.createElement('li');
let badge = document.createElement('span');
li.classList.add('list-group-item');
badge.classList.add('badge');
badge.classList.add('badge-primary');
badge.classList.add('badge-pill');
badge.classList.add('pull-right');
li.appendChild(
document.createTextNode(referred.user)
);
badge.appendChild(
document.createTextNode(referred.points)
);
li.appendChild(badge);
ul.appendChild(li);
});
let waitingList = document.getElementById('waiting-list');
dashboard.waiters.forEach((referred) => {
let li = document.createElement('li');
let badge = document.createElement('span');
let position = document.createElement('span');
let address = document.createElement('span');
li.classList.add('list-group-item');
li.classList.add('text-center');
badge.classList.add('badge');
badge.classList.add('badge-primary');
badge.classList.add('badge-pill');
badge.classList.add('pull-right');
position.classList.add('pull-left');
position.appendChild(
document.createTextNode(referred.position)
);
badge.appendChild(
document.createTextNode(referred.points)
);
address.appendChild(
document.createTextNode(referred.address)
);
li.appendChild(position);
li.appendChild(address);
li.appendChild(badge);
waitingList.appendChild(li);
});
document.getElementById('user').innerHTML = dashboard.user;
document.getElementById('position').innerHTML = dashboard.position;
document.getElementById('subscribers-count').innerHTML = dashboard.subscribers_count;
document.getElementById('referred-friends-count').innerHTML = dashboard.referreds_count;
$('#progress-bar').attr('aria-valuenow', dashboard.referreds_count*100/5).css('width', dashboard.referreds_count*100/5 + '%');
// Hide the form and hero and display the dashboard
tuemilio.form.classList.add('hidden');
tuemilio.dashboard.classList.remove('hidden');
document.getElementsByClassName('landing-content')[0].classList.add('hidden');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment