created temporary solution for time

This commit is contained in:
u-e 2019-01-11 09:34:18 +03:00
parent 3326f97395
commit cabd822539
6 changed files with 28 additions and 9 deletions

View File

@ -2,6 +2,7 @@ import React, { PureComponent, Fragment } from 'react';
import { View, FlatList } from 'react-native'; import { View, FlatList } from 'react-native';
import { injectIntl } from 'react-intl'; import { injectIntl } from 'react-intl';
import { getTimeFromNow } from '../../../utils/time';
// Constants // Constants
// Components // Components
@ -57,7 +58,8 @@ class CommentsView extends PureComponent {
<View key={index}> <View key={index}>
<PostHeaderDescription <PostHeaderDescription
key={item.permlink} key={item.permlink}
date={intl.formatRelative(item.created)} // date={intl.formatRelative(item.created)}
date={getTimeFromNow(item.created)}
name={item.author} name={item.author}
reputation={item.author_reputation} reputation={item.author_reputation}
size={avatarSize || 24} size={avatarSize || 24}

View File

@ -3,6 +3,9 @@ import { TouchableOpacity, Text, View } from 'react-native';
import FastImage from 'react-native-fast-image'; import FastImage from 'react-native-fast-image';
import { injectIntl } from 'react-intl'; import { injectIntl } from 'react-intl';
// Utils
import { getTimeFromNow } from '../../../utils/time';
// Components // Components
import { PostHeaderDescription } from '../../postElements'; import { PostHeaderDescription } from '../../postElements';
import { PostDropdown } from '../../postDropdown'; import { PostDropdown } from '../../postDropdown';
@ -54,7 +57,9 @@ class PostCardView extends Component {
}; };
render() { render() {
const { content, isHideImage, fetchPost, intl } = this.props; const {
content, isHideImage, fetchPost, intl,
} = this.props;
const _image = content && content.image const _image = content && content.image
? { uri: content.image, priority: FastImage.priority.high } ? { uri: content.image, priority: FastImage.priority.high }
: DEFAULT_IMAGE; : DEFAULT_IMAGE;
@ -64,7 +69,8 @@ class PostCardView extends Component {
<View style={styles.post}> <View style={styles.post}>
<View style={styles.bodyHeader}> <View style={styles.bodyHeader}>
<PostHeaderDescription <PostHeaderDescription
date={intl.formatRelative(content.created)} // date={intl.formatRelative(content.created)}
date={getTimeFromNow(content.created)}
isHideImage={isHideImage} isHideImage={isHideImage}
name={content.author} name={content.author}
profileOnPress={this._handleOnUserPress} profileOnPress={this._handleOnUserPress}

View File

@ -4,6 +4,9 @@ import { View, Text, TouchableOpacity } from 'react-native';
import { injectIntl } from 'react-intl'; import { injectIntl } from 'react-intl';
import FastImage from 'react-native-fast-image'; import FastImage from 'react-native-fast-image';
// Utils
import { getTimeFromNow } from '../../../utils/time';
// Components // Components
import { PostHeaderDescription } from '../../postElements'; import { PostHeaderDescription } from '../../postElements';
import { IconButton } from '../../iconButton'; import { IconButton } from '../../iconButton';
@ -49,7 +52,8 @@ class PostListItemView extends Component {
<View style={styles.container}> <View style={styles.container}>
<View style={styles.header}> <View style={styles.header}>
<PostHeaderDescription <PostHeaderDescription
date={intl.formatRelative(created)} // date={intl.formatRelative(created)}
date={getTimeFromNow(created)}
name={username} name={username}
reputation={reputation} reputation={reputation}
size={32} size={32}

View File

@ -4,7 +4,8 @@ import {
} from 'react-native'; } from 'react-native';
import { injectIntl } from 'react-intl'; import { injectIntl } from 'react-intl';
// Constants // Utils
import { getTimeFromNow } from '../../../utils/time';
// Components // Components
import { PostHeaderDescription, PostBody, Tags } from '../../postElements'; import { PostHeaderDescription, PostBody, Tags } from '../../postElements';
@ -115,7 +116,7 @@ class PostDisplayView extends PureComponent {
const isPostEnd = scrollHeight > postHeight; const isPostEnd = scrollHeight > postHeight;
const isGetComment = scrollHeight + 300 > postHeight; const isGetComment = scrollHeight + 300 > postHeight;
const formatedTime = post && intl.formatRelative(post.created); const formatedTime = post && getTimeFromNow(post.created);
if (isGetComment && !isLoadedComments) this.setState({ isLoadedComments: true }); if (isGetComment && !isLoadedComments) this.setState({ isLoadedComments: true });

View File

@ -4,6 +4,9 @@ import { injectIntl } from 'react-intl';
// Utilities // Utilities
import { groomingTransactionData } from '../../../utils/wallet'; import { groomingTransactionData } from '../../../utils/wallet';
// Utils
import { getTimeFromNow } from '../../../utils/time';
// Components // Components
// import { FilterBar } from '../../filterBar'; // import { FilterBar } from '../../filterBar';
import { WalletLineItem, Card } from '../../basicUIElements'; import { WalletLineItem, Card } from '../../basicUIElements';
@ -62,7 +65,8 @@ class TransactionView extends PureComponent {
text={intl.formatMessage({ text={intl.formatMessage({
id: `wallet.${transactionData.opName}`, id: `wallet.${transactionData.opName}`,
})} })}
description={intl.formatRelative(transactionData.transDate)} // description={intl.formatRelative(transactionData.transDate)}
description={getTimeFromNow(transactionData.transDate)}
isCircleIcon isCircleIcon
isThin isThin
circleIconColor="white" circleIconColor="white"

View File

@ -2,7 +2,8 @@ import React, { PureComponent } from 'react';
import { View, FlatList, Text } from 'react-native'; import { View, FlatList, Text } from 'react-native';
import { injectIntl } from 'react-intl'; import { injectIntl } from 'react-intl';
// Constants // Utils
import { getTimeFromNow } from '../../../utils/time';
// Components // Components
import { UserListItem } from '../../basicUIElements'; import { UserListItem } from '../../basicUIElements';
@ -28,7 +29,8 @@ class VotersDisplayView extends PureComponent {
avatar={item.avatar} avatar={item.avatar}
index={index} index={index}
username={item.voter} username={item.voter}
description={intl.formatRelative(item.time)} // description={intl.formatRelative(item.time)}
description={getTimeFromNow(item.time)}
isHasRightItem isHasRightItem
isRightColor={item.is_down_vote} isRightColor={item.is_down_vote}
rightText={value} rightText={value}