From 5b964392b9c8144a64476f101004031efd9b6b90 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Fri, 28 Aug 2026 02:51:38 +0200 Subject: [PATCH] Join on click and speaking on server channel list --- src/components/page/channel/VoiceChannel.tsx | 32 ++++++++------------ src/components/view/Sidebar.tsx | 12 +++++++- src/components/view/StatusCard.tsx | 2 +- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/components/page/channel/VoiceChannel.tsx b/src/components/page/channel/VoiceChannel.tsx index 25e2366..2fe0fc1 100644 --- a/src/components/page/channel/VoiceChannel.tsx +++ b/src/components/page/channel/VoiceChannel.tsx @@ -1,9 +1,8 @@ import Enclave from "@/app/app"; import { ChannelPageProps } from "../PageView"; +import { useEffect } from "react"; import { cn } from "@/lib/utils"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; -import { Button } from "@/components/ui/button"; -import { Phone } from "lucide-react"; export default function VoiceChannel({ appRef, @@ -11,11 +10,18 @@ export default function VoiceChannel({ appRef: React.RefObject | null>; }) { const channel = appRef.current?.page?.channel; - if (!channel) return null; - const isConnected = - appRef.current?.server?.isInVoiceChat && - appRef.current.server.voiceChannelId === channel.id; + useEffect(() => { + if (!channel || channel.kind !== "voice") return; + + const server = appRef.current?.server; + + if (!server || server.voiceChannelId === channel.id) return; + + appRef.current?.joinVoice(channel); + }, [channel?.id]); + + if (!channel) return null; const speakers = appRef.current?.server?.voiceChatSpeakers && @@ -96,20 +102,6 @@ export default function VoiceChannel({ ); })} - - {/* Bottom Control Bar */} - {!isConnected && ( -
- -
- )} ); } \ No newline at end of file diff --git a/src/components/view/Sidebar.tsx b/src/components/view/Sidebar.tsx index 31e837a..fe2920c 100644 --- a/src/components/view/Sidebar.tsx +++ b/src/components/view/Sidebar.tsx @@ -68,9 +68,19 @@ export function RenderFeatures({ const user = appRef.current?.server?.users[pubkey]; if (!user) return null; + const isSpeaking = + appRef.current?.server?.voiceChatSpeakers[pubkey]; + return (
- + {user?.displayName.slice(0, 1).toUpperCase() || diff --git a/src/components/view/StatusCard.tsx b/src/components/view/StatusCard.tsx index a9fa701..faee4fb 100644 --- a/src/components/view/StatusCard.tsx +++ b/src/components/view/StatusCard.tsx @@ -99,4 +99,4 @@ export default function StatusCard({
); -} \ No newline at end of file +}