ui: frontend api (#470) [skip-cache]

This commit is contained in:
undefined authored and GitHub committed 2022-12-12 00:53:44 +08:00
1 parent 6d69e88739
commit 96fa6cc7b9
116 files changed
+599 -629

No files matched your search

@@ -6,8 +6,7 @@ import moment from 'moment';
import React from 'react';
import { connect } from 'react-redux';
import TimeAgo from 'timeago-react';
import i18n from 'vj/utils/i18n';
import { parse as parseMongoId } from 'vj/utils/mongoId';
import { i18n, mongoId } from 'vj/utils';
import Message from './MessageComponent';
const mapStateToProps = (state) => ({
@@ -70,7 +69,7 @@ export default connect(mapStateToProps)(class MessagePadDialogueContentContainer
renderInner() {
if (this.props.activeId === null) return [];
const sorted = this.props.item.messages
.sort((msg1, msg2) => parseMongoId(msg1._id).timestamp - parseMongoId(msg2._id).timestamp);
.sort((msg1, msg2) => mongoId(msg1._id).timestamp - mongoId(msg2._id).timestamp);
return sorted.map((msg) => (
<Message
key={msg._id}
@@ -82,8 +81,8 @@ export default connect(mapStateToProps)(class MessagePadDialogueContentContainer
}
>
<div>{this.renderContent(msg)}</div>
<time data-tooltip={moment(parseMongoId(msg._id).timestamp * 1000).format('YYYY-MM-DD HH:mm:ss')}>
<TimeAgo datetime={parseMongoId(msg._id).timestamp * 1000} locale={i18n('timeago_locale')} />
<time data-tooltip={moment(mongoId(msg._id).timestamp * 1000).format('YYYY-MM-DD HH:mm:ss')}>
<TimeAgo datetime={mongoId(msg._id).timestamp * 1000} locale={i18n('timeago_locale')} />
</time>
</Message>
));