Browse Source

Change topic header moment date with TimeAgo

develop
Apostolos Fanakis 4 years ago
parent
commit
558578f5d9
  1. 6
      packages/concordia-app/src/views/Topic/TopicView/index.jsx

6
packages/concordia-app/src/views/Topic/TopicView/index.jsx

@ -4,9 +4,9 @@ import { useDispatch, useSelector } from 'react-redux';
import { import {
Container, Dimmer, Icon, Image, Placeholder, Step, Container, Dimmer, Icon, Image, Placeholder, Step,
} from 'semantic-ui-react'; } from 'semantic-ui-react';
import moment from 'moment';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { useHistory } from 'react-router'; import { useHistory } from 'react-router';
import TimeAgo from 'react-timeago';
import { breeze, drizzle } from '../../../redux/store'; import { breeze, drizzle } from '../../../redux/store';
import { FETCH_USER_DATABASE } from '../../../redux/actions/peerDbReplicationActions'; import { FETCH_USER_DATABASE } from '../../../redux/actions/peerDbReplicationActions';
import './styles.css'; import './styles.css';
@ -65,7 +65,7 @@ const TopicView = (props) => {
setTopicAuthorAddress(getTopicResults[getTopicCallHash].value[0]); setTopicAuthorAddress(getTopicResults[getTopicCallHash].value[0]);
setTopicAuthor(getTopicResults[getTopicCallHash].value[1]); setTopicAuthor(getTopicResults[getTopicCallHash].value[1]);
setTimestamp(getTopicResults[getTopicCallHash].value[2]); setTimestamp(getTopicResults[getTopicCallHash].value[2] * 1000);
setPostIds(getTopicResults[getTopicCallHash].value[3].map((postId) => parseInt(postId, 10))); setPostIds(getTopicResults[getTopicCallHash].value[3].map((postId) => parseInt(postId, 10)));
const topicFound = topics const topicFound = topics
@ -163,7 +163,7 @@ const TopicView = (props) => {
</Step.Title> </Step.Title>
<Step.Description> <Step.Description>
{timestamp {timestamp
? moment(timestamp * 1000).fromNow() ? <TimeAgo date={timestamp} />
: ( : (
<Placeholder id="date-placeholder"> <Placeholder id="date-placeholder">
<Placeholder.Line length="full" /> <Placeholder.Line length="full" />

Loading…
Cancel
Save