Merge pull request #1477 from esteemapp/mmore

More fixes
This commit is contained in:
Feruz M 2020-01-11 20:11:48 +02:00 committed by GitHub
commit 9b2bcae4e4
11 changed files with 83 additions and 99 deletions

View File

@ -113,7 +113,7 @@ const CommentsView = ({
<ActionSheet
ref={commentMenu}
options={menuItems}
title={get(selectedComment, 'summary')}
title={get(selectedComment, 'author')}
cancelButtonIndex={isOwnProfile ? 2 : 1}
onPress={index => handleOnPressCommentMenu(index, selectedComment)}
/>

View File

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

View File

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

View File

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

View File

@ -215,9 +215,9 @@ class PostDropdownContainer extends PureComponent {
} = this.props;
let _OPTIONS = OPTIONS;
if ((content && content.author === name) || get(content, 'reblogged_by[0]', null) === name) {
/*if ((content && content.author === name) || get(content, 'reblogged_by[0]', null) === name) {
_OPTIONS = OPTIONS.filter(item => item !== 'reblog');
}
}*/
return (
<Fragment>

View File

@ -216,7 +216,6 @@ const CommentBody = ({
a {
color: ${EStyleSheet.value('$primaryBlue')};
cursor: pointer;
margin-right: 5;
}
img {
align-self: 'center';
@ -279,7 +278,10 @@ const CommentBody = ({
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
}
b > * {
display: inline-block;
margin: 2 10;
}
iframe {
width: 100%;
height: 240px;
@ -328,8 +330,8 @@ const CommentBody = ({
html: html,
}}
allowsFullscreenVideo={true}
customStyle={customStyle}
style={{ width: WIDTH - (32 + 34 * commentDepth) }}
customStyle={customStyle}
onMessage={__handleOnLinkPress}
renderLoading={() => <CommentPlaceHolder />}
customScript={script.toString()}

View File

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

View File

@ -1,4 +1,4 @@
import React, { Component, Fragment } from 'react';
import React, { useRef, Fragment } from 'react';
import ActionSheet from 'react-native-actionsheet';
import { View, Text, TouchableOpacity } from 'react-native';
import { injectIntl } from 'react-intl';
@ -17,87 +17,73 @@ import DEFAULT_IMAGE from '../../../assets/no_image.png';
// Styles
import styles from './postListItemStyles';
class PostListItemView extends Component {
/* Props
* ------------------------------------------------
* @prop { type } name - Description....
*/
constructor(props) {
super(props);
this.state = {};
}
const PostListItemView = ({
title,
mainTag,
username,
reputation,
created,
image,
handleOnPressItem,
handleOnRemoveItem,
id,
intl,
isFormatedDate,
}) => {
const actionSheet = useRef(null);
// Component Life Cycles
// Component Functions
render() {
const {
title,
summary,
mainTag,
username,
reputation,
created,
image,
handleOnPressItem,
handleOnRemoveItem,
id,
intl,
isFormatedDate,
} = this.props;
return (
<Fragment>
<View style={styles.container}>
<View style={styles.header}>
<PostHeaderDescription
date={isFormatedDate ? created : getTimeFromNow(created, true)}
name={username}
reputation={reputation}
size={36}
tag={mainTag}
/>
<IconButton
backgroundColor="transparent"
name="delete"
iconType="MaterialIcons"
size={20}
onPress={() => this.ActionSheet.show()}
style={[styles.rightItem]}
color="#c1c5c7"
/>
</View>
<View style={styles.body}>
<TouchableOpacity onPress={() => handleOnPressItem(id)}>
<FastImage source={image} style={styles.image} defaultSource={DEFAULT_IMAGE} />
<View style={[styles.postDescripton]}>
<Text style={styles.title}>{title}</Text>
<Text style={styles.summary}>{summary}</Text>
</View>
</TouchableOpacity>
</View>
return (
<Fragment>
<View style={styles.container}>
<View style={styles.header}>
<PostHeaderDescription
date={isFormatedDate ? created : getTimeFromNow(created, true)}
name={username}
reputation={reputation}
size={36}
tag={mainTag}
/>
<IconButton
backgroundColor="transparent"
name="delete"
iconType="MaterialIcons"
size={20}
onPress={() => actionSheet.current.show()}
style={[styles.rightItem]}
color="#c1c5c7"
/>
</View>
<View style={styles.body}>
<TouchableOpacity onPress={() => handleOnPressItem(id)}>
<FastImage source={image} style={styles.image} defaultSource={DEFAULT_IMAGE} />
<View style={[styles.postDescripton]}>
<Text style={styles.title}>{title}</Text>
</View>
</TouchableOpacity>
</View>
</View>
<ActionSheet
ref={o => (this.ActionSheet = o)}
options={[
intl.formatMessage({ id: 'alert.delete' }),
intl.formatMessage({ id: 'alert.cancel' }),
]}
title={intl.formatMessage({ id: 'alert.remove_alert' })}
cancelButtonIndex={1}
destructiveButtonIndex={0}
onPress={index => {
if (index === 0) {
handleOnRemoveItem(id);
}
}}
/>
</Fragment>
);
}
}
<ActionSheet
ref={actionSheet}
options={[
intl.formatMessage({ id: 'alert.delete' }),
intl.formatMessage({ id: 'alert.cancel' }),
]}
title={intl.formatMessage({ id: 'alert.remove_alert' })}
cancelButtonIndex={1}
destructiveButtonIndex={0}
onPress={index => {
if (index === 0) {
handleOnRemoveItem(id);
}
}}
/>
</Fragment>
);
};
export default injectIntl(PostListItemView);

View File

@ -108,7 +108,13 @@ const stackNavigator = createStackNavigator(
[ROUTES.DRAWER.MAIN]: { screen: mainNavigation },
[ROUTES.SCREENS.PROFILE]: { screen: Profile },
[ROUTES.SCREENS.PROFILE_EDIT]: { screen: ProfileEdit },
[ROUTES.SCREENS.POST]: { screen: Post },
[ROUTES.SCREENS.POST]: {
screen: Post,
navigationOptions: {
gesturesEnabled: true,
gestureResponseDistance: { horizontal: 100 },
},
},
[ROUTES.SCREENS.EDITOR]: { screen: Editor },
[ROUTES.SCREENS.VOTERS]: { screen: Voters },
[ROUTES.SCREENS.FOLLOWS]: { screen: Follows },
@ -122,7 +128,9 @@ const stackNavigator = createStackNavigator(
[ROUTES.SCREENS.REBLOGS]: { screen: Reblogs },
[ROUTES.SCREENS.SPIN_GAME]: { screen: SpinGame },
},
{ headerMode: 'none' },
{
headerMode: 'none',
},
);
export default createSwitchNavigator({

View File

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

View File

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