Files
temetro/frontend/lib/meetings.ts
T
Khalid Abdi c88b674196 feat(meetings): Discord-style staff voice/video calls under Messages
Backend: meeting_rooms table + /api/meetings (list/create/delete, org-scoped),
and WebRTC mesh signaling over the existing authed Socket.io (call:join with a
≤4 cap and org authorization, call:signal relay, peer-joined/left, disconnect
cleanup). Migration 0024.

Frontend: Messages nav is now expandable (Inbox + Meetings); new
/messages/meetings page with a room list and a Discord-style call UI — a
useWebRtcMesh hook (camera/mic, screen share via replaceTrack, ≤4 mesh) and a
tile grid with a mic/camera/screen/leave control bar. New lib/meetings + i18n.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 20:48:26 +03:00

38 lines
1008 B
TypeScript

import { apiFetch } from "@/lib/api-client";
// A persistent staff meeting room (Discord-style voice/video channel). The live
// call (participants/media) is ephemeral and runs over the socket; this is just
// the room list.
export type MeetingRoom = {
id: string;
name: string;
createdAt: string;
};
export function listMeetingRooms(): Promise<MeetingRoom[]> {
return apiFetch<MeetingRoom[]>("/api/meetings");
}
export function createMeetingRoom(name: string): Promise<MeetingRoom> {
return apiFetch<MeetingRoom>("/api/meetings", {
method: "POST",
body: JSON.stringify({ name }),
});
}
export function deleteMeetingRoom(id: string): Promise<void> {
return apiFetch<void>(`/api/meetings/${encodeURIComponent(id)}`, {
method: "DELETE",
});
}
// Max peers in a mesh call — mirrors the backend cap (mesh degrades past ~4).
export const MAX_CALL_PEERS = 4;
// A remote peer in a live call.
export type CallPeer = {
socketId: string;
userId: string;
userName: string;
};