1 import moment from 'moment';
2 import PropTypes from 'prop-types';
3 import React from 'react';
4 import { ListGroup } from 'react-bootstrap';
5 import { withTranslation } from 'react-i18next';
7 import Icon from '../common/Icon';
8 import i18n from '../../i18n';
10 const getEntryDate = entry => {
11 const dateStr = moment(entry.created_at).fromNow();
13 ? `${entry.user.username} ${dateStr}`
17 const getEntryDescription = entry => {
21 `protocol.description.${entry.type}`,
25 return i18n.t('protocol.description.unknown', entry);
29 const getEntryIcon = entry => {
32 return <Icon.PROTOCOL />;
36 const Item = ({ entry }) =>
37 <ListGroup.Item className="d-flex align-items-center">
38 <div className="pe-3 text-muted">
43 {getEntryDescription(entry)}
46 className="text-muted"
47 title={moment(entry.created_at).format('LLLL')}
55 entry: PropTypes.shape({
56 created_at: PropTypes.string,
64 export default withTranslation()(Item);