From 0143ff52d4d95584b98c9d01d659f7ce9056e7a0 Mon Sep 17 00:00:00 2001 From: Ammar Ansari Date: Fri, 16 Feb 2024 23:50:18 +0500 Subject: [PATCH] Conversation logs UI update --- public/full.js | 27 ++++++++++++++++++++++++--- views/index.ejs | 30 +++++++++++++++--------------- 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/public/full.js b/public/full.js index d2221e2..4cffeb6 100644 --- a/public/full.js +++ b/public/full.js @@ -37,7 +37,6 @@ const inCallElements = [ unmuteVideoSelfBtn, deafSelfBtn, undeafSelfBtn, - controlConvo, controlSliders, controlLayout, hideVMutedBtn, @@ -346,7 +345,6 @@ function restoreUI() { btnReject.classList.add('d-none') tabs.classList.remove('d-none') connectStatus.innerHTML = 'Not Connected' - liveMessageList.textContent = '' inCallElements.forEach((button) => { button.classList.add('d-none') @@ -1124,6 +1122,29 @@ async function fetchHistories() { } } +function createLiveMessageListItem(msg) { + const listItem = document.createElement('li') + listItem.classList.add('list-group-item') + listItem.id = msg.id + const formattedTimestamp = formatMessageDate(msg.ts * 1000) + listItem.innerHTML = ` +
+
+
+
${msg.type ?? 'unknown'}
+

${msg.conversation_name}

+
+
+ ${msg.subtype ?? 'unknown'} + ${msg.kind ?? 'unknown'} +
+
+

${formattedTimestamp}

+
+ ` + return listItem +} + let isConvoSubscribed = false function subscribeToNewMessages() { if (!isConvoSubscribed) { @@ -1151,7 +1172,7 @@ function subscribeToNewMessages() { // Update in call live messages // FIXME: Make sure the message is for the current call based on newMsg.conversation_id const liveMessageList = document.querySelector('#liveMessageList') - const newListItem = createMessageListItem(newMsg) + const newListItem = createLiveMessageListItem(newMsg) if (liveMessageList.firstChild) { liveMessageList.insertBefore(newListItem, liveMessageList.firstChild) } else { diff --git a/views/index.ejs b/views/index.ejs index b5da4fd..9d706d8 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -161,6 +161,21 @@
+ + +
+
+
+ Conversation logs +
+
+
+
    +
    +
    +
    +
    + @@ -242,21 +257,6 @@ - -
    -
    -
    - Conversation logs -
    -
    -
    -
      -
      -
      -
      -
      - -