From ad552e100f2b33ff54bca380027b8ea0dd368d39 Mon Sep 17 00:00:00 2001 From: daria <95225431+dariiing@users.noreply.github.com> Date: Tue, 31 Mar 2026 14:54:54 +0300 Subject: [PATCH] update UI for empty contacts --- customize.dist/messages.js | 2 ++ .../src/less2/include/messenger.less | 19 ++++++++++++++ www/common/messenger-ui.js | 26 +++++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/customize.dist/messages.js b/customize.dist/messages.js index 87a3a5241..8967c9af4 100755 --- a/customize.dist/messages.js +++ b/customize.dist/messages.js @@ -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 diff --git a/customize.dist/src/less2/include/messenger.less b/customize.dist/src/less2/include/messenger.less index 5f742c68b..8e1e3cb42 100644 --- a/customize.dist/src/less2/include/messenger.less +++ b/customize.dist/src/less2/include/messenger.less @@ -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; diff --git a/www/common/messenger-ui.js b/www/common/messenger-ui.js index dc65eab35..8a8b9213e 100644 --- a/www/common/messenger-ui.js +++ b/www/common/messenger-ui.js @@ -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();