From de9f3ad2fbe758b1c79c95cb0c9835cb847d1e2c Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Fri, 28 Aug 2026 02:40:07 +0200 Subject: [PATCH] VC user list --- src/components/view/Sidebar.tsx | 79 ++++++++++++++++++++++++++------- 1 file changed, 62 insertions(+), 17 deletions(-) diff --git a/src/components/view/Sidebar.tsx b/src/components/view/Sidebar.tsx index 5113fb0..31e837a 100644 --- a/src/components/view/Sidebar.tsx +++ b/src/components/view/Sidebar.tsx @@ -4,6 +4,7 @@ import { ChevronDown, ChevronUp, HashIcon, Volume2Icon } from "lucide-react"; import { useState } from "react"; import StatusCard from "./StatusCard"; import { cn } from "@/lib/utils"; +import { Avatar, AvatarFallback, AvatarImage } from "../ui/avatar"; export function ChannelIcon({ kind }: { kind: ChannelKind["kind"] }) { switch (kind) { @@ -49,6 +50,48 @@ export function RenderCategory({ ); } +export function RenderFeatures({ + appRef, + channel, +}: { + appRef: React.RefObject; + channel: Channel; +}) { + switch (channel.kind) { + case "voice": + const users = appRef.current?.server?.voiceChatUsers[channel.id]; + + return ( + users && ( +
+ {users.map((pubkey) => { + const user = appRef.current?.server?.users[pubkey]; + if (!user) return null; + + return ( +
+ + + + {user?.displayName.slice(0, 1).toUpperCase() || + pubkey.slice(0, 2).toUpperCase()} + + + + + {user.displayName} + +
+ ); + })} +
+ ) + ); + default: + return null; + } +} + export function RenderChannels({ appRef, channels, @@ -60,25 +103,27 @@ export function RenderChannels({ channel.kind === "category" ? ( ) : ( -
{ - if (!appRef.current) { - console.error("AppRef is not initialized yet"); - return; - } +
+
{ + if (!appRef.current) { + console.error("AppRef is not initialized yet"); + return; + } - appRef.current.page = { kind: "channel", channel }; + appRef.current.page = { kind: "channel", channel }; - appRef.current.forceRender(); - }} - > - - {channel.name} + appRef.current.forceRender(); + }} + > + + {channel.name} +
+
), );