ChatHeader component displays contact information at the top of the chat panel, including the contact’s avatar, online status, and action buttons for calls and options.
Location
components/chat/chat-header.tsx
Props
The contact object containing name, avatar, and last seen information
Whether the contact is currently online
Optional callback for the back button (displayed on mobile)
Features
Avatar with online indicator
The header displays a circular avatar with a small status indicator showing whether the contact is online (accent color) or offline (muted color).components/chat/chat-header.tsx
Last seen status
When the contact is offline, the header displays a relative timestamp showing when they were last seen:components/chat/chat-header.tsx
Action buttons
The header provides three action buttons:- Voice call (Phone icon)
- Video call (VideoCamera icon)
- Options menu (DotsThreeVertical icon)
Mobile back button
WhenonBack is provided, a back button is displayed on the left side of the header, allowing users to return to the chat list on mobile devices.
Initials helper
The component includes aninitials helper function that generates initials from a contact’s name:
components/chat/chat-header.tsx