revert post summary

This commit is contained in:
feruz 2020-01-12 04:41:13 +02:00
parent 35450168c2
commit 16576aa25d
8 changed files with 20 additions and 3 deletions

View File

@ -2,7 +2,6 @@ import React from 'react';
import { View, Text, TouchableOpacity } from 'react-native'; import { View, Text, TouchableOpacity } from 'react-native';
import { withNavigation } from 'react-navigation'; import { withNavigation } from 'react-navigation';
import get from 'lodash/get'; import get from 'lodash/get';
import { postBodySummary } from '@esteemapp/esteem-render-helpers';
import { default as ROUTES } from '../../../constants/routeNames'; import { default as ROUTES } from '../../../constants/routeNames';
import styles from './parentPostStyles'; import styles from './parentPostStyles';
@ -26,7 +25,7 @@ const ParentPost = props => {
} }
> >
<Text style={styles.title}>{get(post, 'title')}</Text> <Text style={styles.title}>{get(post, 'title')}</Text>
<Text style={styles.description}>{postBodySummary(post, 100)}</Text> <Text style={styles.description}>{get(post, 'summary')}</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
); );

View File

@ -51,6 +51,10 @@ export default EStyleSheet.create({
marginVertical: 12, marginVertical: 12,
color: '$primaryBlack', color: '$primaryBlack',
}, },
summary: {
fontSize: 13,
color: '$primaryDarkGray',
},
bodyFooter: { bodyFooter: {
backgroundColor: '$primaryBackgroundColor', backgroundColor: '$primaryBackgroundColor',
flexDirection: 'row', flexDirection: 'row',

View File

@ -117,6 +117,7 @@ class PostCardView extends Component {
)} )}
<View style={[styles.postDescripton]}> <View style={[styles.postDescripton]}>
<Text style={styles.title}>{content.title}</Text> <Text style={styles.title}>{content.title}</Text>
<Text style={styles.summary}>{content.summary}</Text>
</View> </View>
</TouchableOpacity> </TouchableOpacity>

View File

@ -39,6 +39,10 @@ export default EStyleSheet.create({
fontWeight: 'bold', fontWeight: 'bold',
color: '$primaryBlack', color: '$primaryBlack',
}, },
summary: {
fontSize: 13,
color: '$primaryDarkText',
},
header: { header: {
backgroundColor: '$primaryBackgroundColor', backgroundColor: '$primaryBackgroundColor',
flexDirection: 'row', flexDirection: 'row',

View File

@ -19,6 +19,7 @@ import styles from './postListItemStyles';
const PostListItemView = ({ const PostListItemView = ({
title, title,
summary,
mainTag, mainTag,
username, username,
reputation, reputation,
@ -62,6 +63,7 @@ const PostListItemView = ({
<FastImage source={image} style={styles.image} defaultSource={DEFAULT_IMAGE} /> <FastImage source={image} style={styles.image} defaultSource={DEFAULT_IMAGE} />
<View style={[styles.postDescripton]}> <View style={[styles.postDescripton]}>
<Text style={styles.title}>{title}</Text> <Text style={styles.title}>{title}</Text>
<Text style={styles.summary}>{summary}</Text>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
</View> </View>

View File

@ -516,6 +516,9 @@ class ApplicationContainer extends Component {
dispatch(updateActiveBottomTab(ROUTES.TABBAR.NOTIFICATION)); dispatch(updateActiveBottomTab(ROUTES.TABBAR.NOTIFICATION));
} }
}; };
ws.onclose = e => {
console.log(e);
};
}; };
_logout = () => { _logout = () => {

View File

@ -5,6 +5,7 @@ import ScrollableTabView from 'react-native-scrollable-tab-view';
import ActionSheet from 'react-native-actionsheet'; import ActionSheet from 'react-native-actionsheet';
// Utils // Utils
import { postBodySummary } from '@esteemapp/esteem-render-helpers';
import { catchDraftImage } from '../../../utils/image'; import { catchDraftImage } from '../../../utils/image';
import { getFormatedCreatedDate } from '../../../utils/time'; import { getFormatedCreatedDate } from '../../../utils/time';
@ -46,6 +47,7 @@ const DraftsScreen = ({
const tags = item.tags ? item.tags.split(/[ ,]+/) : []; const tags = item.tags ? item.tags.split(/[ ,]+/) : [];
const tag = tags[0] || ''; const tag = tags[0] || '';
const image = catchDraftImage(item.body); const image = catchDraftImage(item.body);
const summary = postBodySummary({ item, last_update: item.created }, 100);
const isSchedules = type === 'schedules'; const isSchedules = type === 'schedules';
return ( return (
@ -53,6 +55,7 @@ const DraftsScreen = ({
created={isSchedules ? getFormatedCreatedDate(item.schedule) : item.created} created={isSchedules ? getFormatedCreatedDate(item.schedule) : item.created}
mainTag={tag} mainTag={tag}
title={item.title} title={item.title}
summary={summary}
isFormatedDate={isSchedules} isFormatedDate={isSchedules}
image={image ? { uri: catchDraftImage(item.body) } : null} image={image ? { uri: catchDraftImage(item.body) } : null}
username={currentAccount.name} username={currentAccount.name}

View File

@ -2,7 +2,7 @@ import isEmpty from 'lodash/isEmpty';
import forEach from 'lodash/forEach'; import forEach from 'lodash/forEach';
import { get, uniqBy } from 'lodash'; import { get, uniqBy } from 'lodash';
import { renderPostBody } from '@esteemapp/esteem-render-helpers'; import { postBodySummary, renderPostBody } from '@esteemapp/esteem-render-helpers';
// Dsteem // Dsteem
// eslint-disable-next-line import/no-cycle // eslint-disable-next-line import/no-cycle
@ -44,6 +44,7 @@ export const parsePost = async (post, currentUserName, isPromoted) => {
post.active_votes.sort((a, b) => b.rshares - a.rshares); post.active_votes.sort((a, b) => b.rshares - a.rshares);
post.body = renderPostBody(post); post.body = renderPostBody(post);
post.summary = postBodySummary(post, 150);
post.is_declined_payout = Number(parseFloat(post.max_accepted_payout)) === 0; post.is_declined_payout = Number(parseFloat(post.max_accepted_payout)) === 0;
if (currentUserName) { if (currentUserName) {