mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage
synced 2026-04-11 18:28:15 +00:00
feat: add floating call widget with SIP controls, click-to-call, and SIP provider
Introduce a shared SipProvider context so all components use the same SIP connection. Add a floating CallWidget (idle pill, ringing, active with disposition, ended states) visible for CC agents on every page. Add a ClickToCallButton for the worklist. Wire SIP status badge and worklist into the call-desk page. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
26
src/providers/sip-provider.tsx
Normal file
26
src/providers/sip-provider.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import { createContext, useContext, useEffect, type PropsWithChildren } from 'react';
|
||||
import { useSipPhone } from '@/hooks/use-sip-phone';
|
||||
|
||||
type SipContextType = ReturnType<typeof useSipPhone>;
|
||||
|
||||
const SipContext = createContext<SipContextType | null>(null);
|
||||
|
||||
export const SipProvider = ({ children }: PropsWithChildren) => {
|
||||
const sipPhone = useSipPhone();
|
||||
|
||||
// Auto-connect on mount
|
||||
useEffect(() => {
|
||||
sipPhone.connect();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
return <SipContext.Provider value={sipPhone}>{children}</SipContext.Provider>;
|
||||
};
|
||||
|
||||
export const useSip = (): SipContextType => {
|
||||
const ctx = useContext(SipContext);
|
||||
if (ctx === null) {
|
||||
throw new Error('useSip must be used within a SipProvider');
|
||||
}
|
||||
return ctx;
|
||||
};
|
||||
Reference in New Issue
Block a user