diff --git a/src/modules/attendance/pages/AgentNewAttendancePage.jsx b/src/modules/attendance/pages/AgentNewAttendancePage.jsx new file mode 100644 index 0000000..7389ed5 --- /dev/null +++ b/src/modules/attendance/pages/AgentNewAttendancePage.jsx @@ -0,0 +1,138 @@ +import { useEffect, useMemo, useState } from 'react'; +import { BrandMark } from '../../../shared/components/BrandMark'; +import { useViewport } from '../../../shared/hooks/useViewport'; +import { getCurrentUserDisplay } from '../../auth/services/sessionService'; +import { listContactProfiles } from '../../chat/services/contactProfileService'; +import { HomeSidebar } from '../../home/components/HomeSidebar'; +import { sidebarItems } from '../../home/services/homeMocks'; +import { NewAttendancePage } from './NewAttendancePage'; + +export function AgentNewAttendancePage() { + const { isDesktop, isMobile } = useViewport(); + const userDisplay = getCurrentUserDisplay(); + const [contactCount, setContactCount] = useState(0); + + useEffect(() => { + let isMounted = true; + + listContactProfiles() + .then((items) => { + if (isMounted) setContactCount(Array.isArray(items) ? items.length : 0); + }) + .catch(() => { + if (isMounted) setContactCount(0); + }); + + return () => { + isMounted = false; + }; + }, []); + + const sidebarWithContactCount = useMemo( + () => sidebarItems.map((item) => (item.id === 'contacts' ? { ...item, count: contactCount } : item)), + [contactCount], + ); + + return ( +
+
+
+
+
+ +
+ +
+ +
+
+
+

Abrir Atendimento

+

+ Inicie um contato ativo por WhatsApp usando mensagens pré-aprovadas. +

+
+ +
+
+ {userDisplay.name} + + Atendimento omnichannel + +
+ +
+
+ + +
+
+
+
+ ); +} diff --git a/src/modules/chat/components/ContactProfilePanel.jsx b/src/modules/chat/components/ContactProfilePanel.jsx index 6e43aed..e6e6e7d 100644 --- a/src/modules/chat/components/ContactProfilePanel.jsx +++ b/src/modules/chat/components/ContactProfilePanel.jsx @@ -140,11 +140,11 @@ export function ContactProfilePanel({ isOpen, contact, onClose, onSaved }) { diff --git a/src/modules/home/pages/ContactsPage.jsx b/src/modules/home/pages/ContactsPage.jsx index 0c19d2c..8263af6 100644 --- a/src/modules/home/pages/ContactsPage.jsx +++ b/src/modules/home/pages/ContactsPage.jsx @@ -56,7 +56,7 @@ function emptyDraft() { }; } -export function ContactsPage() { +export function ContactsPanel({ embedded = false }) { const { isDesktop, isMobile } = useViewport(); const currentUser = getCurrentUser(); const currentUserId = getUserId(currentUser); @@ -146,6 +146,202 @@ export function ContactsPage() { } } + const content = ( +
+ + +
+
+ + {selectedChatId ? 'Editar contato' : 'Novo contato'} + + + O WhatsApp é usado para vincular o contato à conversa. + +
+ +
+ + + + + + + + + +
+ +