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 => {
22 `protocol.description.${entry.type}`,
26 return i18n.t('protocol.description.unknown', entry);
30 const getEntryIcon = entry => {
33 return <Icon.PROTOCOL />;
37 const Item = ({ entry }) =>
38 <ListGroup.Item className="d-flex align-items-center">
39 <div className="pe-3 text-muted">
44 {getEntryDescription(entry)}
47 className="text-muted"
48 title={moment(entry.created_at).format('LLLL')}
56 entry: PropTypes.shape({
57 created_at: PropTypes.string,
65 export default withTranslation()(Item);