agentchannel 0.7.22 → 0.7.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/ui/app.js +27 -36
- package/ui/index.html +2 -2
package/package.json
CHANGED
package/ui/app.js
CHANGED
|
@@ -31,10 +31,10 @@ var CONFIG = window.__AC_CONFIG__ || {};
|
|
|
31
31
|
|
|
32
32
|
var COLORS = ["#7c8a9a","#8b7e74","#6e8a7a","#8a7e8e","#7a8a8e","#8e857a","#7a7e8e","#7e8a7a"];
|
|
33
33
|
var senderColors = {};
|
|
34
|
-
var activeChannel = "all";
|
|
34
|
+
var activeChannel = (CONFIG.channels && CONFIG.channels.length > 0) ? CONFIG.channels.find(function(c){return !c.subchannel}).channel || "all" : "all";
|
|
35
35
|
var allMessages = [];
|
|
36
36
|
var unreadCounts = {};
|
|
37
|
-
var collapsedGroups = {};
|
|
37
|
+
var collapsedGroups = { "AgentChannel": true };
|
|
38
38
|
var onlineMembers = {}; // channel -> Set of names
|
|
39
39
|
var channelMetas = {}; // channel name -> meta object
|
|
40
40
|
|
|
@@ -285,39 +285,23 @@ function renderSidebar() {
|
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
//
|
|
289
|
-
var allDiv = document.createElement("div");
|
|
290
|
-
allDiv.className = "sidebar__channel" + (activeChannel === "all" ? " active" : "");
|
|
291
|
-
var allCount = Object.values(unreadCounts).reduce(function(a, b) { return a + b; }, 0);
|
|
292
|
-
allDiv.innerHTML = '<span style="color:var(--text-muted);margin-right:2px">#</span>All channels' + (allCount ? '<span class="badge">' + allCount + '</span>' : "");
|
|
293
|
-
allDiv.onclick = function() {
|
|
294
|
-
activeChannel = "all";
|
|
295
|
-
for (var k in unreadCounts) unreadCounts[k] = 0;
|
|
296
|
-
headerName.textContent = "# All";
|
|
297
|
-
headerDesc.textContent = "All channels";
|
|
298
|
-
document.title = "AgentChannel";
|
|
299
|
-
history.pushState(null, "", "/");
|
|
300
|
-
renderSidebar();
|
|
301
|
-
render();
|
|
302
|
-
if (window.renderMembers) window.renderMembers();
|
|
303
|
-
};
|
|
304
|
-
el.appendChild(allDiv);
|
|
305
|
-
|
|
306
|
-
// @Me — show only messages mentioning me
|
|
288
|
+
// @Mentions — only show if there are mentions
|
|
307
289
|
var mentionCount = allMessages.filter(function(m) { return m.content && CONFIG.name && m.content.indexOf("@" + CONFIG.name) !== -1; }).length;
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
290
|
+
if (mentionCount > 0 || activeChannel === "@me") {
|
|
291
|
+
var meDiv = document.createElement("div");
|
|
292
|
+
meDiv.className = "sidebar__channel" + (activeChannel === "@me" ? " active" : "");
|
|
293
|
+
meDiv.innerHTML = '<span style="color:var(--mention-text);margin-right:2px">@</span>Mentions' + (mentionCount ? '<span class="badge" style="background:var(--mention-text);color:#fff;opacity:1">' + mentionCount + '</span>' : "");
|
|
294
|
+
meDiv.onclick = function() {
|
|
295
|
+
activeChannel = "@me";
|
|
296
|
+
headerName.textContent = "@Me";
|
|
297
|
+
headerDesc.textContent = "Messages mentioning you";
|
|
298
|
+
document.title = "AgentChannel — @Me";
|
|
299
|
+
renderSidebar();
|
|
300
|
+
render();
|
|
301
|
+
if (window.renderMembers) window.renderMembers();
|
|
302
|
+
};
|
|
303
|
+
el.appendChild(meDiv);
|
|
304
|
+
}
|
|
321
305
|
|
|
322
306
|
// Render each parent + children
|
|
323
307
|
for (var pi = 0; pi < parents.length; pi++) {
|
|
@@ -541,6 +525,11 @@ async function init() {
|
|
|
541
525
|
}
|
|
542
526
|
|
|
543
527
|
allMessages.sort(function(a, b) { return a.timestamp - b.timestamp; });
|
|
528
|
+
// Set header for default channel
|
|
529
|
+
if (activeChannel && activeChannel !== "all") {
|
|
530
|
+
headerName.textContent = "#" + activeChannel;
|
|
531
|
+
headerDesc.textContent = channelMetas[activeChannel] ? channelMetas[activeChannel].description || "" : "";
|
|
532
|
+
}
|
|
544
533
|
renderSidebar();
|
|
545
534
|
render();
|
|
546
535
|
|
|
@@ -625,8 +614,10 @@ async function init() {
|
|
|
625
614
|
var header = document.querySelector(".members__header");
|
|
626
615
|
if (!list || !panel) return;
|
|
627
616
|
|
|
628
|
-
// Hide members for
|
|
629
|
-
|
|
617
|
+
// Hide members for @me and public channels (AgentChannel)
|
|
618
|
+
var isPublic = channelMetas[activeChannel] && channelMetas[activeChannel].public;
|
|
619
|
+
var isOfficialPublic = activeChannel.toLowerCase() === "agentchannel";
|
|
620
|
+
if (activeChannel === "all" || activeChannel === "@me" || isPublic || isOfficialPublic) {
|
|
630
621
|
if (header) header.textContent = "MEMBERS";
|
|
631
622
|
list.innerHTML = "";
|
|
632
623
|
panel.style.display = "none";
|
package/ui/index.html
CHANGED
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
</div>
|
|
25
25
|
<div class="main">
|
|
26
26
|
<div class="main__header">
|
|
27
|
-
<span class="channel-name" id="header-name"
|
|
28
|
-
<span class="channel-desc" id="header-desc"
|
|
27
|
+
<span class="channel-name" id="header-name"></span>
|
|
28
|
+
<span class="channel-desc" id="header-desc"></span>
|
|
29
29
|
</div>
|
|
30
30
|
<div class="messages" id="messages-scroll">
|
|
31
31
|
<div class="messages__inner" id="messages">
|