@clagentic/console 1.5.0-beta.2 → 1.5.0-beta.3
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/bin/cli.js +1 -0
- package/lib/config.js +80 -6
- package/lib/daemon-projects.js +1 -1
- package/lib/daemon.js +70 -2
- package/lib/project-external-trigger.js +62 -7
- package/lib/project-http.js +17 -1
- package/lib/project-loop.js +2 -1
- package/lib/project-sessions.js +49 -1
- package/lib/project-team.js +417 -0
- package/lib/project.js +14 -1
- package/lib/public/app.js +2 -0
- package/lib/public/css/home-hub.css +36 -0
- package/lib/public/css/icon-strip.css +28 -126
- package/lib/public/css/menus.css +2 -2
- package/lib/public/css/team-panel.css +149 -0
- package/lib/public/index.html +72 -15
- package/lib/public/modules/app-home-hub.js +12 -0
- package/lib/public/modules/app-messages.js +15 -2
- package/lib/public/modules/server-settings.js +74 -5
- package/lib/public/modules/sidebar-mobile.js +9 -88
- package/lib/public/modules/sidebar-sessions.js +4 -0
- package/lib/public/modules/sidebar-users.js +47 -307
- package/lib/public/modules/team-panel.js +331 -0
- package/lib/public/modules/tools.js +3 -0
- package/lib/public/style.css +1 -0
- package/lib/sdk-bridge.js +74 -1
- package/lib/sdk-message-processor.js +36 -0
- package/lib/sdk-worker.js +2 -2
- package/lib/server.js +12 -0
- package/lib/ws-schema.js +12 -0
- package/package.json +1 -1
|
@@ -29,7 +29,7 @@ var SETTINGS_SECTIONS = [
|
|
|
29
29
|
{ section: 'admin-invites', label: 'Invites', group: 'Admin', icon: 'mail', danger: false, adminOnly: true },
|
|
30
30
|
{ section: 'admin-projects', label: 'Projects', group: 'Admin', icon: 'folder', danger: false, adminOnly: true },
|
|
31
31
|
{ section: 'admin-smtp', label: 'Email', group: 'Server', icon: 'send', danger: false, adminOnly: true },
|
|
32
|
-
{ section: '
|
|
32
|
+
{ section: 'advanced', label: 'Advanced', group: 'Server', icon: 'settings-2', danger: false },
|
|
33
33
|
{ section: 'restart', label: 'Restart', group: 'Server', icon: 'refresh-cw', danger: false },
|
|
34
34
|
{ section: 'shutdown', label: 'Shutdown', group: 'Server', icon: 'power', danger: true },
|
|
35
35
|
];
|
|
@@ -233,6 +233,45 @@ export function initServerSettings(appCtx) {
|
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
+
// Advanced Memory: min available memory input
|
|
237
|
+
var memAvailInput = document.getElementById("settings-mem-available-min");
|
|
238
|
+
if (memAvailInput) {
|
|
239
|
+
memAvailInput.addEventListener("change", function () {
|
|
240
|
+
var val = parseInt(this.value, 10);
|
|
241
|
+
if (isNaN(val) || val < 0) return;
|
|
242
|
+
var ws = ctx.ws;
|
|
243
|
+
if (ws && ws.readyState === 1) {
|
|
244
|
+
ws.send(JSON.stringify({ type: "set_mem_available_threshold", value: val }));
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Advanced Memory: tokens per MB headroom input
|
|
250
|
+
var tpmInput = document.getElementById("settings-tokens-per-mb-headroom");
|
|
251
|
+
if (tpmInput) {
|
|
252
|
+
tpmInput.addEventListener("change", function () {
|
|
253
|
+
var val = parseInt(this.value, 10);
|
|
254
|
+
if (isNaN(val) || val < 10 || val > 500) return;
|
|
255
|
+
var ws = ctx.ws;
|
|
256
|
+
if (ws && ws.readyState === 1) {
|
|
257
|
+
ws.send(JSON.stringify({ type: "set_tokens_per_mb_headroom", value: val }));
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// Advanced Memory: collapse toggle
|
|
263
|
+
var advMemToggle = document.getElementById("settings-advanced-memory-toggle");
|
|
264
|
+
var advMemBody = document.getElementById("settings-advanced-memory-body");
|
|
265
|
+
if (advMemToggle && advMemBody) {
|
|
266
|
+
advMemToggle.addEventListener("click", function () {
|
|
267
|
+
var isOpen = !advMemBody.classList.contains("hidden");
|
|
268
|
+
advMemBody.classList.toggle("hidden", isOpen);
|
|
269
|
+
advMemToggle.setAttribute("aria-expanded", String(!isOpen));
|
|
270
|
+
var chevron = advMemToggle.querySelector(".settings-adv-chevron");
|
|
271
|
+
if (chevron) chevron.style.transform = isOpen ? "" : "rotate(90deg)";
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
|
|
236
275
|
// Global CLAUDE.md: save button
|
|
237
276
|
var ssClaudeMdSave = document.getElementById("ss-claudemd-save");
|
|
238
277
|
if (ssClaudeMdSave) {
|
|
@@ -248,6 +287,19 @@ export function initServerSettings(appCtx) {
|
|
|
248
287
|
});
|
|
249
288
|
}
|
|
250
289
|
|
|
290
|
+
// Refresh agent catalog
|
|
291
|
+
var refreshAgentsBtn = document.getElementById("settings-refresh-agents-btn");
|
|
292
|
+
if (refreshAgentsBtn) {
|
|
293
|
+
refreshAgentsBtn.addEventListener("click", function () {
|
|
294
|
+
var ws = ctx.ws;
|
|
295
|
+
if (ws && ws.readyState === 1) {
|
|
296
|
+
refreshAgentsBtn.disabled = true;
|
|
297
|
+
refreshAgentsBtn.innerHTML = '<i data-lucide="refresh-cw" style="width:14px;height:14px;vertical-align:-2px;margin-right:4px;"></i>Refreshing...';
|
|
298
|
+
ws.send(JSON.stringify({ type: "refresh_agents" }));
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
|
|
251
303
|
// Restart server
|
|
252
304
|
var restartBtn = document.getElementById("settings-restart-btn");
|
|
253
305
|
if (restartBtn) {
|
|
@@ -738,17 +790,24 @@ export function updateDaemonConfig(config) {
|
|
|
738
790
|
liteAutoEnrollToggle.checked = !!config.liteAutoEnroll;
|
|
739
791
|
}
|
|
740
792
|
|
|
741
|
-
//
|
|
793
|
+
// Advanced Memory inputs
|
|
794
|
+
var memAvailEl = document.getElementById("settings-mem-available-min");
|
|
795
|
+
if (memAvailEl && config.memAvailableMinMB !== undefined) {
|
|
796
|
+
memAvailEl.value = String(config.memAvailableMinMB);
|
|
797
|
+
}
|
|
798
|
+
var tpmEl = document.getElementById("settings-tokens-per-mb-headroom");
|
|
799
|
+
if (tpmEl && config.tokensPerMbHeadroom !== undefined) {
|
|
800
|
+
tpmEl.value = String(config.tokensPerMbHeadroom);
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
// Show keep awake subsection only on macOS (lives inside the Advanced section)
|
|
742
804
|
var keepAwakeSection = document.getElementById("settings-keep-awake-section");
|
|
743
|
-
var keepAwakeNav = document.getElementById("settings-keep-awake-nav");
|
|
744
805
|
var keepAwakeOpt = document.getElementById("settings-keep-awake-opt");
|
|
745
806
|
if (config.platform === "darwin") {
|
|
746
807
|
if (keepAwakeSection) keepAwakeSection.classList.remove("hidden");
|
|
747
|
-
if (keepAwakeNav) keepAwakeNav.classList.remove("hidden");
|
|
748
808
|
if (keepAwakeOpt) keepAwakeOpt.classList.remove("hidden");
|
|
749
809
|
} else {
|
|
750
810
|
if (keepAwakeSection) keepAwakeSection.classList.add("hidden");
|
|
751
|
-
if (keepAwakeNav) keepAwakeNav.classList.add("hidden");
|
|
752
811
|
if (keepAwakeOpt) keepAwakeOpt.classList.add("hidden");
|
|
753
812
|
}
|
|
754
813
|
}
|
|
@@ -770,6 +829,16 @@ export function handleAutoContinueChanged(msg) {
|
|
|
770
829
|
// Auto-continue is now per-user; server broadcast no longer updates UI
|
|
771
830
|
}
|
|
772
831
|
|
|
832
|
+
export function handleRefreshAgentsResult(msg) {
|
|
833
|
+
var btn = document.getElementById("settings-refresh-agents-btn");
|
|
834
|
+
if (!btn) return;
|
|
835
|
+
// Reset button regardless of ok — the toast (broadcast from server) carries
|
|
836
|
+
// the outcome. If not ok, we just unblock the button silently.
|
|
837
|
+
btn.disabled = false;
|
|
838
|
+
btn.innerHTML = '<i data-lucide="refresh-cw" style="width:14px;height:14px;vertical-align:-2px;margin-right:4px;"></i>Refresh agents';
|
|
839
|
+
refreshIcons();
|
|
840
|
+
}
|
|
841
|
+
|
|
773
842
|
export function handleRestartResult(msg) {
|
|
774
843
|
var restartBtn = document.getElementById("settings-restart-btn");
|
|
775
844
|
var errorEl = document.getElementById("settings-restart-error");
|
|
@@ -42,6 +42,7 @@ import { openDm } from './app-dm.js';
|
|
|
42
42
|
import { showHomeHub } from './app-home-hub.js';
|
|
43
43
|
import { openTerminal } from './terminal.js';
|
|
44
44
|
import { loadRootDirectory } from './filebrowser.js';
|
|
45
|
+
import { renderSheetTeam as renderTeamView } from './team-panel.js';
|
|
45
46
|
|
|
46
47
|
// --- Mobile state ---
|
|
47
48
|
var mobileChatSheetOpen = false;
|
|
@@ -85,9 +86,9 @@ export function openMobileSheet(type) {
|
|
|
85
86
|
fileTree.classList.remove("hidden");
|
|
86
87
|
}
|
|
87
88
|
loadRootDirectory();
|
|
88
|
-
} else if (type === "
|
|
89
|
-
titleEl.textContent = "
|
|
90
|
-
|
|
89
|
+
} else if (type === "team") {
|
|
90
|
+
titleEl.textContent = "Team";
|
|
91
|
+
renderSheetTeam(listEl);
|
|
91
92
|
} else if (type === "more") {
|
|
92
93
|
titleEl.textContent = "More";
|
|
93
94
|
renderSheetMore(listEl);
|
|
@@ -1057,88 +1058,8 @@ function renderSheetMateProfile(listEl) {
|
|
|
1057
1058
|
}
|
|
1058
1059
|
}
|
|
1059
1060
|
|
|
1060
|
-
function
|
|
1061
|
-
|
|
1062
|
-
var wrap = document.createElement("div");
|
|
1063
|
-
wrap.className = "mobile-search-input-wrap";
|
|
1064
|
-
var input = document.createElement("input");
|
|
1065
|
-
input.className = "mobile-search-input";
|
|
1066
|
-
input.type = "text";
|
|
1067
|
-
input.placeholder = "Search sessions, messages...";
|
|
1068
|
-
input.autocomplete = "off";
|
|
1069
|
-
input.spellcheck = false;
|
|
1070
|
-
wrap.appendChild(input);
|
|
1071
|
-
listEl.appendChild(wrap);
|
|
1072
|
-
|
|
1073
|
-
// Results container
|
|
1074
|
-
var resultsEl = document.createElement("div");
|
|
1075
|
-
resultsEl.style.padding = "0 8px";
|
|
1076
|
-
listEl.appendChild(resultsEl);
|
|
1077
|
-
|
|
1078
|
-
// Auto-focus
|
|
1079
|
-
setTimeout(function () { input.focus(); }, 300);
|
|
1080
|
-
|
|
1081
|
-
// Show all sessions initially
|
|
1082
|
-
renderSearchResults(resultsEl, "");
|
|
1083
|
-
|
|
1084
|
-
input.addEventListener("input", function () {
|
|
1085
|
-
var q = input.value.trim().toLowerCase();
|
|
1086
|
-
renderSearchResults(resultsEl, q);
|
|
1087
|
-
});
|
|
1088
|
-
input.addEventListener("keydown", function (e) { e.stopPropagation(); });
|
|
1089
|
-
input.addEventListener("keyup", function (e) { e.stopPropagation(); });
|
|
1090
|
-
input.addEventListener("keypress", function (e) { e.stopPropagation(); });
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
function renderSearchResults(container, query) {
|
|
1094
|
-
container.innerHTML = "";
|
|
1095
|
-
var sorted = getCachedSessions().slice().sort(function (a, b) {
|
|
1096
|
-
if (!!a.bookmarked !== !!b.bookmarked) return a.bookmarked ? -1 : 1;
|
|
1097
|
-
return (b.lastActivity || 0) - (a.lastActivity || 0);
|
|
1098
|
-
});
|
|
1099
|
-
|
|
1100
|
-
var found = 0;
|
|
1101
|
-
for (var i = 0; i < sorted.length; i++) {
|
|
1102
|
-
var s = sorted[i];
|
|
1103
|
-
var title = s.title || "New Session";
|
|
1104
|
-
if (query && title.toLowerCase().indexOf(query) === -1) continue;
|
|
1105
|
-
found++;
|
|
1106
|
-
|
|
1107
|
-
var el = document.createElement("button");
|
|
1108
|
-
el.className = "mobile-session-item";
|
|
1109
|
-
if (s.active) el.classList.add("active");
|
|
1110
|
-
|
|
1111
|
-
var titleSpan = document.createElement("span");
|
|
1112
|
-
titleSpan.className = "mobile-session-title";
|
|
1113
|
-
titleSpan.appendChild(document.createTextNode(title));
|
|
1114
|
-
el.appendChild(titleSpan);
|
|
1115
|
-
|
|
1116
|
-
if (s.isProcessing) {
|
|
1117
|
-
var dot = document.createElement("span");
|
|
1118
|
-
dot.className = "mobile-session-processing";
|
|
1119
|
-
el.appendChild(dot);
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
(function (id) {
|
|
1123
|
-
el.addEventListener("click", function () {
|
|
1124
|
-
if (dismissOverlayPanels) dismissOverlayPanels();
|
|
1125
|
-
closeMobileSheetThen(function () {
|
|
1126
|
-
if (getWs() && store.get('connected')) {
|
|
1127
|
-
getWs().send(JSON.stringify({ type: "switch_session", id: id }));
|
|
1128
|
-
}
|
|
1129
|
-
});
|
|
1130
|
-
});
|
|
1131
|
-
})(s.id);
|
|
1132
|
-
|
|
1133
|
-
container.appendChild(el);
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
if (found === 0 && query) {
|
|
1137
|
-
var empty = document.createElement("div");
|
|
1138
|
-
empty.className = "mobile-alert-empty";
|
|
1139
|
-
empty.textContent = 'No results for "' + query + '"';
|
|
1140
|
-
container.appendChild(empty);
|
|
1141
|
-
}
|
|
1061
|
+
function renderSheetTeam(listEl) {
|
|
1062
|
+
renderTeamView(listEl);
|
|
1142
1063
|
}
|
|
1143
1064
|
|
|
1144
1065
|
function renderSheetMore(listEl) {
|
|
@@ -1409,9 +1330,9 @@ export function initSidebarMobile() {
|
|
|
1409
1330
|
} else if (name === "chat") {
|
|
1410
1331
|
openMobileSheet("sessions");
|
|
1411
1332
|
setMobileTabActive("chat");
|
|
1412
|
-
} else if (name === "
|
|
1413
|
-
|
|
1414
|
-
setMobileTabActive("
|
|
1333
|
+
} else if (name === "team") {
|
|
1334
|
+
openMobileSheet("team");
|
|
1335
|
+
setMobileTabActive("team");
|
|
1415
1336
|
} else if (name === "more") {
|
|
1416
1337
|
openMobileSheet("more");
|
|
1417
1338
|
setMobileTabActive("more");
|
|
@@ -1360,6 +1360,10 @@ export function renderSessionList(sessions) {
|
|
|
1360
1360
|
refreshIcons();
|
|
1361
1361
|
if (updatePageTitle) updatePageTitle();
|
|
1362
1362
|
syncHeaderSearchUi();
|
|
1363
|
+
// Re-arm the countdown timer after each render. startCountdownTimer() is a
|
|
1364
|
+
// no-op when schedules are outside the 3-minute window or the timer is
|
|
1365
|
+
// already running, so calling it here is safe and low-cost.
|
|
1366
|
+
startCountdownTimer();
|
|
1363
1367
|
}
|
|
1364
1368
|
|
|
1365
1369
|
// --- Search results ---
|
|
@@ -3,13 +3,9 @@
|
|
|
3
3
|
// Contains only human-user functionality; all mate-specific rendering is removed.
|
|
4
4
|
|
|
5
5
|
import { userAvatarUrl } from './avatar.js';
|
|
6
|
-
import { escapeHtml } from './utils.js';
|
|
7
|
-
import { iconHtml, refreshIcons } from './icons.js';
|
|
8
6
|
import { store } from './store.js';
|
|
9
7
|
import { getWs } from './ws-ref.js';
|
|
10
|
-
import {
|
|
11
|
-
import { spawnDustParticles } from './sidebar.js';
|
|
12
|
-
import { openDm } from './app-dm.js';
|
|
8
|
+
import { toggleTeamPanel } from './team-panel.js';
|
|
13
9
|
|
|
14
10
|
function sendWs(msg) {
|
|
15
11
|
var ws = getWs();
|
|
@@ -18,7 +14,6 @@ function sendWs(msg) {
|
|
|
18
14
|
|
|
19
15
|
// --- User strip state ---
|
|
20
16
|
var cachedAllUsers = [];
|
|
21
|
-
var cachedOnlineUserIds = [];
|
|
22
17
|
var cachedDmFavorites = [];
|
|
23
18
|
var cachedDmConversations = [];
|
|
24
19
|
var cachedDmUnread = {};
|
|
@@ -27,34 +22,50 @@ var currentDmUserId = null;
|
|
|
27
22
|
var dmPickerOpen = false;
|
|
28
23
|
var cachedDmRemovedUsers = {};
|
|
29
24
|
|
|
25
|
+
|
|
30
26
|
// setMentionActive / clearAllMentionActive kept as no-ops for call-site
|
|
31
27
|
// compatibility — mentions were a mates-only feature.
|
|
32
28
|
export function setMentionActive(mateId, active) { /* no-op: mates removed */ }
|
|
33
29
|
export function clearAllMentionActive() { /* no-op: mates removed */ }
|
|
34
30
|
|
|
35
|
-
var _lastUserStripJson = "";
|
|
36
|
-
|
|
37
31
|
// --- Icon strip tooltip ---
|
|
38
32
|
var iconStripTooltip = null;
|
|
39
33
|
|
|
40
|
-
// --- DM user context menu ---
|
|
41
|
-
var userCtxMenu = null;
|
|
42
|
-
|
|
43
34
|
export function initSidebarUsers() {
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
35
|
+
// Wire the permanent Teams button in the icon strip.
|
|
36
|
+
var teamBtn = document.getElementById("icon-strip-team-btn");
|
|
37
|
+
if (teamBtn) {
|
|
38
|
+
teamBtn.addEventListener("click", function () {
|
|
39
|
+
if (typeof toggleTeamPanel === "function") toggleTeamPanel();
|
|
40
|
+
});
|
|
41
|
+
teamBtn.addEventListener("mouseenter", function () { showIconTooltip(teamBtn, "Team"); });
|
|
42
|
+
teamBtn.addEventListener("mouseleave", hideIconTooltip);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Keep local caches in sync with the store so getCachedDm* accessors and
|
|
46
|
+
// the DM picker remain accurate even though nothing renders in the icon strip.
|
|
47
|
+
store.subscribe(['cachedAllUsers', 'cachedOnlineIds', 'cachedDmFavorites', 'cachedDmConversations', 'dmUnread', 'dmRemovedUsers', 'myUserId'], function (state) {
|
|
48
|
+
cachedAllUsers = state.cachedAllUsers || [];
|
|
49
|
+
cachedDmFavorites = state.cachedDmFavorites || [];
|
|
50
|
+
cachedDmConversations = state.cachedDmConversations || [];
|
|
51
|
+
cachedDmUnread = state.dmUnread || {};
|
|
52
|
+
cachedDmRemovedUsers = state.dmRemovedUsers || {};
|
|
53
|
+
cachedMyUserId = state.myUserId;
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// Request agent list on connect/reconnect so favorites are populated.
|
|
57
|
+
store.subscribe(['connected'], function (state, prev) {
|
|
58
|
+
if (state.connected && !prev.connected) {
|
|
59
|
+
sendWs({ type: "list_agents" });
|
|
54
60
|
}
|
|
55
61
|
});
|
|
56
62
|
}
|
|
57
63
|
|
|
64
|
+
// handleAgentsList: no-op stub — agent-picker.js is the authoritative consumer.
|
|
65
|
+
// This export is kept because app-messages.js imports it as handleAgentsListTeam.
|
|
66
|
+
// TODO(lr-teams-icon-strip): remove this alias once app-messages.js import is cleaned up.
|
|
67
|
+
export function handleAgentsList(_msg) { /* no-op: agent-picker.js handles agents_list */ }
|
|
68
|
+
|
|
58
69
|
export function showIconTooltip(el, text) {
|
|
59
70
|
hideIconTooltip();
|
|
60
71
|
var tip = document.createElement("div");
|
|
@@ -94,63 +105,10 @@ export function hideIconTooltip() {
|
|
|
94
105
|
}
|
|
95
106
|
}
|
|
96
107
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
document.removeEventListener("click", handleUserCtxOutsideClick, true);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function showUserCtxMenu(anchorEl, user) {
|
|
106
|
-
closeUserCtxMenu();
|
|
107
|
-
if (closeProjectCtxMenu) closeProjectCtxMenu();
|
|
108
|
-
|
|
109
|
-
var menu = document.createElement("div");
|
|
110
|
-
menu.className = "project-ctx-menu";
|
|
111
|
-
|
|
112
|
-
var removeItem = document.createElement("button");
|
|
113
|
-
removeItem.className = "project-ctx-item project-ctx-delete";
|
|
114
|
-
removeItem.innerHTML = iconHtml("user-minus") + " <span>Remove from favorites</span>";
|
|
115
|
-
removeItem.addEventListener("click", function (e) {
|
|
116
|
-
e.stopPropagation();
|
|
117
|
-
var iconRect = anchorEl.getBoundingClientRect();
|
|
118
|
-
if (spawnDustParticles) spawnDustParticles(iconRect.left + iconRect.width / 2, iconRect.top + iconRect.height / 2);
|
|
119
|
-
closeUserCtxMenu();
|
|
120
|
-
cachedDmRemovedUsers[user.id] = true;
|
|
121
|
-
var dr = Object.assign({}, store.get('dmRemovedUsers')); dr[user.id] = true; store.set({ dmRemovedUsers: dr });
|
|
122
|
-
sendWs({ type: "dm_remove_favorite", targetUserId: user.id });
|
|
123
|
-
});
|
|
124
|
-
menu.appendChild(removeItem);
|
|
125
|
-
|
|
126
|
-
document.body.appendChild(menu);
|
|
127
|
-
userCtxMenu = menu;
|
|
128
|
-
refreshIcons();
|
|
129
|
-
|
|
130
|
-
requestAnimationFrame(function () {
|
|
131
|
-
var rect = anchorEl.getBoundingClientRect();
|
|
132
|
-
menu.style.position = "fixed";
|
|
133
|
-
menu.style.left = (rect.right + 6) + "px";
|
|
134
|
-
menu.style.top = rect.top + "px";
|
|
135
|
-
var menuRect = menu.getBoundingClientRect();
|
|
136
|
-
if (menuRect.right > window.innerWidth - 8) {
|
|
137
|
-
menu.style.left = (rect.left - menuRect.width - 6) + "px";
|
|
138
|
-
}
|
|
139
|
-
if (menuRect.bottom > window.innerHeight - 8) {
|
|
140
|
-
menu.style.top = (window.innerHeight - menuRect.height - 8) + "px";
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
setTimeout(function () {
|
|
145
|
-
document.addEventListener("click", handleUserCtxOutsideClick, true);
|
|
146
|
-
}, 0);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function handleUserCtxOutsideClick(e) {
|
|
150
|
-
if (userCtxMenu && !userCtxMenu.contains(e.target)) {
|
|
151
|
-
closeUserCtxMenu();
|
|
152
|
-
}
|
|
153
|
-
}
|
|
108
|
+
// closeUserCtxMenu: no-op stub retained for sidebar-projects.js and sidebar.js
|
|
109
|
+
// imports. The user context menu was attached to per-user icon-strip items that
|
|
110
|
+
// no longer exist; nothing can open it, so nothing needs to close it.
|
|
111
|
+
export function closeUserCtxMenu() { /* no-op: icon-strip user context menu removed */ }
|
|
154
112
|
|
|
155
113
|
var _lastSidebarPresenceIds = [];
|
|
156
114
|
export function renderSidebarPresence(onlineUsers) {
|
|
@@ -185,216 +143,12 @@ export function renderSidebarPresence(onlineUsers) {
|
|
|
185
143
|
}
|
|
186
144
|
}
|
|
187
145
|
|
|
188
|
-
// renderUserStrip:
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
onlineUserIds = s.cachedOnlineIds;
|
|
194
|
-
myUserId = s.myUserId;
|
|
195
|
-
dmFavorites = s.cachedDmFavorites;
|
|
196
|
-
dmConversations = s.cachedDmConversations;
|
|
197
|
-
dmUnread = s.dmUnread;
|
|
198
|
-
dmRemovedUsers = s.dmRemovedUsers;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
var fingerprint = JSON.stringify([allUsers, onlineUserIds, dmFavorites, dmConversations, dmUnread, dmRemovedUsers]);
|
|
202
|
-
if (fingerprint === _lastUserStripJson) return;
|
|
203
|
-
_lastUserStripJson = fingerprint;
|
|
204
|
-
|
|
205
|
-
cachedAllUsers = allUsers || [];
|
|
206
|
-
cachedOnlineUserIds = onlineUserIds || [];
|
|
207
|
-
cachedDmFavorites = dmFavorites || [];
|
|
208
|
-
cachedDmConversations = dmConversations || [];
|
|
209
|
-
cachedDmUnread = dmUnread || {};
|
|
210
|
-
cachedDmRemovedUsers = dmRemovedUsers || {};
|
|
211
|
-
cachedMyUserId = myUserId;
|
|
212
|
-
|
|
213
|
-
var container = document.getElementById("icon-strip-users");
|
|
214
|
-
if (!container) return;
|
|
215
|
-
|
|
216
|
-
var allOthers = cachedAllUsers.filter(function (u) { return u.id !== myUserId; });
|
|
217
|
-
|
|
218
|
-
// Hide section if no other users
|
|
219
|
-
if (allOthers.length === 0) {
|
|
220
|
-
container.innerHTML = "";
|
|
221
|
-
container.classList.add("hidden");
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// Show only favorites + users with unread + users with DM conversations
|
|
226
|
-
var others = allOthers.filter(function (u) {
|
|
227
|
-
if (cachedDmRemovedUsers[u.id]) return false;
|
|
228
|
-
if (cachedDmFavorites.indexOf(u.id) !== -1) return true;
|
|
229
|
-
if (cachedDmUnread[u.id] && cachedDmUnread[u.id] > 0) return true;
|
|
230
|
-
if (cachedDmConversations.indexOf(u.id) !== -1) return true;
|
|
231
|
-
return false;
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
container.classList.remove("hidden");
|
|
235
|
-
container.innerHTML = "";
|
|
236
|
-
|
|
237
|
-
for (var i = 0; i < others.length; i++) {
|
|
238
|
-
(function (u) {
|
|
239
|
-
var el = document.createElement("div");
|
|
240
|
-
el.className = "icon-strip-user";
|
|
241
|
-
el.dataset.userId = u.id;
|
|
242
|
-
if (u.id === currentDmUserId) el.classList.add("active");
|
|
243
|
-
if (onlineUserIds.indexOf(u.id) !== -1) el.classList.add("online");
|
|
244
|
-
|
|
245
|
-
var pill = document.createElement("span");
|
|
246
|
-
pill.className = "icon-strip-pill";
|
|
247
|
-
el.appendChild(pill);
|
|
248
|
-
|
|
249
|
-
var avatar = document.createElement("img");
|
|
250
|
-
avatar.className = "icon-strip-user-avatar";
|
|
251
|
-
avatar.src = userAvatarUrl(u, 34);
|
|
252
|
-
avatar.alt = u.displayName;
|
|
253
|
-
el.appendChild(avatar);
|
|
254
|
-
|
|
255
|
-
var onlineDot = document.createElement("span");
|
|
256
|
-
onlineDot.className = "icon-strip-user-online";
|
|
257
|
-
el.appendChild(onlineDot);
|
|
258
|
-
|
|
259
|
-
var badge = document.createElement("span");
|
|
260
|
-
badge.className = "icon-strip-user-badge";
|
|
261
|
-
badge.dataset.userId = u.id;
|
|
262
|
-
el.appendChild(badge);
|
|
263
|
-
|
|
264
|
-
var unreadCount = cachedDmUnread[u.id] || 0;
|
|
265
|
-
if (unreadCount > 0 && u.id !== currentDmUserId) {
|
|
266
|
-
badge.textContent = unreadCount > 99 ? "99+" : String(unreadCount);
|
|
267
|
-
badge.classList.add("has-unread");
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
el.addEventListener("mouseenter", function () { showIconTooltip(el, u.displayName); });
|
|
271
|
-
el.addEventListener("mouseleave", hideIconTooltip);
|
|
272
|
-
|
|
273
|
-
el.addEventListener("click", function () {
|
|
274
|
-
if (openDm) openDm(u.id);
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
el.addEventListener("contextmenu", function (e) {
|
|
278
|
-
e.preventDefault();
|
|
279
|
-
e.stopPropagation();
|
|
280
|
-
showUserCtxMenu(el, u);
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
container.appendChild(el);
|
|
284
|
-
})(others[i]);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
// Add user (+) button — only shown in multi-user mode
|
|
288
|
-
if (store.get('isMultiUserMode')) {
|
|
289
|
-
var addBtn = document.createElement("button");
|
|
290
|
-
addBtn.className = "icon-strip-invite";
|
|
291
|
-
addBtn.innerHTML = iconHtml("user-plus");
|
|
292
|
-
addBtn.addEventListener("click", function (e) {
|
|
293
|
-
e.stopPropagation();
|
|
294
|
-
toggleDmUserPicker(addBtn);
|
|
295
|
-
});
|
|
296
|
-
addBtn.addEventListener("mouseenter", function () { showIconTooltip(addBtn, "Add user"); });
|
|
297
|
-
addBtn.addEventListener("mouseleave", hideIconTooltip);
|
|
298
|
-
container.appendChild(addBtn);
|
|
299
|
-
refreshIcons();
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
function toggleDmUserPicker(anchorEl) {
|
|
304
|
-
if (dmPickerOpen) {
|
|
305
|
-
closeDmUserPicker();
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
dmPickerOpen = true;
|
|
309
|
-
|
|
310
|
-
var picker = document.createElement("div");
|
|
311
|
-
picker.className = "dm-user-picker";
|
|
312
|
-
picker.id = "dm-user-picker";
|
|
313
|
-
|
|
314
|
-
var searchInput = document.createElement("input");
|
|
315
|
-
searchInput.className = "dm-user-picker-search";
|
|
316
|
-
searchInput.type = "text";
|
|
317
|
-
searchInput.placeholder = "Search users...";
|
|
318
|
-
picker.appendChild(searchInput);
|
|
319
|
-
|
|
320
|
-
var usersLabel = document.createElement("div");
|
|
321
|
-
usersLabel.className = "dm-user-picker-section";
|
|
322
|
-
usersLabel.textContent = "Users";
|
|
323
|
-
picker.appendChild(usersLabel);
|
|
324
|
-
|
|
325
|
-
var listEl = document.createElement("div");
|
|
326
|
-
listEl.className = "dm-user-picker-list";
|
|
327
|
-
picker.appendChild(listEl);
|
|
328
|
-
|
|
329
|
-
document.body.appendChild(picker);
|
|
330
|
-
var rect = anchorEl.getBoundingClientRect();
|
|
331
|
-
picker.style.left = (rect.right + 8) + "px";
|
|
332
|
-
picker.style.bottom = (window.innerHeight - rect.bottom) + "px";
|
|
146
|
+
// renderUserStrip: retained as a no-op export — callers in app-messages.js
|
|
147
|
+
// invoke this on projects_updated. The icon strip no longer shows per-user
|
|
148
|
+
// avatars; all that lives in the team panel (opened via #icon-strip-team-btn).
|
|
149
|
+
// TODO(lr-teams-icon-strip): remove call sites in app-messages.js once callers are updated.
|
|
150
|
+
export function renderUserStrip() { /* no-op: team panel replaced icon-strip avatars */ }
|
|
333
151
|
|
|
334
|
-
function renderPickerList(filter) {
|
|
335
|
-
listEl.innerHTML = "";
|
|
336
|
-
var allOthers = cachedAllUsers.filter(function (u) { return u.id !== cachedMyUserId; });
|
|
337
|
-
var available = allOthers.filter(function (u) {
|
|
338
|
-
return cachedDmFavorites.indexOf(u.id) === -1;
|
|
339
|
-
});
|
|
340
|
-
if (filter) {
|
|
341
|
-
var lf = filter.toLowerCase();
|
|
342
|
-
available = available.filter(function (u) {
|
|
343
|
-
return (u.displayName && u.displayName.toLowerCase().indexOf(lf) !== -1) ||
|
|
344
|
-
(u.username && u.username.toLowerCase().indexOf(lf) !== -1);
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
if (available.length === 0) {
|
|
348
|
-
var emptyEl = document.createElement("div");
|
|
349
|
-
emptyEl.className = "dm-user-picker-empty";
|
|
350
|
-
emptyEl.textContent = filter ? "No users found" : "No more users to add";
|
|
351
|
-
listEl.appendChild(emptyEl);
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
for (var i = 0; i < available.length; i++) {
|
|
355
|
-
(function (u) {
|
|
356
|
-
var item = document.createElement("div");
|
|
357
|
-
item.className = "dm-user-picker-item";
|
|
358
|
-
|
|
359
|
-
var av = document.createElement("img");
|
|
360
|
-
av.className = "dm-user-picker-avatar";
|
|
361
|
-
av.src = userAvatarUrl(u, 28);
|
|
362
|
-
av.alt = u.displayName;
|
|
363
|
-
item.appendChild(av);
|
|
364
|
-
|
|
365
|
-
var name = document.createElement("span");
|
|
366
|
-
name.className = "dm-user-picker-name";
|
|
367
|
-
name.textContent = u.displayName;
|
|
368
|
-
item.appendChild(name);
|
|
369
|
-
|
|
370
|
-
item.addEventListener("click", function () {
|
|
371
|
-
sendWs({ type: "dm_add_favorite", targetUserId: u.id });
|
|
372
|
-
closeDmUserPicker();
|
|
373
|
-
});
|
|
374
|
-
|
|
375
|
-
listEl.appendChild(item);
|
|
376
|
-
})(available[i]);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
renderPickerList("");
|
|
381
|
-
searchInput.addEventListener("input", function () {
|
|
382
|
-
renderPickerList(searchInput.value);
|
|
383
|
-
});
|
|
384
|
-
|
|
385
|
-
setTimeout(function () { searchInput.focus(); }, 50);
|
|
386
|
-
|
|
387
|
-
function onDocClick(e) {
|
|
388
|
-
if (!picker.contains(e.target) && e.target !== anchorEl && !anchorEl.contains(e.target)) {
|
|
389
|
-
closeDmUserPicker();
|
|
390
|
-
document.removeEventListener("click", onDocClick, true);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
setTimeout(function () {
|
|
394
|
-
document.addEventListener("click", onDocClick, true);
|
|
395
|
-
}, 10);
|
|
396
|
-
picker._docClickHandler = onDocClick;
|
|
397
|
-
}
|
|
398
152
|
|
|
399
153
|
export function closeDmUserPicker() {
|
|
400
154
|
dmPickerOpen = false;
|
|
@@ -409,28 +163,14 @@ export function closeDmUserPicker() {
|
|
|
409
163
|
|
|
410
164
|
export function setCurrentDmUser(userId) {
|
|
411
165
|
currentDmUserId = userId;
|
|
412
|
-
//
|
|
413
|
-
|
|
414
|
-
for (var i = 0; i < items.length; i++) {
|
|
415
|
-
if (items[i].dataset.userId === userId) {
|
|
416
|
-
items[i].classList.add("active");
|
|
417
|
-
} else {
|
|
418
|
-
items[i].classList.remove("active");
|
|
419
|
-
}
|
|
420
|
-
}
|
|
166
|
+
// Icon-strip user avatars are gone; active DM state is tracked in currentDmUserId
|
|
167
|
+
// for use by the team panel and DM picker.
|
|
421
168
|
}
|
|
422
169
|
|
|
423
|
-
export
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
badge.textContent = count > 99 ? "99+" : String(count);
|
|
428
|
-
badge.classList.add("has-unread");
|
|
429
|
-
} else {
|
|
430
|
-
badge.textContent = "";
|
|
431
|
-
badge.classList.remove("has-unread");
|
|
432
|
-
}
|
|
433
|
-
}
|
|
170
|
+
// updateDmBadge: retained as a no-op export — DM unread counts are now shown
|
|
171
|
+
// only inside the team panel, not in the icon strip.
|
|
172
|
+
// TODO(lr-teams-icon-strip): wire to team panel badge once panel shows DM counts.
|
|
173
|
+
export function updateDmBadge(userId, count) { /* no-op: icon-strip user badges removed */ }
|
|
434
174
|
|
|
435
175
|
export function getCurrentDmUserId() {
|
|
436
176
|
return currentDmUserId;
|