vojo/src/app/pages/IncomingCallStripRenderer.tsx

44 lines
1.5 KiB
TypeScript

// Top-level renderer for incoming DM call strips.
//
// Mounted in Router.tsx inside `CallEmbedProvider`, rendered right before
// `CallStatusRenderer` so the strip stacks above the in-call pill.
//
// Visual-only: if JS knows about an incoming ring we render the in-app strip.
// The alert *sound* is owned entirely by the system — on Android the native FCM
// service raises a CallStyle notification with the default system ringtone +
// vibration (see VojoFirebaseMessagingService / the `vojo_calls_v2` channel).
// Web / desktop have no system ring surface, so the strip is silent there by
// design — Vojo ships no bundled ringtone.
import React from 'react';
import { useAtomValue } from 'jotai';
import { incomingCallsAtom } from '../state/incomingCalls';
import { useMatrixClient } from '../hooks/useMatrixClient';
import { IncomingCallStrip } from '../features/call-status';
import { getIncomingCallKey } from '../utils/rtcNotification';
export function IncomingCallStripRenderer() {
const mx = useMatrixClient();
const incoming = useAtomValue(incomingCallsAtom);
const hasIncoming = incoming.size > 0;
if (!hasIncoming) return null;
const entries = Array.from(incoming.values());
return (
<>
{entries.map((call) => {
const room = mx.getRoom(call.roomId);
if (!room) return null;
return (
<IncomingCallStrip
key={getIncomingCallKey(call.callId, call.roomId)}
call={call}
room={room}
/>
);
})}
</>
);
}