index.tsx 743 Bytes
import React from 'react';
import { getOr } from 'lodash/fp';
import ThreadContent from '../../../../../models/ThreadContent';
import isCurrentUser from '../../../../helpers/isCurrentUser';
interface Props {
  threadContent: ThreadContent;
}

const Info = ({threadContent}: Props) => {
  const readBy = getOr(0, 'contentInstance.readBy', threadContent);
  const authorId = getOr(0, 'author.id', threadContent);
  const isSeen = !isCurrentUser(authorId) && readBy;
  return (
    <span className='subheader timestamp'>
      {isSeen && <small className='pull-left mr-1'>
          <i className='fa fa-check-circle'/>&nbsp; Seen
      </small>}
      <small>{threadContent.getLocalTimeString()}</small>
    </span>
  );
};

export default Info;