/opt/mawid/apps/dashboard/app/(app)/conversations
NameSizeModeActions
[id]/-0755rm
page.tsx19180644editdlrm
Edit: /opt/mawid/apps/dashboard/app/(app)/conversations/page.tsx (1918B)
'use client'; import { useEffect, useState } from 'react'; import Link from 'next/link'; import { api } from '@/lib/api'; import { useLang } from '@/lib/i18n'; import { Badge, Card, Spinner } from '@/components/ui'; interface ConversationRow { id: string; patient: { name: string | null; waPhone: string }; lastMessage: string | null; lastMessageAt: string | null; handedOff: boolean; } export default function ConversationsPage() { const { t, lang } = useLang(); const [conversations, setConversations] = useState(null); useEffect(() => { api('/conversations').then(setConversations); }, []); if (conversations === null) return ; return ( {conversations.length === 0 && (

{t('noMessages')}

)} {conversations.map((c) => (
{c.patient.name ?? c.patient.waPhone}
{c.lastMessage ?? '—'}
{c.handedOff && {t('agentPaused')}} {c.lastMessageAt && ( {new Date(c.lastMessageAt).toLocaleString(lang === 'ar' ? 'ar' : lang, { day: 'numeric', month: 'short', hour: '2-digit', minute: '2-digit', })} )}
))}
); }