agentchannel 0.7.21 → 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 +41 -27
- 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
|
|
|
@@ -170,12 +170,19 @@ function richText(t) {
|
|
|
170
170
|
// Render messages
|
|
171
171
|
// ---------------------------------------------------------------------------
|
|
172
172
|
function render() {
|
|
173
|
-
var filtered
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
173
|
+
var filtered;
|
|
174
|
+
if (activeChannel === "all") {
|
|
175
|
+
filtered = allMessages.slice();
|
|
176
|
+
} else if (activeChannel === "@me") {
|
|
177
|
+
filtered = allMessages.filter(function(m) {
|
|
178
|
+
return m.content && CONFIG.name && m.content.indexOf("@" + CONFIG.name) !== -1;
|
|
179
|
+
});
|
|
180
|
+
} else {
|
|
181
|
+
filtered = allMessages.filter(function(m) {
|
|
182
|
+
var mid = m.subchannel ? m.channel + '/' + m.subchannel : m.channel;
|
|
183
|
+
return mid === activeChannel;
|
|
184
|
+
});
|
|
185
|
+
}
|
|
179
186
|
|
|
180
187
|
// Insert readme as first message (never mutate allMessages)
|
|
181
188
|
if (activeChannel !== "all") {
|
|
@@ -278,23 +285,23 @@ function renderSidebar() {
|
|
|
278
285
|
}
|
|
279
286
|
}
|
|
280
287
|
|
|
281
|
-
//
|
|
282
|
-
var
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
288
|
+
// @Mentions — only show if there are mentions
|
|
289
|
+
var mentionCount = allMessages.filter(function(m) { return m.content && CONFIG.name && m.content.indexOf("@" + CONFIG.name) !== -1; }).length;
|
|
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
|
+
}
|
|
298
305
|
|
|
299
306
|
// Render each parent + children
|
|
300
307
|
for (var pi = 0; pi < parents.length; pi++) {
|
|
@@ -518,6 +525,11 @@ async function init() {
|
|
|
518
525
|
}
|
|
519
526
|
|
|
520
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
|
+
}
|
|
521
533
|
renderSidebar();
|
|
522
534
|
render();
|
|
523
535
|
|
|
@@ -602,8 +614,10 @@ async function init() {
|
|
|
602
614
|
var header = document.querySelector(".members__header");
|
|
603
615
|
if (!list || !panel) return;
|
|
604
616
|
|
|
605
|
-
// Hide members for
|
|
606
|
-
|
|
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) {
|
|
607
621
|
if (header) header.textContent = "MEMBERS";
|
|
608
622
|
list.innerHTML = "";
|
|
609
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">
|