import { IonIcon, IonItem } from '@ionic/react'; import { checkmarkDone } from 'ionicons/icons'; import { ContactStore } from '../store'; import { getContacts } from '../store/Selectors'; const ChatItem = ({ chat }) => { const contacts = ContactStore.useState(getContacts); const { chats, contact_id } = chat; const { read, date, preview, received } = chats[chats.length - 1]; const contact = contacts.filter((c) => c.id === contact_id)[0]; const notificationCount = chats.filter((chat) => chat.read === false).length; return (
{read && received &&
0 && 'chat-unread'}`}>{date}
{notificationCount > 0 &&