Connect and disconnect to vc

This commit is contained in:
2026-08-26 12:21:12 +02:00
parent 0c6f812143
commit d95ed3215e
3 changed files with 185 additions and 1 deletions
@@ -1,5 +1,7 @@
import Enclave from "@/app/app";
import { ChannelPageProps } from "../PageView";
import { useEffect, useRef } from "react";
import { invoke } from "@tauri-apps/api/core";
export default function VoiceChannel({
appRef,
@@ -9,6 +11,18 @@ export default function VoiceChannel({
const channel = appRef.current?.page?.channel;
if (!channel) return null;
const lastChannelId = useRef<string | null>(null);
useEffect(() => {
const hostname = appRef.current?.server?.hostname;
if (!hostname) return;
if (lastChannelId.current === channel.id) return;
lastChannelId.current = channel.id;
invoke("disconnect_from_vc");
invoke("connect_to_vc", { hostname });
}, [channel.id]);
return (
<div className="flex flex-col h-screen gap-2">
<header className="px-3 pt-3 pb-3 text-sm text-muted-foreground border-b border-b-border">