mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage
synced 2026-05-18 20:08:19 +00:00
merge: hardening/apr-week3 → master (v0.12-supervisor-ui)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Supervisor UI pass: - PageHeader on all supervisor pages (Team Dashboard, Live Monitor, Call Recordings, Missed Calls, Settings) - Notification bell moved from wasted app-shell top bar into PageHeader (admin-only), top bar only renders for agents now - Settings cards disabled (Clinics, Doctors, Team, Telephony, AI, Widget) - Campaign edit button disabled - Column toggle blank page fixed (key-based Table remount) - Live monitor: SSE replaces 5s polling for real-time call state - Hold/unhold status reflected in supervisor live monitor via SSE - Call Recordings: enriched agent names (agent relation in query) - Missed Calls: underline tabs → custom pills - Call Recordings: TopBar → PageHeader Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,6 @@ import { useSip } from '@/providers/sip-provider';
|
|||||||
import { CallWidget } from '@/components/call-desk/call-widget';
|
import { CallWidget } from '@/components/call-desk/call-widget';
|
||||||
import { MaintOtpModal } from '@/components/modals/maint-otp-modal';
|
import { MaintOtpModal } from '@/components/modals/maint-otp-modal';
|
||||||
import { AgentStatusToggle } from '@/components/call-desk/agent-status-toggle';
|
import { AgentStatusToggle } from '@/components/call-desk/agent-status-toggle';
|
||||||
import { NotificationBell } from './notification-bell';
|
|
||||||
import { ResumeSetupBanner } from '@/components/setup/resume-setup-banner';
|
import { ResumeSetupBanner } from '@/components/setup/resume-setup-banner';
|
||||||
import { Badge } from '@/components/base/badges/badges';
|
import { Badge } from '@/components/base/badges/badges';
|
||||||
import { useAuth } from '@/providers/auth-provider';
|
import { useAuth } from '@/providers/auth-provider';
|
||||||
@@ -25,7 +24,7 @@ interface AppShellProps {
|
|||||||
|
|
||||||
export const AppShell = ({ children }: AppShellProps) => {
|
export const AppShell = ({ children }: AppShellProps) => {
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
const { isCCAgent, isAdmin } = useAuth();
|
const { isCCAgent } = useAuth();
|
||||||
const { isOpen, activeAction, close } = useMaintShortcuts();
|
const { isOpen, activeAction, close } = useMaintShortcuts();
|
||||||
const { connectionStatus, isRegistered } = useSip();
|
const { connectionStatus, isRegistered } = useSip();
|
||||||
const networkQuality = useNetworkStatus();
|
const networkQuality = useNetworkStatus();
|
||||||
@@ -118,18 +117,10 @@ export const AppShell = ({ children }: AppShellProps) => {
|
|||||||
<div className="flex h-screen bg-primary">
|
<div className="flex h-screen bg-primary">
|
||||||
<Sidebar activeUrl={pathname} />
|
<Sidebar activeUrl={pathname} />
|
||||||
<div className="flex flex-1 flex-col overflow-hidden">
|
<div className="flex flex-1 flex-col overflow-hidden">
|
||||||
{/* Persistent top bar — visible on all pages */}
|
{/* Agent top bar — network indicator + status toggle (agents only) */}
|
||||||
{(hasAgentConfig || isAdmin) && (
|
|
||||||
<div className="flex shrink-0 items-center gap-2 border-b border-secondary px-4 py-2">
|
|
||||||
{/* GlobalSearch hidden — navigation on result click
|
|
||||||
routes to Patient 360 with stale appointment state
|
|
||||||
from the call desk. Revisit when the Patient 360
|
|
||||||
route properly resets context on mount. (#4) */}
|
|
||||||
{/* <GlobalSearch /> */}
|
|
||||||
<div className="ml-auto flex items-center gap-2">
|
|
||||||
{isAdmin && <NotificationBell />}
|
|
||||||
{hasAgentConfig && (
|
{hasAgentConfig && (
|
||||||
<>
|
<div className="flex shrink-0 items-center gap-2 border-b border-secondary px-4 py-2">
|
||||||
|
<div className="ml-auto flex items-center gap-2">
|
||||||
<div className={cx(
|
<div className={cx(
|
||||||
'flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium',
|
'flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium',
|
||||||
networkQuality === 'good'
|
networkQuality === 'good'
|
||||||
@@ -145,8 +136,6 @@ export const AppShell = ({ children }: AppShellProps) => {
|
|||||||
{networkQuality === 'good' ? 'Connected' : networkQuality === 'offline' ? 'No connection' : 'Unstable'}
|
{networkQuality === 'good' ? 'Connected' : networkQuality === 'offline' ? 'No connection' : 'Unstable'}
|
||||||
</div>
|
</div>
|
||||||
<AgentStatusToggle isRegistered={isRegistered} connectionStatus={connectionStatus} />
|
<AgentStatusToggle isRegistered={isRegistered} connectionStatus={connectionStatus} />
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
import { useState, useRef, useEffect, type ReactNode } from 'react';
|
import { useState, useRef, useEffect, type ReactNode } from 'react';
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
import { faCircleInfo } from '@fortawesome/pro-duotone-svg-icons';
|
import { faCircleInfo } from '@fortawesome/pro-duotone-svg-icons';
|
||||||
|
import { NotificationBell } from './notification-bell';
|
||||||
|
import { useAuth } from '@/providers/auth-provider';
|
||||||
|
|
||||||
interface PageHeaderProps {
|
interface PageHeaderProps {
|
||||||
title: string;
|
title: string;
|
||||||
@@ -65,7 +67,9 @@ const InfoTooltip = ({ text }: { text: string }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const PageHeader = ({ title, badge, subtitle, infoText, controls, tabs }: PageHeaderProps) => (
|
export const PageHeader = ({ title, badge, subtitle, infoText, controls, tabs }: PageHeaderProps) => {
|
||||||
|
const { isAdmin } = useAuth();
|
||||||
|
return (
|
||||||
<div className="shrink-0">
|
<div className="shrink-0">
|
||||||
{/* Row 1: title + controls */}
|
{/* Row 1: title + controls */}
|
||||||
<div className="flex items-center justify-between px-6 py-3">
|
<div className="flex items-center justify-between px-6 py-3">
|
||||||
@@ -81,11 +85,10 @@ export const PageHeader = ({ title, badge, subtitle, infoText, controls, tabs }:
|
|||||||
)}
|
)}
|
||||||
{infoText && <InfoTooltip text={infoText} />}
|
{infoText && <InfoTooltip text={infoText} />}
|
||||||
</div>
|
</div>
|
||||||
{controls && (
|
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{controls}
|
{controls}
|
||||||
|
{isAdmin && <NotificationBell />}
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Row 2: optional tabs — no container border, tab underline is the separator */}
|
{/* Row 2: optional tabs — no container border, tab underline is the separator */}
|
||||||
@@ -96,3 +99,4 @@ export const PageHeader = ({ title, badge, subtitle, infoText, controls, tabs }:
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ type SectionCardProps = {
|
|||||||
href?: string;
|
href?: string;
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
status?: SectionStatus;
|
status?: SectionStatus;
|
||||||
|
disabled?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Settings hub card. Each card represents one setup-able section (Branding,
|
// Settings hub card. Each card represents one setup-able section (Branding,
|
||||||
@@ -30,26 +31,32 @@ export const SectionCard = ({
|
|||||||
href,
|
href,
|
||||||
onClick,
|
onClick,
|
||||||
status = 'unknown',
|
status = 'unknown',
|
||||||
|
disabled = false,
|
||||||
}: SectionCardProps) => {
|
}: SectionCardProps) => {
|
||||||
const className = cx(
|
const className = cx(
|
||||||
'group block w-full text-left rounded-xl border border-secondary bg-primary p-5 shadow-xs transition hover:border-brand hover:shadow-md',
|
'group block w-full text-left rounded-xl border border-secondary p-5 shadow-xs transition',
|
||||||
|
disabled
|
||||||
|
? 'cursor-not-allowed opacity-50 bg-disabled_subtle'
|
||||||
|
: 'bg-primary hover:border-brand hover:shadow-md',
|
||||||
);
|
);
|
||||||
const body = (
|
const body = (
|
||||||
<>
|
<>
|
||||||
<div className="flex items-start justify-between gap-4">
|
<div className="flex items-start justify-between gap-4">
|
||||||
<div className="flex items-start gap-4">
|
<div className="flex items-start gap-4">
|
||||||
<div className="flex size-11 shrink-0 items-center justify-center rounded-lg bg-secondary">
|
<div className="flex size-11 shrink-0 items-center justify-center rounded-lg bg-secondary">
|
||||||
<FontAwesomeIcon icon={icon} className={cx('size-5', iconColor)} />
|
<FontAwesomeIcon icon={icon} className={cx('size-5', disabled ? 'text-fg-disabled' : iconColor)} />
|
||||||
</div>
|
</div>
|
||||||
<div className="min-w-0">
|
<div className="min-w-0">
|
||||||
<h3 className="text-sm font-semibold text-primary">{title}</h3>
|
<h3 className={cx('text-sm font-semibold', disabled ? 'text-disabled' : 'text-primary')}>{title}</h3>
|
||||||
<p className="mt-1 text-xs text-tertiary">{description}</p>
|
<p className="mt-1 text-xs text-tertiary">{description}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{!disabled && (
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faArrowRight}
|
icon={faArrowRight}
|
||||||
className="size-4 shrink-0 text-quaternary transition group-hover:translate-x-0.5 group-hover:text-brand-primary"
|
className="size-4 shrink-0 text-quaternary transition group-hover:translate-x-0.5 group-hover:text-brand-primary"
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{status !== 'unknown' && (
|
{status !== 'unknown' && (
|
||||||
@@ -70,6 +77,13 @@ export const SectionCard = ({
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (disabled) {
|
||||||
|
return (
|
||||||
|
<div className={className}>
|
||||||
|
{body}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
if (onClick) {
|
if (onClick) {
|
||||||
return (
|
return (
|
||||||
<button type="button" onClick={onClick} className={className}>
|
<button type="button" onClick={onClick} className={className}>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { Badge } from '@/components/base/badges/badges';
|
|||||||
import { Input } from '@/components/base/input/input';
|
import { Input } from '@/components/base/input/input';
|
||||||
import { Table } from '@/components/application/table/table';
|
import { Table } from '@/components/application/table/table';
|
||||||
import { PaginationPageDefault } from '@/components/application/pagination/pagination';
|
import { PaginationPageDefault } from '@/components/application/pagination/pagination';
|
||||||
import { TopBar } from '@/components/layout/top-bar';
|
import { PageHeader } from '@/components/layout/page-header';
|
||||||
import { ColumnToggle, useColumnVisibility } from '@/components/application/table/column-toggle';
|
import { ColumnToggle, useColumnVisibility } from '@/components/application/table/column-toggle';
|
||||||
import { PhoneActionCell } from '@/components/call-desk/phone-action-cell';
|
import { PhoneActionCell } from '@/components/call-desk/phone-action-cell';
|
||||||
import { RecordingAnalysisSlideout } from '@/components/call-desk/recording-analysis';
|
import { RecordingAnalysisSlideout } from '@/components/call-desk/recording-analysis';
|
||||||
@@ -26,6 +26,7 @@ type RecordingRecord = {
|
|||||||
callStatus: string | null;
|
callStatus: string | null;
|
||||||
callerNumber: { primaryPhoneNumber: string } | null;
|
callerNumber: { primaryPhoneNumber: string } | null;
|
||||||
agentName: string | null;
|
agentName: string | null;
|
||||||
|
agent: { id: string; name: string; ozonetelAgentId: string } | null;
|
||||||
startedAt: string | null;
|
startedAt: string | null;
|
||||||
durationSec: number | null;
|
durationSec: number | null;
|
||||||
disposition: string | null;
|
disposition: string | null;
|
||||||
@@ -35,7 +36,8 @@ type RecordingRecord = {
|
|||||||
|
|
||||||
const QUERY = `{ calls(first: 200, orderBy: [{ startedAt: DescNullsLast }]) { edges { node {
|
const QUERY = `{ calls(first: 200, orderBy: [{ startedAt: DescNullsLast }]) { edges { node {
|
||||||
id createdAt direction callStatus callerNumber { primaryPhoneNumber }
|
id createdAt direction callStatus callerNumber { primaryPhoneNumber }
|
||||||
agentName startedAt durationSec disposition sla
|
agentName agent { id name ozonetelAgentId }
|
||||||
|
startedAt durationSec disposition sla
|
||||||
recording { primaryLinkUrl primaryLinkLabel }
|
recording { primaryLinkUrl primaryLinkLabel }
|
||||||
} } } }`;
|
} } } }`;
|
||||||
|
|
||||||
@@ -109,7 +111,7 @@ export const CallRecordingsPage = () => {
|
|||||||
const dirColor: 'blue' | 'brand' = call.direction === 'INBOUND' ? 'blue' : 'brand';
|
const dirColor: 'blue' | 'brand' = call.direction === 'INBOUND' ? 'blue' : 'brand';
|
||||||
switch (colId) {
|
switch (colId) {
|
||||||
case 'agent':
|
case 'agent':
|
||||||
return <span className="text-sm text-primary">{call.agentName || '—'}</span>;
|
return <span className="text-sm text-primary">{call.agent?.name ?? call.agentName ?? '—'}</span>;
|
||||||
case 'caller':
|
case 'caller':
|
||||||
return phone
|
return phone
|
||||||
? <PhoneActionCell phoneNumber={phone} displayNumber={formatPhone({ number: phone, callingCode: '+91' })} />
|
? <PhoneActionCell phoneNumber={phone} displayNumber={formatPhone({ number: phone, callingCode: '+91' })} />
|
||||||
@@ -207,7 +209,7 @@ export const CallRecordingsPage = () => {
|
|||||||
if (search.trim()) {
|
if (search.trim()) {
|
||||||
const q = search.toLowerCase();
|
const q = search.toLowerCase();
|
||||||
result = result.filter(c =>
|
result = result.filter(c =>
|
||||||
(c.agentName ?? '').toLowerCase().includes(q) ||
|
(c.agent?.name ?? c.agentName ?? '').toLowerCase().includes(q) ||
|
||||||
(c.callerNumber?.primaryPhoneNumber ?? '').includes(q) ||
|
(c.callerNumber?.primaryPhoneNumber ?? '').includes(q) ||
|
||||||
(c.disposition ?? '').toLowerCase().includes(q),
|
(c.disposition ?? '').toLowerCase().includes(q),
|
||||||
);
|
);
|
||||||
@@ -217,7 +219,7 @@ export const CallRecordingsPage = () => {
|
|||||||
const dir = sortDescriptor.direction === 'ascending' ? 1 : -1;
|
const dir = sortDescriptor.direction === 'ascending' ? 1 : -1;
|
||||||
result = [...result].sort((a, b) => {
|
result = [...result].sort((a, b) => {
|
||||||
switch (sortDescriptor.column) {
|
switch (sortDescriptor.column) {
|
||||||
case 'agent': return (a.agentName ?? '').localeCompare(b.agentName ?? '') * dir;
|
case 'agent': return (a.agent?.name ?? a.agentName ?? '').localeCompare(b.agent?.name ?? b.agentName ?? '') * dir;
|
||||||
case 'dateTime': {
|
case 'dateTime': {
|
||||||
const ta = a.startedAt ? new Date(a.startedAt).getTime() : 0;
|
const ta = a.startedAt ? new Date(a.startedAt).getTime() : 0;
|
||||||
const tb = b.startedAt ? new Date(b.startedAt).getTime() : 0;
|
const tb = b.startedAt ? new Date(b.startedAt).getTime() : 0;
|
||||||
@@ -238,19 +240,20 @@ export const CallRecordingsPage = () => {
|
|||||||
const handleSearch = (val: string) => { setSearch(val); setCurrentPage(1); };
|
const handleSearch = (val: string) => { setSearch(val); setCurrentPage(1); };
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
|
||||||
<TopBar title="Call Recordings" />
|
|
||||||
<div className="flex flex-1 flex-col overflow-hidden">
|
<div className="flex flex-1 flex-col overflow-hidden">
|
||||||
{/* Toolbar */}
|
<PageHeader
|
||||||
<div className="flex shrink-0 items-center justify-between border-b border-secondary px-6 py-3">
|
title="Call Recordings"
|
||||||
<span className="text-sm text-tertiary">{filtered.length} recordings</span>
|
badge={filtered.length}
|
||||||
<div className="flex items-center gap-3">
|
infoText="All call recordings with AI analysis, dispositions, and playback."
|
||||||
|
controls={
|
||||||
|
<>
|
||||||
<ColumnToggle columns={columnDefs} visibleColumns={visibleColumns} onToggle={toggleColumn} />
|
<ColumnToggle columns={columnDefs} visibleColumns={visibleColumns} onToggle={toggleColumn} />
|
||||||
<div className="w-56">
|
<div className="w-56">
|
||||||
<Input placeholder="Search agent, phone, disposition..." icon={SearchLg} size="sm" value={search} onChange={handleSearch} />
|
<Input placeholder="Search agent, phone, disposition..." icon={SearchLg} size="sm" value={search} onChange={handleSearch} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</>
|
||||||
</div>
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
{/* Table */}
|
{/* Table */}
|
||||||
<div className="flex flex-1 flex-col min-h-0 overflow-hidden px-4 pt-3">
|
<div className="flex flex-1 flex-col min-h-0 overflow-hidden px-4 pt-3">
|
||||||
@@ -264,7 +267,7 @@ export const CallRecordingsPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex flex-1 flex-col min-h-0 overflow-auto">
|
<div className="flex flex-1 flex-col min-h-0 overflow-auto">
|
||||||
<Table size="sm" sortDescriptor={sortDescriptor} onSortChange={setSortDescriptor}>
|
<Table key={Array.from(visibleColumns).sort().join(',')} size="sm" sortDescriptor={sortDescriptor} onSortChange={setSortDescriptor}>
|
||||||
<Table.Header columns={activeColumns}>
|
<Table.Header columns={activeColumns}>
|
||||||
{(col) => (
|
{(col) => (
|
||||||
<Table.Head
|
<Table.Head
|
||||||
@@ -278,7 +281,7 @@ export const CallRecordingsPage = () => {
|
|||||||
</Table.Header>
|
</Table.Header>
|
||||||
<Table.Body items={pagedRows}>
|
<Table.Body items={pagedRows}>
|
||||||
{(call) => (
|
{(call) => (
|
||||||
<Table.Row id={call.id} columns={activeColumns}>
|
<Table.Row id={call.id} columns={activeColumns} className="group/row">
|
||||||
{(col) => (
|
{(col) => (
|
||||||
<Table.Cell key={col.id}>
|
<Table.Cell key={col.id}>
|
||||||
{renderRecordingCell(call, col.id)}
|
{renderRecordingCell(call, col.id)}
|
||||||
@@ -323,6 +326,5 @@ export const CallRecordingsPage = () => {
|
|||||||
);
|
);
|
||||||
})()}
|
})()}
|
||||||
</div>
|
</div>
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ export const CampaignsPage = () => {
|
|||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
|
isDisabled
|
||||||
iconLeading={({ className }: { className?: string }) => (
|
iconLeading={({ className }: { className?: string }) => (
|
||||||
<FontAwesomeIcon icon={faPenToSquare} className={className} />
|
<FontAwesomeIcon icon={faPenToSquare} className={className} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useEffect, useMemo, useState } from 'react';
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
import { faHeadset, faPhoneVolume, faPause, faClock, faSparkles, faCalendarCheck, faClockRotateLeft } from '@fortawesome/pro-duotone-svg-icons';
|
import { faHeadset, faPhoneVolume, faPause, faClock, faSparkles, faCalendarCheck, faClockRotateLeft } from '@fortawesome/pro-duotone-svg-icons';
|
||||||
import { TopBar } from '@/components/layout/top-bar';
|
import { PageHeader } from '@/components/layout/page-header';
|
||||||
import { Badge } from '@/components/base/badges/badges';
|
import { Badge } from '@/components/base/badges/badges';
|
||||||
import { Table } from '@/components/application/table/table';
|
import { Table } from '@/components/application/table/table';
|
||||||
import { BargeControls } from '@/components/call-desk/barge-controls';
|
import { BargeControls } from '@/components/call-desk/barge-controls';
|
||||||
@@ -55,26 +55,48 @@ export const LiveMonitorPage = () => {
|
|||||||
const [contextLoading, setContextLoading] = useState(false);
|
const [contextLoading, setContextLoading] = useState(false);
|
||||||
const { leads } = useData();
|
const { leads } = useData();
|
||||||
|
|
||||||
// Poll active calls every 5 seconds
|
// Initial load + SSE stream for real-time active call updates
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchCalls = () => {
|
// Initial snapshot
|
||||||
apiClient.get<ActiveCall[]>('/api/supervisor/active-calls', { silent: true })
|
apiClient.get<ActiveCall[]>('/api/supervisor/active-calls', { silent: true })
|
||||||
.then(calls => {
|
.then(setActiveCalls)
|
||||||
setActiveCalls(calls);
|
.catch(() => {})
|
||||||
// If selected call ended, clear selection
|
.finally(() => setLoading(false));
|
||||||
if (selectedCall && !calls.find(c => c.ucid === selectedCall.ucid)) {
|
|
||||||
|
// SSE stream — receives update/remove events in real-time
|
||||||
|
const apiUrl = import.meta.env.VITE_API_URL ?? '';
|
||||||
|
const es = new EventSource(`${apiUrl}/api/supervisor/active-calls/stream`);
|
||||||
|
es.onmessage = (msg) => {
|
||||||
|
try {
|
||||||
|
const event = JSON.parse(msg.data) as { type: 'update' | 'remove'; call?: ActiveCall; ucid: string };
|
||||||
|
setActiveCalls(prev => {
|
||||||
|
if (event.type === 'remove') {
|
||||||
|
return prev.filter(c => c.ucid !== event.ucid);
|
||||||
|
}
|
||||||
|
if (event.type === 'update' && event.call) {
|
||||||
|
const exists = prev.find(c => c.ucid === event.ucid);
|
||||||
|
if (exists) {
|
||||||
|
return prev.map(c => c.ucid === event.ucid ? event.call! : c);
|
||||||
|
}
|
||||||
|
return [...prev, event.call];
|
||||||
|
}
|
||||||
|
return prev;
|
||||||
|
});
|
||||||
|
} catch {}
|
||||||
|
};
|
||||||
|
es.onerror = () => {
|
||||||
|
// SSE reconnects automatically; no-op
|
||||||
|
};
|
||||||
|
return () => es.close();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Clear selection if the selected call ended
|
||||||
|
useEffect(() => {
|
||||||
|
if (selectedCall && !activeCalls.find(c => c.ucid === selectedCall.ucid)) {
|
||||||
setSelectedCall(null);
|
setSelectedCall(null);
|
||||||
setCallerContext(null);
|
setCallerContext(null);
|
||||||
}
|
}
|
||||||
})
|
}, [activeCalls, selectedCall]);
|
||||||
.catch(() => {})
|
|
||||||
.finally(() => setLoading(false));
|
|
||||||
};
|
|
||||||
|
|
||||||
fetchCalls();
|
|
||||||
const interval = setInterval(fetchCalls, 5000);
|
|
||||||
return () => clearInterval(interval);
|
|
||||||
}, [selectedCall?.ucid]);
|
|
||||||
|
|
||||||
// Tick every second for duration display
|
// Tick every second for duration display
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -160,7 +182,11 @@ export const LiveMonitorPage = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<TopBar title="Live Call Monitor" subtitle="Monitor, whisper, or barge into active calls" />
|
<PageHeader
|
||||||
|
title="Live Call Monitor"
|
||||||
|
badge={activeCalls.length}
|
||||||
|
infoText="Monitor, whisper, or barge into active calls in real-time."
|
||||||
|
/>
|
||||||
|
|
||||||
<div className="flex flex-1 overflow-hidden">
|
<div className="flex flex-1 overflow-hidden">
|
||||||
{/* Left panel — KPIs + call list */}
|
{/* Left panel — KPIs + call list */}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ const SearchLg = faIcon(faMagnifyingGlass);
|
|||||||
import { Badge } from '@/components/base/badges/badges';
|
import { Badge } from '@/components/base/badges/badges';
|
||||||
import { Input } from '@/components/base/input/input';
|
import { Input } from '@/components/base/input/input';
|
||||||
import { Table } from '@/components/application/table/table';
|
import { Table } from '@/components/application/table/table';
|
||||||
import { Tabs, TabList, Tab } from '@/components/application/tabs/tabs';
|
|
||||||
import { PaginationPageDefault } from '@/components/application/pagination/pagination';
|
import { PaginationPageDefault } from '@/components/application/pagination/pagination';
|
||||||
import { PageHeader } from '@/components/layout/page-header';
|
import { PageHeader } from '@/components/layout/page-header';
|
||||||
import { ColumnToggle, useColumnVisibility } from '@/components/application/table/column-toggle';
|
import { ColumnToggle, useColumnVisibility } from '@/components/application/table/column-toggle';
|
||||||
@@ -125,14 +124,15 @@ const renderCell = (call: MissedCallRecord, colId: string) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const DynamicMissedCallTable = ({ calls, columns, sortDescriptor, onSortChange }: {
|
const DynamicMissedCallTable = ({ calls, columns, columnKey, sortDescriptor, onSortChange }: {
|
||||||
calls: MissedCallRecord[];
|
calls: MissedCallRecord[];
|
||||||
columns: ColDef[];
|
columns: ColDef[];
|
||||||
|
columnKey: string;
|
||||||
sortDescriptor: SortDescriptor;
|
sortDescriptor: SortDescriptor;
|
||||||
onSortChange: (desc: SortDescriptor) => void;
|
onSortChange: (desc: SortDescriptor) => void;
|
||||||
}) => (
|
}) => (
|
||||||
<div className="flex flex-1 flex-col min-h-0 overflow-auto">
|
<div className="flex flex-1 flex-col min-h-0 overflow-auto">
|
||||||
<Table size="sm" sortDescriptor={sortDescriptor} onSortChange={onSortChange}>
|
<Table key={columnKey} size="sm" sortDescriptor={sortDescriptor} onSortChange={onSortChange}>
|
||||||
<Table.Header columns={columns}>
|
<Table.Header columns={columns}>
|
||||||
{(col) => (
|
{(col) => (
|
||||||
<Table.Head
|
<Table.Head
|
||||||
@@ -146,7 +146,7 @@ const DynamicMissedCallTable = ({ calls, columns, sortDescriptor, onSortChange }
|
|||||||
</Table.Header>
|
</Table.Header>
|
||||||
<Table.Body items={calls}>
|
<Table.Body items={calls}>
|
||||||
{(call) => (
|
{(call) => (
|
||||||
<Table.Row id={call.id} columns={columns}>
|
<Table.Row id={call.id} columns={columns} className="group/row">
|
||||||
{(col) => (
|
{(col) => (
|
||||||
<Table.Cell key={col.id}>
|
<Table.Cell key={col.id}>
|
||||||
{renderCell(call, col.id)}
|
{renderCell(call, col.id)}
|
||||||
@@ -252,11 +252,22 @@ export const MissedCallsPage = () => {
|
|||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
tabs={
|
tabs={
|
||||||
<Tabs selectedKey={tab} onSelectionChange={(key) => handleTab(key as StatusTab)}>
|
<div className="flex items-center gap-1.5">
|
||||||
<TabList items={tabItems} type="underline" size="sm">
|
{tabItems.map((item) => (
|
||||||
{(item) => <Tab key={item.id} id={item.id} label={item.label} badge={item.badge} />}
|
<button
|
||||||
</TabList>
|
key={item.id}
|
||||||
</Tabs>
|
onClick={() => handleTab(item.id)}
|
||||||
|
className={cx(
|
||||||
|
'shrink-0 rounded-full px-3 py-1 text-xs font-medium transition duration-100 ease-linear',
|
||||||
|
tab === item.id
|
||||||
|
? 'bg-brand-solid text-white'
|
||||||
|
: 'bg-secondary text-tertiary hover:text-secondary hover:bg-secondary_hover',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{item.label}{item.badge ? ` ${item.badge}` : ''}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -274,6 +285,7 @@ export const MissedCallsPage = () => {
|
|||||||
<DynamicMissedCallTable
|
<DynamicMissedCallTable
|
||||||
calls={pagedRows}
|
calls={pagedRows}
|
||||||
columns={columnDefs.filter(c => visibleColumns.has(c.id))}
|
columns={columnDefs.filter(c => visibleColumns.has(c.id))}
|
||||||
|
columnKey={Array.from(visibleColumns).sort().join(',')}
|
||||||
sortDescriptor={sortDescriptor}
|
sortDescriptor={sortDescriptor}
|
||||||
onSortChange={setSortDescriptor}
|
onSortChange={setSortDescriptor}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
faPalette,
|
faPalette,
|
||||||
faShieldHalved,
|
faShieldHalved,
|
||||||
} from '@fortawesome/pro-duotone-svg-icons';
|
} from '@fortawesome/pro-duotone-svg-icons';
|
||||||
import { TopBar } from '@/components/layout/top-bar';
|
import { PageHeader } from '@/components/layout/page-header';
|
||||||
import { SectionCard } from '@/components/setup/section-card';
|
import { SectionCard } from '@/components/setup/section-card';
|
||||||
import {
|
import {
|
||||||
SETUP_STEP_NAMES,
|
SETUP_STEP_NAMES,
|
||||||
@@ -50,7 +50,7 @@ export const SettingsPage = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-1 flex-col overflow-hidden">
|
<div className="flex flex-1 flex-col overflow-hidden">
|
||||||
<TopBar title="Settings" subtitle="Configure your hospital workspace" />
|
<PageHeader title="Settings" infoText="Configure your hospital workspace." />
|
||||||
|
|
||||||
<div className="flex-1 overflow-y-auto p-8">
|
<div className="flex-1 overflow-y-auto p-8">
|
||||||
<div className="mx-auto max-w-5xl">
|
<div className="mx-auto max-w-5xl">
|
||||||
@@ -73,6 +73,7 @@ export const SettingsPage = () => {
|
|||||||
icon={faBuilding}
|
icon={faBuilding}
|
||||||
href="/settings/clinics"
|
href="/settings/clinics"
|
||||||
status={STEP_TO_STATUS(state, 'clinics')}
|
status={STEP_TO_STATUS(state, 'clinics')}
|
||||||
|
disabled
|
||||||
/>
|
/>
|
||||||
<SectionCard
|
<SectionCard
|
||||||
title={SETUP_STEP_LABELS.doctors.title}
|
title={SETUP_STEP_LABELS.doctors.title}
|
||||||
@@ -80,6 +81,7 @@ export const SettingsPage = () => {
|
|||||||
icon={faStethoscope}
|
icon={faStethoscope}
|
||||||
href="/settings/doctors"
|
href="/settings/doctors"
|
||||||
status={STEP_TO_STATUS(state, 'doctors')}
|
status={STEP_TO_STATUS(state, 'doctors')}
|
||||||
|
disabled
|
||||||
/>
|
/>
|
||||||
<SectionCard
|
<SectionCard
|
||||||
title={SETUP_STEP_LABELS.team.title}
|
title={SETUP_STEP_LABELS.team.title}
|
||||||
@@ -87,6 +89,7 @@ export const SettingsPage = () => {
|
|||||||
icon={faUserTie}
|
icon={faUserTie}
|
||||||
href="/settings/team"
|
href="/settings/team"
|
||||||
status={STEP_TO_STATUS(state, 'team')}
|
status={STEP_TO_STATUS(state, 'team')}
|
||||||
|
disabled
|
||||||
/>
|
/>
|
||||||
</SectionGroup>
|
</SectionGroup>
|
||||||
|
|
||||||
@@ -98,6 +101,7 @@ export const SettingsPage = () => {
|
|||||||
icon={faPhone}
|
icon={faPhone}
|
||||||
href="/settings/telephony"
|
href="/settings/telephony"
|
||||||
status={STEP_TO_STATUS(state, 'telephony')}
|
status={STEP_TO_STATUS(state, 'telephony')}
|
||||||
|
disabled
|
||||||
/>
|
/>
|
||||||
<SectionCard
|
<SectionCard
|
||||||
title={SETUP_STEP_LABELS.ai.title}
|
title={SETUP_STEP_LABELS.ai.title}
|
||||||
@@ -105,12 +109,14 @@ export const SettingsPage = () => {
|
|||||||
icon={faRobot}
|
icon={faRobot}
|
||||||
href="/settings/ai"
|
href="/settings/ai"
|
||||||
status={STEP_TO_STATUS(state, 'ai')}
|
status={STEP_TO_STATUS(state, 'ai')}
|
||||||
|
disabled
|
||||||
/>
|
/>
|
||||||
<SectionCard
|
<SectionCard
|
||||||
title="Website widget"
|
title="Website widget"
|
||||||
description="Embed the chat + booking widget on your hospital website."
|
description="Embed the chat + booking widget on your hospital website."
|
||||||
icon={faGlobe}
|
icon={faGlobe}
|
||||||
href="/settings/widget"
|
href="/settings/widget"
|
||||||
|
disabled
|
||||||
/>
|
/>
|
||||||
<SectionCard
|
<SectionCard
|
||||||
title="Routing rules"
|
title="Routing rules"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
import { faSidebarFlip, faSidebar } from '@fortawesome/pro-duotone-svg-icons';
|
import { faSidebarFlip, faSidebar } from '@fortawesome/pro-duotone-svg-icons';
|
||||||
|
import { PageHeader } from '@/components/layout/page-header';
|
||||||
import { AiChatPanel } from '@/components/call-desk/ai-chat-panel';
|
import { AiChatPanel } from '@/components/call-desk/ai-chat-panel';
|
||||||
import { DashboardKpi } from '@/components/dashboard/kpi-cards';
|
import { DashboardKpi } from '@/components/dashboard/kpi-cards';
|
||||||
import { MissedQueue } from '@/components/dashboard/missed-queue';
|
import { MissedQueue } from '@/components/dashboard/missed-queue';
|
||||||
@@ -55,13 +56,12 @@ export const TeamDashboardPage = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-1 flex-col overflow-hidden">
|
<div className="flex flex-1 flex-col overflow-hidden">
|
||||||
{/* Header */}
|
<PageHeader
|
||||||
<div className="flex shrink-0 items-center justify-between border-b border-secondary px-6 py-3">
|
title="Team Dashboard"
|
||||||
<div className="flex items-center gap-3">
|
subtitle={dateRangeLabel}
|
||||||
<h1 className="text-lg font-bold text-primary">Team Dashboard</h1>
|
infoText="Aggregated call metrics, agent performance, and operational alerts."
|
||||||
<span className="text-sm text-tertiary">{dateRangeLabel}</span>
|
controls={
|
||||||
</div>
|
<>
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<div className="flex rounded-lg border border-secondary overflow-hidden">
|
<div className="flex rounded-lg border border-secondary overflow-hidden">
|
||||||
{(['today', 'week', 'month'] as const).map((range) => (
|
{(['today', 'week', 'month'] as const).map((range) => (
|
||||||
<button
|
<button
|
||||||
@@ -83,8 +83,9 @@ export const TeamDashboardPage = () => {
|
|||||||
>
|
>
|
||||||
<FontAwesomeIcon icon={aiOpen ? faSidebarFlip : faSidebar} className="size-4" />
|
<FontAwesomeIcon icon={aiOpen ? faSidebarFlip : faSidebar} className="size-4" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</>
|
||||||
</div>
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
<div className="flex flex-1 overflow-hidden">
|
<div className="flex flex-1 overflow-hidden">
|
||||||
{/* Main content — scrollable column with KPIs pinned at the
|
{/* Main content — scrollable column with KPIs pinned at the
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
faUsers, faPhoneVolume, faCalendarCheck, faPhoneMissed,
|
faUsers, faPhoneVolume, faCalendarCheck, faPhoneMissed,
|
||||||
faPercent, faTriangleExclamation,
|
faPercent, faTriangleExclamation,
|
||||||
} from '@fortawesome/pro-duotone-svg-icons';
|
} from '@fortawesome/pro-duotone-svg-icons';
|
||||||
import { TopBar } from '@/components/layout/top-bar';
|
import { PageHeader } from '@/components/layout/page-header';
|
||||||
import { Badge } from '@/components/base/badges/badges';
|
import { Badge } from '@/components/base/badges/badges';
|
||||||
import { Table } from '@/components/application/table/table';
|
import { Table } from '@/components/application/table/table';
|
||||||
import { apiClient } from '@/lib/api-client';
|
import { apiClient } from '@/lib/api-client';
|
||||||
@@ -291,25 +291,28 @@ export const TeamPerformancePage = () => {
|
|||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
<>
|
<div className="flex flex-1 flex-col overflow-hidden">
|
||||||
<TopBar title="Team Performance" />
|
<PageHeader title="Team Dashboard" infoText="Aggregated metrics across all agents." />
|
||||||
<div className="flex flex-1 items-center justify-center">
|
<div className="flex flex-1 items-center justify-center">
|
||||||
<p className="text-sm text-tertiary">Loading team performance...</p>
|
<p className="text-sm text-tertiary">Loading team performance...</p>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div className="flex flex-1 flex-col overflow-hidden">
|
||||||
<TopBar title="Team Performance" subtitle="Aggregated metrics across all agents" />
|
<PageHeader
|
||||||
|
title="Team Dashboard"
|
||||||
|
infoText="Aggregated metrics across all agents."
|
||||||
|
controls={<DateFilter value={range} onChange={setRange} />}
|
||||||
|
/>
|
||||||
|
|
||||||
<div className="flex flex-1 flex-col overflow-y-auto">
|
<div className="flex flex-1 flex-col overflow-y-auto">
|
||||||
{/* Section 1: Key Metrics */}
|
{/* Section 1: Key Metrics */}
|
||||||
<div className="px-6 pt-5">
|
<div className="px-6 pt-5">
|
||||||
<div className="flex items-center justify-between mb-4">
|
<div className="mb-4">
|
||||||
<h3 className="text-sm font-semibold text-secondary">Key Metrics</h3>
|
<h3 className="text-sm font-semibold text-secondary">Key Metrics</h3>
|
||||||
<DateFilter value={range} onChange={setRange} />
|
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-5 gap-3">
|
<div className="grid grid-cols-5 gap-3">
|
||||||
<KpiCard icon={faUsers} value={activeAgents} label="Active Agents" color="bg-brand-secondary" />
|
<KpiCard icon={faUsers} value={activeAgents} label="Active Agents" color="bg-brand-secondary" />
|
||||||
@@ -510,6 +513,6 @@ export const TeamPerformancePage = () => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user