import React from 'react'; import { ConversationListItemProps, MemoConversationListItemWithDetails, } from '../leftpane/conversation-list-item/ConversationListItem'; import { MessageResultProps, MessageSearchResult } from './MessageSearchResults'; export type SearchResultsProps = { contacts: Array; conversations: Array; messages: Array; searchTerm: string; }; const ContactsItem = (props: { header: string; items: Array }) => { return (
{props.header}
{props.items.map(contact => ( ))}
); }; export const SearchResults = (props: SearchResultsProps) => { const { conversations, contacts, messages, searchTerm } = props; const haveConversations = conversations && conversations.length; const haveContacts = contacts && contacts.length; const haveMessages = messages && messages.length; const noResults = !haveConversations && !haveContacts && !haveMessages; return (
{noResults ? (
{window.i18n('noSearchResults', [searchTerm])}
) : null} {haveConversations ? (
{window.i18n('conversationsHeader')}
{conversations.map(conversation => ( ))}
) : null} {haveContacts ? ( ) : null} {haveMessages ? (
{`${window.i18n('messagesHeader')}: ${messages.length}`}
{messages.map(message => ( ))}
) : null}
); };