2026-03-19 18:22:18 -03:00
|
|
|
function ChannelBadge({ channel }) {
|
|
|
|
|
const colors = {
|
|
|
|
|
WhatsApp: '#2bb741',
|
|
|
|
|
Email: '#e5a22a',
|
|
|
|
|
SMS: '#00a4b7',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<span
|
|
|
|
|
style={{
|
|
|
|
|
display: 'inline-flex',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
borderRadius: 999,
|
|
|
|
|
padding: '0.22rem 0.6rem',
|
|
|
|
|
background: `${colors[channel] || '#003150'}16`,
|
|
|
|
|
color: colors[channel] || '#003150',
|
|
|
|
|
fontSize: '0.8rem',
|
|
|
|
|
fontWeight: 700,
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{channel}
|
|
|
|
|
</span>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-19 16:39:01 -03:00
|
|
|
function ActivityDot({ status }) {
|
|
|
|
|
const color = status === 'away' ? '#e5a22a' : '#dc2626';
|
2026-05-19 09:45:00 -03:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<span
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
style={{
|
|
|
|
|
width: 10,
|
|
|
|
|
height: 10,
|
|
|
|
|
borderRadius: 999,
|
|
|
|
|
background: color,
|
|
|
|
|
boxShadow: `0 0 0 3px ${color}22`,
|
|
|
|
|
flex: '0 0 auto',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-19 15:29:43 -03:00
|
|
|
function UnreadBadge({ count }) {
|
|
|
|
|
if (!count) return null;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<span
|
|
|
|
|
style={{
|
|
|
|
|
width: 26,
|
|
|
|
|
height: 26,
|
|
|
|
|
borderRadius: '50%',
|
|
|
|
|
background: 'var(--color-secondary)',
|
|
|
|
|
color: '#fff',
|
|
|
|
|
fontSize: '0.78rem',
|
|
|
|
|
fontWeight: 800,
|
|
|
|
|
display: 'inline-grid',
|
|
|
|
|
placeItems: 'center',
|
|
|
|
|
lineHeight: 1,
|
|
|
|
|
flex: '0 0 auto',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{count > 99 ? '99+' : count}
|
|
|
|
|
</span>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const CHAT_LIST_HEIGHT = 'min(640px, calc(100vh - 220px))';
|
|
|
|
|
|
2026-03-19 18:22:18 -03:00
|
|
|
export function ChatConversationList({
|
|
|
|
|
contacts,
|
|
|
|
|
activeContactId,
|
|
|
|
|
onSelectContact,
|
|
|
|
|
isMobile = false,
|
|
|
|
|
}) {
|
|
|
|
|
return (
|
|
|
|
|
<aside
|
|
|
|
|
style={{
|
|
|
|
|
background: '#fff',
|
|
|
|
|
border: '1px solid var(--color-border)',
|
|
|
|
|
borderRadius: '28px',
|
|
|
|
|
padding: '1rem',
|
|
|
|
|
display: 'grid',
|
2026-05-19 09:45:00 -03:00
|
|
|
gridTemplateRows: 'auto minmax(0, 1fr)',
|
2026-03-19 18:22:18 -03:00
|
|
|
gap: '0.85rem',
|
2026-05-19 15:29:43 -03:00
|
|
|
height: isMobile ? 'auto' : CHAT_LIST_HEIGHT,
|
|
|
|
|
maxHeight: isMobile ? 'none' : CHAT_LIST_HEIGHT,
|
|
|
|
|
alignSelf: 'start',
|
2026-05-19 09:45:00 -03:00
|
|
|
minHeight: 0,
|
2026-03-19 18:22:18 -03:00
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<div>
|
|
|
|
|
<strong style={{ display: 'block', fontSize: '1.08rem' }}>Conversas ativas</strong>
|
|
|
|
|
<span style={{ color: 'var(--color-text-soft)' }}>
|
|
|
|
|
WhatsApp, SMS e email em uma fila visual.
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
display: 'grid',
|
|
|
|
|
gap: '0.75rem',
|
|
|
|
|
gridTemplateColumns: isMobile ? '1fr' : '1fr',
|
2026-05-19 15:29:43 -03:00
|
|
|
gridAutoRows: 'max-content',
|
|
|
|
|
alignContent: 'start',
|
2026-05-19 09:45:00 -03:00
|
|
|
overflowY: 'auto',
|
|
|
|
|
minHeight: 0,
|
|
|
|
|
paddingRight: '0.15rem',
|
2026-03-19 18:22:18 -03:00
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{contacts.map((contact) => {
|
|
|
|
|
const isActive = contact.id === activeContactId;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<button
|
|
|
|
|
key={contact.id}
|
|
|
|
|
type="button"
|
|
|
|
|
onClick={() => onSelectContact(contact.id)}
|
|
|
|
|
style={{
|
|
|
|
|
border: '1px solid',
|
|
|
|
|
borderColor: isActive ? 'rgba(0, 164, 183, 0.26)' : 'var(--color-border)',
|
|
|
|
|
background: isActive ? 'rgba(0, 164, 183, 0.08)' : '#fff',
|
|
|
|
|
borderRadius: '20px',
|
|
|
|
|
padding: '1rem',
|
|
|
|
|
textAlign: 'left',
|
|
|
|
|
display: 'grid',
|
|
|
|
|
gap: '0.6rem',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<div style={{ display: 'flex', justifyContent: 'space-between', gap: '1rem' }}>
|
2026-05-19 09:45:00 -03:00
|
|
|
<span style={{ display: 'inline-flex', alignItems: 'center', gap: '0.5rem', minWidth: 0 }}>
|
2026-05-19 16:39:01 -03:00
|
|
|
<ActivityDot status={contact.status} />
|
2026-05-19 09:45:00 -03:00
|
|
|
<strong style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
|
|
|
|
|
{contact.name}
|
|
|
|
|
</strong>
|
|
|
|
|
</span>
|
2026-03-19 18:22:18 -03:00
|
|
|
<span style={{ fontSize: '0.82rem', color: 'var(--color-text-soft)' }}>
|
|
|
|
|
{contact.time}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div style={{ display: 'flex', justifyContent: 'space-between', gap: '0.75rem' }}>
|
|
|
|
|
<ChannelBadge channel={contact.channel} />
|
2026-05-19 15:29:43 -03:00
|
|
|
<UnreadBadge count={contact.unread} />
|
2026-03-19 18:22:18 -03:00
|
|
|
</div>
|
|
|
|
|
<span style={{ color: 'var(--color-text-soft)' }}>{contact.preview}</span>
|
|
|
|
|
</button>
|
|
|
|
|
);
|
|
|
|
|
})}
|
2026-05-19 15:29:43 -03:00
|
|
|
|
|
|
|
|
{contacts.length === 0 ? (
|
|
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
border: '1px solid var(--color-border)',
|
|
|
|
|
borderRadius: '18px',
|
|
|
|
|
padding: '1rem',
|
|
|
|
|
background: 'rgba(0, 49, 80, 0.04)',
|
|
|
|
|
color: 'var(--color-text-soft)',
|
|
|
|
|
fontWeight: 700,
|
|
|
|
|
lineHeight: 1.45,
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Nenhuma conversa ativa na sua fila. Conversas em triagem do Omnino aparecem aqui depois de classificadas.
|
|
|
|
|
</div>
|
|
|
|
|
) : null}
|
2026-03-19 18:22:18 -03:00
|
|
|
</div>
|
|
|
|
|
</aside>
|
|
|
|
|
);
|
|
|
|
|
}
|