1 import moment from 'moment';
2 import PropTypes from 'prop-types';
3 import React from 'react';
4 import { ListGroup } from 'react-bootstrap';
5 import { useTranslation } from 'react-i18next';
7 const getEntryDate = entry => {
8 const dateStr = moment(entry.created_at).fromNow();
10 ? `${entry.user.username} ${dateStr}`
14 const getEntryOrigin = (entry, t) => {
15 return t('chatBotLog.origin.chatLog', {
16 channel: entry.origin.params[0],
17 date: new Date(entry.origin.created_at),
18 nick: entry.origin.nick,
22 const Item = ({ entry }) => {
23 const { t } = useTranslation();
25 return <ListGroup.Item>
32 className="text-muted"
34 {getEntryOrigin(entry, t)}
38 className="text-muted"
39 title={moment(entry.created_at).format('LLLL')}
48 entry: PropTypes.shape({
49 created_at: PropTypes.string,
50 origin: PropTypes.shape({}),
51 text: PropTypes.string,