import React from 'react';
import classNames from 'classnames';
import { MessageDirection } from '../../models/messageType';
import { getOurPubKeyStrFromCache } from '../../session/utils/User';
import {
FindAndFormatContactType,
openConversationWithMessages,
} from '../../state/ducks/conversations';
import { ContactName } from '../conversation/ContactName';
import { Avatar, AvatarSize } from '../avatar/Avatar';
import { Timestamp } from '../conversation/Timestamp';
import { MessageBodyHighlight } from '../basic/MessageBodyHighlight';
type PropsHousekeeping = {
isSelected?: boolean;
};
export type PropsForSearchResults = {
from: FindAndFormatContactType;
to: FindAndFormatContactType;
id: string;
conversationId: string;
destination: string;
source: string;
direction?: string;
snippet?: string; //not sure about the type of snippet
receivedAt?: number;
};
export type MessageResultProps = PropsForSearchResults & PropsHousekeeping;
const FromName = (props: { source: string; destination: string }) => {
const { source, destination } = props;
const isNoteToSelf = destination === getOurPubKeyStrFromCache() && source === destination;
if (isNoteToSelf) {
return (
{window.i18n('noteToSelf')}
);
}
if (source === getOurPubKeyStrFromCache()) {
return {window.i18n('you')};
}
return (
// tslint:disable: use-simple-attributes