mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-11-24 00:46:27 +03:00
commit
7f03993892
@ -34,13 +34,15 @@ class PostDisplayContainer extends Component {
|
||||
|
||||
// Component Functions
|
||||
_handleOnVotersPress = (activeVotes) => {
|
||||
const { navigation } = this.props;
|
||||
const { navigation, post } = this.props;
|
||||
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.VOTERS,
|
||||
params: {
|
||||
activeVotes,
|
||||
},
|
||||
// TODO: make unic
|
||||
key: post.permlink + Math.random(),
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import { withNavigation } from 'react-navigation';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
// Services and Actions
|
||||
import { search } from '../../../providers/esteem/esteem';
|
||||
@ -45,6 +46,7 @@ class SearchModalContainer extends PureComponent {
|
||||
const users = res.map(item => ({
|
||||
image: `https://steemitimages.com/u/${item}/avatar/small`,
|
||||
text: item,
|
||||
...item,
|
||||
}));
|
||||
this.setState({ searchResults: { type: 'user', data: users } });
|
||||
});
|
||||
@ -52,6 +54,7 @@ class SearchModalContainer extends PureComponent {
|
||||
getTrendingTags(text.substr(1)).then((res) => {
|
||||
const tags = res.map(item => ({
|
||||
text: `#${item.name}`,
|
||||
...item,
|
||||
}));
|
||||
|
||||
this.setState({ searchResults: { type: 'tag', data: tags } });
|
||||
@ -63,6 +66,7 @@ class SearchModalContainer extends PureComponent {
|
||||
.map(item => ({
|
||||
image: item.img_url || `https://steemitimages.com/u/${item.author}/avatar/small`,
|
||||
text: item.title,
|
||||
...item,
|
||||
}));
|
||||
this.setState({ searchResults: { type: 'content', data: res.results } });
|
||||
});
|
||||
@ -71,7 +75,7 @@ class SearchModalContainer extends PureComponent {
|
||||
};
|
||||
|
||||
_handleOnPressListItem = (type, item) => {
|
||||
const { navigation, handleOnClose } = this.props;
|
||||
const { navigation, handleOnClose, username } = this.props;
|
||||
let routeName = null;
|
||||
let params = null;
|
||||
let key = null;
|
||||
@ -81,7 +85,7 @@ class SearchModalContainer extends PureComponent {
|
||||
|
||||
switch (type) {
|
||||
case 'user':
|
||||
routeName = ROUTES.SCREENS.PROFILE;
|
||||
routeName = item.text === username ? ROUTES.TABBAR.PROFILE : ROUTES.SCREENS.PROFILE;
|
||||
params = {
|
||||
username: item.text,
|
||||
};
|
||||
@ -118,6 +122,7 @@ class SearchModalContainer extends PureComponent {
|
||||
render() {
|
||||
const { searchResults } = this.state;
|
||||
const { handleOnClose, isOpen, placeholder } = this.props;
|
||||
|
||||
return (
|
||||
<SearchModalView
|
||||
searchResults={searchResults}
|
||||
@ -132,4 +137,8 @@ class SearchModalContainer extends PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
export default withNavigation(SearchModalContainer);
|
||||
const mapStateToProps = state => ({
|
||||
username: state.account.currentAccount.name,
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(withNavigation(SearchModalContainer));
|
||||
|
@ -67,7 +67,7 @@ export default EStyleSheet.create({
|
||||
borderColor: '$primaryGray',
|
||||
},
|
||||
searchItemText: {
|
||||
color: '$white',
|
||||
color: '$pureWhite',
|
||||
marginLeft: 10,
|
||||
},
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import {
|
||||
View, Text, FlatList, TouchableHighlight, SafeAreaView,
|
||||
View, Text, FlatList, TouchableOpacity, SafeAreaView,
|
||||
} from 'react-native';
|
||||
|
||||
import FastImage from 'react-native-fast-image';
|
||||
@ -58,7 +58,8 @@ class SearchModalView extends PureComponent {
|
||||
data={searchResults.data}
|
||||
showsVerticalScrollIndicator={false}
|
||||
renderItem={({ item }) => (
|
||||
<TouchableHighlight onPress={() => handleOnPressListItem(searchResults.type, item)}>
|
||||
// TODO: Make it quick ui component
|
||||
<TouchableOpacity onPress={() => handleOnPressListItem(searchResults.type, item)}>
|
||||
<View style={styles.searhItems}>
|
||||
<View style={styles.searchItemImageWrapper}>
|
||||
{item.image && (
|
||||
@ -74,7 +75,7 @@ class SearchModalView extends PureComponent {
|
||||
{item.text && <Text style={styles.searchItemText}>{item.text}</Text>}
|
||||
</View>
|
||||
</View>
|
||||
</TouchableHighlight>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
keyExtractor={(post, index) => index.toString()}
|
||||
removeClippedSubviews
|
||||
|
@ -1,4 +1,8 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import { withNavigation } from 'react-navigation';
|
||||
|
||||
// Constants
|
||||
import ROUTES from '../../../constants/routeNames';
|
||||
|
||||
// Component
|
||||
import VotersDisplayView from '../view/votersDisplayView';
|
||||
@ -15,11 +19,23 @@ class VotersDisplayContainer extends PureComponent {
|
||||
this.state = {};
|
||||
}
|
||||
|
||||
_handleOnUserPress = (username) => {
|
||||
const { navigation } = this.props;
|
||||
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.PROFILE,
|
||||
params: {
|
||||
username,
|
||||
},
|
||||
key: username,
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
const { votes } = this.props;
|
||||
|
||||
return <VotersDisplayView votes={votes} />;
|
||||
return <VotersDisplayView handleOnUserPress={this._handleOnUserPress} votes={votes} />;
|
||||
}
|
||||
}
|
||||
|
||||
export default VotersDisplayContainer;
|
||||
export default withNavigation(VotersDisplayContainer);
|
||||
|
@ -19,7 +19,7 @@ class VotersDisplayView extends PureComponent {
|
||||
|
||||
// Component Functions
|
||||
_renderItem = (item, index) => {
|
||||
const { intl } = this.props;
|
||||
const { handleOnUserPress } = this.props;
|
||||
const value = `$ ${item.value}`;
|
||||
const percent = `${item.percent}%`;
|
||||
|
||||
@ -27,11 +27,12 @@ class VotersDisplayView extends PureComponent {
|
||||
<UserListItem
|
||||
index={index}
|
||||
username={item.voter}
|
||||
// description={intl.formatRelative(item.time)}
|
||||
description={getTimeFromNow(item.time)}
|
||||
isHasRightItem
|
||||
isRightColor={item.is_down_vote}
|
||||
rightText={value}
|
||||
handleOnPress={() => handleOnUserPress(item.voter)}
|
||||
isClickable
|
||||
subRightText={percent}
|
||||
/>
|
||||
);
|
||||
|
@ -3,7 +3,7 @@ import { default as ROUTES } from './routeNames';
|
||||
const authMenuItems = [
|
||||
{
|
||||
name: 'Profile',
|
||||
route: 'ProfileTabbar',
|
||||
route: ROUTES.TABBAR.PROFILE,
|
||||
icon: 'perm-identity',
|
||||
id: 'profile',
|
||||
},
|
||||
|
@ -31,10 +31,8 @@ class NotificationContainer extends Component {
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (nextProps.activeBottomTab === ROUTES.TABBAR.NOTIFICATION) {
|
||||
if (nextProps.username) {
|
||||
this._getAvtivities();
|
||||
}
|
||||
if (nextProps.activeBottomTab === ROUTES.TABBAR.NOTIFICATION && nextProps.username) {
|
||||
this._getAvtivities();
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,30 +58,37 @@ class NotificationContainer extends Component {
|
||||
|
||||
_navigateToNotificationRoute = (data) => {
|
||||
const { navigation, username, dispatch } = this.props;
|
||||
|
||||
let routeName;
|
||||
let params;
|
||||
let key;
|
||||
markActivityAsRead(username, data.id).then((result) => {
|
||||
dispatch(updateUnreadActivityCount(result.unread));
|
||||
});
|
||||
|
||||
if (data.permlink) {
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.POST,
|
||||
params: {
|
||||
author: data.author,
|
||||
permlink: data.permlink,
|
||||
isHasParentPost: data.parent_author && data.parent_permlink,
|
||||
},
|
||||
key: data.permlink,
|
||||
});
|
||||
} else {
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.PROFILE,
|
||||
params: {
|
||||
username: data.follower,
|
||||
},
|
||||
key: data.follower,
|
||||
});
|
||||
routeName = ROUTES.SCREENS.POST;
|
||||
key = data.permlink;
|
||||
params = {
|
||||
author: data.author,
|
||||
permlink: data.permlink,
|
||||
isHasParentPost: data.parent_author && data.parent_permlink,
|
||||
};
|
||||
} else if (data.type === 'follow') {
|
||||
routeName = ROUTES.SCREENS.PROFILE;
|
||||
key = data.follower;
|
||||
params = {
|
||||
username: data.follower,
|
||||
};
|
||||
} else if (data.type === 'transfer') {
|
||||
routeName = ROUTES.TABBAR.PROFILE;
|
||||
params = { isWalletTab: true };
|
||||
}
|
||||
|
||||
navigation.navigate({
|
||||
routeName,
|
||||
params,
|
||||
key,
|
||||
});
|
||||
};
|
||||
|
||||
_readAllNotification = () => {
|
||||
|
Loading…
Reference in New Issue
Block a user