show messages when user has no contacts

cases:
- No contacts, logged in: show button to copy profile URL
- Not logged in: show buttons to log in or register
pull/1/head
David Benqué 5 years ago
parent fb50fe09ce
commit 15a8054d31

@ -1002,7 +1002,7 @@ define([
}); });
return { return {
content: div, content: div,
button: shareButton buttons: [shareButton]
}; };
}; };
@ -1125,10 +1125,42 @@ define([
var hasFriends = Object.keys(config.friends || {}).length !== 0; var hasFriends = Object.keys(config.friends || {}).length !== 0;
var onFriendShare = Util.mkEvent(); var onFriendShare = Util.mkEvent();
var friendsObject = hasFriends ? createShareWithFriends(config, onFriendShare, getLinkValue) : {
content: h('p', Messages.team_noFriend), var noContactsMessage = function(){
button: {} if (common.isLoggedIn()) {
return {
content: h('p', Messages.share_noContactsLoggedIn),
buttons: [{
className: 'primary',
name: Messages.share_copyProfileLink,
onClick: function () {
// XXX copy profile link
},
keys: [13]
}]
}
} else {
return {
content: h('p', Messages.share_noContactsNotLoggedIn),
buttons: [{
className: 'primary',
name: Messages.login_register,
onClick: function () {
// XXX link to register
}
}, {
className: 'primary',
name: Messages.login_login,
onClick: function () {
// XXX link to log in
}
}
]
}
}
}; };
var friendsObject = hasFriends ? createShareWithFriends(config, onFriendShare, getLinkValue) : noContactsMessage();
var friendsList = friendsObject.content; var friendsList = friendsObject.content;
onFriendShare.reg(saveValue); onFriendShare.reg(saveValue);
@ -1137,9 +1169,10 @@ define([
var contactsContent = h('div.cp-share-modal'); var contactsContent = h('div.cp-share-modal');
$(contactsContent).append(friendsList); $(contactsContent).append(friendsList);
var contactButtons = [makeCancelButton(), console.log(friendsObject.content);
friendsObject.button]; var contactButtons = friendsObject.buttons;
contactButtons.unshift(makeCancelButton());
var frameContacts = UI.dialog.customModal(contactsContent, { var frameContacts = UI.dialog.customModal(contactsContent, {
buttons: contactButtons, buttons: contactButtons,
onClose: config.onClose, onClose: config.onClose,

Loading…
Cancel
Save