update UI for empty contacts

This commit is contained in:
daria 2026-03-31 14:54:54 +03:00
parent c2e26eb955
commit ad552e100f
No known key found for this signature in database
GPG Key ID: 3B75240E6B2F2701
3 changed files with 47 additions and 0 deletions

View File

@ -134,6 +134,8 @@ define(req, function(AppConfig, Default, Language) {
}
};
Messages.contacts_noFriends = "No chats yet";
Messages.contacts_noFriendsInfo = "Add friends or join teams to begin chatting";
Messages.contacts_historyCleared = "The chat history has been deleted for both parties"; // XXX
Messages.contacts_confirmRemoveHistory = "Are you sure you want to delete chat history? Messages will be removed for everyone and cannot be restored."
return Messages; // XXX existing key

View File

@ -286,6 +286,16 @@
}
}
&.cp-app-contacts-no-chats {
#cp-app-contacts-friendlist {
display: none;
}
#cp-app-contacts-messaging {
display: flex;
flex-direction: column;
}
}
#cp-app-contacts-messaging {
flex: 1;
height: 100%;
@ -534,6 +544,15 @@
flex-direction: column;
}
}
&.cp-app-contacts-no-chats {
#cp-app-contacts-friendlist {
display: none;
}
#cp-app-contacts-messaging {
display: flex;
flex-direction: column;
}
}
}
.cp-app-contacts-back {
display: flex;

View File

@ -527,6 +527,29 @@ define([
$messages.find('.cp-app-contacts-info').show();
};
var updateInfoMessage = function () {
var chats = Object.keys(state.channels).length;
var $info = $messages.find('.cp-app-contacts-info');
if (chats === 0) {
$info.html([
h('h2', Messages.contacts_noFriends),
h('ul', [
h('li', Messages.share_noContactsNotLoggedIn),
])
]);
$container.addClass('cp-app-contacts-no-chats');
} else {
$info.html([
h('h2', Messages.contacts_info1),
h('ul', [
h('li', Messages.contacts_info2),
h('li', Messages.contacts_info4),
])
]);
$container.removeClass('cp-app-contacts-no-chats');
}
};
var updateStatus = function (id) {
if (!state.channels[id]) { return; }
var $status = find.inList(id).find('.cp-app-contacts-status');
@ -965,6 +988,7 @@ define([
if (err) { return void console.error(err); }
debug('rooms: ' + JSON.stringify(rooms));
rooms.forEach(initializeRoom);
updateInfoMessage();
});
};
@ -978,6 +1002,7 @@ define([
if (channel && channel.curvePublic === curvePublic) {
showInfo();
}
updateInfoMessage();
if (!removedByMe) {
// TODO UI.alert if this is triggered by the other guy
}
@ -1093,6 +1118,7 @@ define([
debug('rooms: ' + JSON.stringify(rooms));
rooms.forEach(initializeRoom);
updateInfoMessage();
});
updateMutedList();