diff --git a/services/frontend/src/app/(dashboard)/dashboard/view.tsx b/services/frontend/src/app/(dashboard)/dashboard/view.tsx index 4a420de4..38beb008 100644 --- a/services/frontend/src/app/(dashboard)/dashboard/view.tsx +++ b/services/frontend/src/app/(dashboard)/dashboard/view.tsx @@ -6,7 +6,6 @@ import { ChevronRight, Hash, MessageSquare, - Mic, Shield, ShieldAlert, ShieldCheck, @@ -160,12 +159,6 @@ export function DashboardView({ hint={`${formatNumber(s.total_users)} total profiles`} icon={} /> - } - /> - {bars.length === 0 ? ( -
- {Array.from({ length: 28 }).map((_, i) => ( - - ))} -
- ) : ( - bars.map((b, i) => ( - 0.05 ? `0 0 8px ${color}` : "none", - transition: "height 90ms linear", - }} - /> - )) - )} - - ); -} diff --git a/services/frontend/src/lib/navigation.ts b/services/frontend/src/lib/navigation.ts index 14b34544..d9fe045f 100644 --- a/services/frontend/src/lib/navigation.ts +++ b/services/frontend/src/lib/navigation.ts @@ -1,10 +1,7 @@ import { - Headphones, LayoutDashboard, type LucideIcon, MessageSquare, - Mic, - Music, Search, Shield, Users, @@ -40,24 +37,6 @@ export const navItems: NavItem[] = [ icon: Users, matchPrefix: "/users", }, - { - href: "/voice", - label: "Voice", - icon: Mic, - matchPrefix: "/voice", - }, - { - href: "/media", - label: "Media", - icon: Music, - matchPrefix: "/media", - }, - { - href: "/recordings", - label: "Recordings", - icon: Headphones, - matchPrefix: "/recordings", - }, { href: "/moderation", label: "Moderation", diff --git a/services/frontend/src/lib/types/dashboard.ts b/services/frontend/src/lib/types/dashboard.ts index f52e523c..a4b9d24f 100644 --- a/services/frontend/src/lib/types/dashboard.ts +++ b/services/frontend/src/lib/types/dashboard.ts @@ -7,7 +7,6 @@ export interface DashboardStats { total_clean: number; total_warned: number; total_error: number; - total_voice_recordings: number; total_profiles: number; today_messages: number; today_flagged: number; diff --git a/services/frontend/src/lib/types/ui.ts b/services/frontend/src/lib/types/ui.ts index 0bbd8add..49fba958 100644 --- a/services/frontend/src/lib/types/ui.ts +++ b/services/frontend/src/lib/types/ui.ts @@ -2,13 +2,9 @@ export type DashboardTab = "messages" | "live" | "dashboard"; export interface UiState { selected_guild?: string | null; - selected_voice_guild?: string | null; - selected_voice_channel?: string | null; selected_text_guild?: string | null; selected_text_channel?: string | null; active_tab?: DashboardTab | null; - is_listening?: boolean | null; - is_streaming?: boolean | null; } export interface ChatbotResponse { diff --git a/services/frontend/src/lib/ws/context.tsx b/services/frontend/src/lib/ws/context.tsx index 58fa62c9..faecbd33 100644 --- a/services/frontend/src/lib/ws/context.tsx +++ b/services/frontend/src/lib/ws/context.tsx @@ -9,24 +9,20 @@ import { useRef, useState, } from "react"; -import { useSWRConfig } from "swr"; import { toast } from "@/components/primitives"; import { WsConnection } from "./connection"; -import type { PcmChunk, WsEventHandler, WsEventType, WsStatus } from "./types"; +import type { WsEventHandler, WsEventType, WsStatus } from "./types"; interface WsContextValue { status: WsStatus; connect: () => void; disconnect: () => void; sendText: (text: string) => void; - sendBinary: (data: ArrayBufferLike) => void; /** Subscribe to a typed WS event. Returns unsubscribe function. */ on: ( eventType: E, handler: WsEventHandler, ) => () => void; - /** Subscribe to binary PCM events. Returns unsubscribe function. */ - onPcm: (handler: (chunk: PcmChunk) => void) => () => void; } const WsContext = createContext(null); @@ -40,7 +36,6 @@ export function WsProvider({ }) { const connRef = useRef(null); const [status, setStatus] = useState("disconnected"); - const { mutate } = useSWRConfig(); // Tracks whether we've ever been connected — used to suppress the // "reconnecting" toast on initial page load. const wasConnected = useRef(false); @@ -48,7 +43,6 @@ export function WsProvider({ // Event handler registry — Ref so listeners survive re-renders without reconnect // Using unknown as internal store; typed at the subscribe interface const handlersRef = useRef void>>>({}); - const pcmHandlersRef = useRef void>>(new Set()); const handleJsonEvent = useCallback((json: string) => { try { @@ -66,17 +60,6 @@ export function WsProvider({ } }, []); - const handleBinaryEvent = useCallback((buffer: ArrayBuffer) => { - if (buffer.byteLength < 4 || pcmHandlersRef.current.size === 0) return; - - const view = new DataView(buffer); - const userIdHash = view.getUint32(0, true); - const samples = new Int16Array(buffer, 4); - - const chunk: PcmChunk = { userIdHash, samples }; - pcmHandlersRef.current.forEach((h) => h(chunk)); - }, []); - useEffect(() => { const conn = new WsConnection(url); connRef.current = conn; @@ -97,9 +80,6 @@ export function WsProvider({ wasConnected.current = false; } else if (s === "connected") { wasConnected.current = true; - // After reconnect, force-refetch voice status immediately so - // the UI converges faster instead of waiting up to 4s for SWR poll. - void mutate(["voice-status"]); } else if (s === "error" && !wasConnected.current) { toast({ title: "Connection error", @@ -112,8 +92,6 @@ export function WsProvider({ const unsubEvent = conn.onEvent((event) => { if (event.type === "text") { handleJsonEvent(event.data); - } else { - handleBinaryEvent(event.data); } }); @@ -126,7 +104,7 @@ export function WsProvider({ unsubEvent(); }; // eslint-disable-next-line react-hooks/exhaustive-deps - }, [url, handleBinaryEvent, handleJsonEvent, mutate]); + }, [url, handleJsonEvent]); const subscribe = useCallback( (_eventType: E, handler: WsEventHandler) => { @@ -144,23 +122,12 @@ export function WsProvider({ [], ); - const subscribePcm = useCallback((handler: (chunk: PcmChunk) => void) => { - pcmHandlersRef.current.add(handler); - return () => { - pcmHandlersRef.current.delete(handler); - }; - }, []); - const connect = useCallback(() => connRef.current?.connect(), []); const disconnect = useCallback(() => connRef.current?.disconnect(), []); const sendText = useCallback( (text: string) => connRef.current?.sendText(text), [], ); - const sendBinary = useCallback( - (data: ArrayBufferLike) => connRef.current?.sendBinary(data), - [], - ); return ( {children} diff --git a/services/frontend/src/lib/ws/types.ts b/services/frontend/src/lib/ws/types.ts index 6473b51f..11df62de 100644 --- a/services/frontend/src/lib/ws/types.ts +++ b/services/frontend/src/lib/ws/types.ts @@ -62,10 +62,3 @@ export type WsEventType = keyof WsEventMap; export type WsEventHandler = ( data: WsEventMap[E], ) => void; - -// ── Binary PCM ───────────────────────────────────────────── - -export interface PcmChunk { - userIdHash: number; - samples: Int16Array; -}