diff --git a/.gitignore b/.gitignore index aaac669..5a1ad64 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ node_modules/ *.log .DS_Store music/ +music/* data/ dist/ build/ @@ -11,6 +12,8 @@ build/ *.swp *.swo *~ +*.mp3 +*.mp4 coverage/ .nyc_output/ tmp/ diff --git a/web/src/components/ConnectionStatus.jsx b/web/src/components/ConnectionStatus.jsx index 2a36ea8..54d7def 100644 --- a/web/src/components/ConnectionStatus.jsx +++ b/web/src/components/ConnectionStatus.jsx @@ -6,6 +6,8 @@ export default function ConnectionStatus() { const [channels, setChannels] = useState([]); const [loading, setLoading] = useState(false); const [disconnecting, setDisconnecting] = useState(false); + const [joining, setJoining] = useState(false); + const [showChannels, setShowChannels] = useState(false); useEffect(() => { loadChannels(); @@ -43,9 +45,29 @@ export default function ConnectionStatus() { } }; + const handleJoin = async (channelId) => { + try { + setJoining(true); + const response = await fetch(`${API_URL}/channels/join`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ channelId }) + }); + + if (response.ok) { + loadChannels(); + setShowChannels(false); + } + } catch (error) { + console.error('Failed to join channel:', error); + } finally { + setJoining(false); + } + }; + const currentChannel = channels.find(c => c.current); - if (loading && !currentChannel) { + if (loading && channels.length === 0) { return (