From 66d390b03dbc60d8e4992ebfda76022057b15585 Mon Sep 17 00:00:00 2001 From: Leo dev Date: Wed, 7 Jan 2026 19:36:05 +0100 Subject: [PATCH] Improved vc ui and possibly fixed #41 --- src/components/app/AppLayout.tsx | 2 ++ src/components/channel/MessageBox.tsx | 4 ++-- src/components/channel/voice/VoiceBox.tsx | 6 +++--- src/components/channel/voice/VoiceGrid.tsx | 14 +++++++------- src/components/channel/voice/VoiceTile.tsx | 11 ++--------- src/lib/audio.ts | 2 +- 6 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/components/app/AppLayout.tsx b/src/components/app/AppLayout.tsx index 164250e..b3a696c 100644 --- a/src/components/app/AppLayout.tsx +++ b/src/components/app/AppLayout.tsx @@ -66,6 +66,8 @@ export default function AppLayout({ [undefined, undefined] ); + useEffect(() => app.setSidebarOpen(!isMobile), [isMobile]); + return (
- {messages.toReversed().map((msg) => ( + {messages.toReversed().map((msg, i) => ( { - if (rms(data) > 0.02) { + if (rms(data) > 0.005) { sendVoice(data); if (!app.profile) return; @@ -54,14 +54,14 @@ export default function VoiceBox({ useEffect(() => { const inv = setInterval(() => { const now = Date.now(); - const TIMEOUT = 500; + const TIMEOUT = 800; app.setSpeaking((prev) => Object.fromEntries( Object.entries(prev).filter(([_, ts]) => now - ts < TIMEOUT) ) ); - }, 250); + }, 200); return () => clearInterval(inv); }, []); diff --git a/src/components/channel/voice/VoiceGrid.tsx b/src/components/channel/voice/VoiceGrid.tsx index 340e1ff..904b5b9 100644 --- a/src/components/channel/voice/VoiceGrid.tsx +++ b/src/components/channel/voice/VoiceGrid.tsx @@ -1,5 +1,6 @@ import App from "@/types/app"; import { VoiceTile, VoiceUser } from "./VoiceTile"; +import { cn } from "@/lib/utils"; export default function VoiceGrid({ app, @@ -11,13 +12,12 @@ export default function VoiceGrid({ return (
{users.map((user) => ( diff --git a/src/components/channel/voice/VoiceTile.tsx b/src/components/channel/voice/VoiceTile.tsx index a914859..f1e4246 100644 --- a/src/components/channel/voice/VoiceTile.tsx +++ b/src/components/channel/voice/VoiceTile.tsx @@ -12,13 +12,11 @@ export function VoiceTile({ user, app }: { app: App; user: VoiceUser }) {
)} /> - - {/* Speaking indicator */} - {user.speaking && ( -
Speaking
- )}
); } diff --git a/src/lib/audio.ts b/src/lib/audio.ts index 8c1e620..4f96665 100644 --- a/src/lib/audio.ts +++ b/src/lib/audio.ts @@ -42,7 +42,7 @@ export async function startMic(onAudio: (data: Int16Array) => void) { chunk.set(buffer.splice(0, buffer.length)); } onAudio(chunk); - }, 500); + }, 800); // Return cleanup function return () => {