From de94859a16cc54ea45e0dd3b2aee9a2bbbe65ee0 Mon Sep 17 00:00:00 2001 From: Moepchi Date: Thu, 12 Nov 2026 20:28:16 +0000 Subject: [PATCH] Client tree: channel group icon after the server group icons Like the native client: server group icons, channel group icon, then the flag on the far right. The channel group list is now fetched on connect like the server group list, and its custom icons are downloaded too. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU --- web/src/App.tsx | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/web/src/App.tsx b/web/src/App.tsx index 0d5df12..69291da 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -1483,6 +1483,7 @@ function ChannelTree({ ownClientId, talkers, serverGroups, + channelGroups = null, groupIconImages, selected, sessionKey, @@ -1501,6 +1502,8 @@ function ChannelTree({ ownClientId: number | null; talkers: Set; serverGroups: GroupEntry[] | null; + /** For the channel group icon, shown after the server group icons like in the native client. */ + channelGroups?: GroupEntry[] | null; groupIconImages: Record; selected: SelectedItem | null; /** Identifies which multi-join tab this tree belongs to, so the manual @@ -1527,12 +1530,12 @@ function ChannelTree({ const children = channels.filter((c) => c.parent === parent).sort((a, b) => a.order - b.order); if (children.length === 0) return null; + // Server group icons, then the channel group icon (the flag follows last). const clientGroupBadges = (client: ClientInfo): GroupEntry[] => - serverGroups - ? client.serverGroups - .map((gid) => serverGroups.find((g) => g.id === gid)) - .filter((g): g is GroupEntry => !!g && g.iconId !== 0) - : []; + [ + ...(serverGroups ? client.serverGroups.map((gid) => serverGroups.find((g) => g.id === gid)) : []), + channelGroups?.find((g) => g.id === client.channelGroup), + ].filter((g): g is GroupEntry => !!g && g.iconId !== 0); // "Own channel" mode keeps the own channel and the channels above it open. const ownPath = new Set(); @@ -1605,6 +1608,7 @@ function ChannelTree({ ownClientId={ownClientId} talkers={talkers} serverGroups={serverGroups} + channelGroups={channelGroups} groupIconImages={groupIconImages} selected={selected} sessionKey={sessionKey} @@ -11142,6 +11146,10 @@ function AppInner() { if (!connected || serverGroups) return; socketRef.current?.send(JSON.stringify({ type: "getServerGroupList" })); }, [connected, serverGroups]); + useEffect(() => { + if (!connected || channelGroups) return; + socketRef.current?.send(JSON.stringify({ type: "getChannelGroupList" })); + }, [connected, channelGroups]); // Same icon-file cache as the server icons dialog (fileDownloadData for // cid 0 always lands in serverIconImages, regardless of who asked) - fetch @@ -11155,13 +11163,14 @@ function AppInner() { useEffect(() => { if (!serverGroups) return; const iconById = new Map(serverGroups.map((g) => [g.id, g.iconId])); + const channelIconById = new Map((channelGroups ?? []).map((g) => [g.id, g.iconId])); // Plus every group listed in an open group menu, so unassigned ones show their icon too. const menuGroups = !groupAssignTarget ? [] : ((groupAssignTarget.kind === "channel" ? channelGroups : serverGroups) ?? []); const wantedIconIds = new Set( clients - .flatMap((c) => c.serverGroups.map((gid) => iconById.get(gid) ?? 0)) + .flatMap((c) => [...c.serverGroups.map((gid) => iconById.get(gid) ?? 0), channelIconById.get(c.channelGroup) ?? 0]) .concat(menuGroups.map((g) => g.iconId)) .filter((id) => id >= CUSTOM_ICON_ID_THRESHOLD) ); @@ -14608,6 +14617,7 @@ function AppInner() { ownClientId={ownClientId ?? ownClient?.id ?? null} talkers={displayTalkers} serverGroups={serverGroups} + channelGroups={channelGroups} groupIconImages={serverIconImages} selected={selected} sessionKey={activeSessionId ?? ""}