diff --git a/web/src/components/Layout.tsx b/web/src/components/Layout.tsx index 9dda994..1569e54 100644 --- a/web/src/components/Layout.tsx +++ b/web/src/components/Layout.tsx @@ -1,5 +1,6 @@ import { useEffect, useState } from 'react'; import { Link, Outlet, useLocation, useNavigate } from 'react-router-dom'; +import { useVoiceStore } from '../stores/voice.ts'; import { useAuthStore, type UserStatus } from '../stores/auth.ts'; import { useWebSocketStore } from '../stores/ws.ts'; import { useServerStore } from '../stores/server.ts'; @@ -44,6 +45,17 @@ export function Layout() { const setMobileView = useLayoutStore((s) => s.setMobileView); const [showServerSettings, setShowServerSettings] = useState(false); const activeServerId = useServerStore((s) => s.activeServerId); + const currentVoiceRoom = useVoiceStore((s) => s.currentRoom); + const [activeTab, setActiveTab] = useState<'chat' | 'voice'>('chat'); + + useEffect(() => { + if (currentVoiceRoom) { + setActiveTab('voice'); + } else { + setActiveTab('chat'); + } + }, [currentVoiceRoom]); + useEffect(() => { wsConnect(); return () => { wsDisconnect(); }; @@ -187,10 +199,30 @@ export function Layout() { `} >
- -
+ {currentVoiceRoom && ( +
+ + +
+ )} +
+ {currentVoiceRoom && ( +
+ +
+ )}