mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-18 02:41:39 +03:00
integrated quick profile modal with all post headers and notification avatar
This commit is contained in:
parent
ef084fb7cf
commit
37307c53ad
@ -188,6 +188,7 @@ class NotificationView extends PureComponent {
|
||||
<NotificationLine
|
||||
notification={item}
|
||||
handleOnPressNotification={this.props.navigateToNotificationRoute}
|
||||
handleOnUserPress={()=>{this.props.handleOnUserPress(item.source)}}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* eslint-disable react/jsx-one-expression-per-line */
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { View, Text, Image, TouchableHighlight } from 'react-native';
|
||||
import { View, Text, Image, TouchableHighlight, TouchableOpacity } from 'react-native';
|
||||
import { useIntl } from 'react-intl';
|
||||
import get from 'lodash/get';
|
||||
|
||||
@ -10,7 +10,7 @@ import { UserAvatar } from '../../userAvatar';
|
||||
// Styles
|
||||
import styles from './notificationLineStyles';
|
||||
|
||||
const NotificationLineView = ({ notification, handleOnPressNotification }) => {
|
||||
const NotificationLineView = ({ notification, handleOnPressNotification, handleOnUserPress }) => {
|
||||
const [isRead, setIsRead] = useState(notification.read);
|
||||
const intl = useIntl();
|
||||
let _title;
|
||||
@ -58,10 +58,14 @@ const NotificationLineView = ({ notification, handleOnPressNotification }) => {
|
||||
key={`${get(notification, 'id')}${_title}`}
|
||||
style={[styles.notificationWrapper, !isRead && styles.isNewNotification]}
|
||||
>
|
||||
<UserAvatar
|
||||
username={notification.source}
|
||||
style={[styles.avatar, !notification.avatar && styles.hasNoAvatar]}
|
||||
/>
|
||||
<TouchableOpacity onPress={handleOnUserPress}>
|
||||
<UserAvatar
|
||||
noAction={true}
|
||||
username={notification.source}
|
||||
style={[styles.avatar, !notification.avatar && styles.hasNoAvatar]}
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
|
||||
<View style={styles.body}>
|
||||
<View style={styles.titleWrapper}>
|
||||
<Text style={styles.name}>{notification.source} </Text>
|
||||
|
@ -80,25 +80,7 @@ const PostCardContainer = ({
|
||||
const _handleOnUserPress = (username) => {
|
||||
if (_content) {
|
||||
username = username || get(_content, 'author');
|
||||
// let params = {
|
||||
// username: username || get(_content, 'author'),
|
||||
// reputation: !username && get(_content, 'author_reputation'),
|
||||
// };
|
||||
|
||||
dispatch(showProfileModal(username));
|
||||
|
||||
// if (
|
||||
// get(currentAccount, 'name') === params.username &&
|
||||
// (pageType === 'main' || pageType === 'ownProfile')
|
||||
// ) {
|
||||
// navigation.navigate(ROUTES.TABBAR.PROFILE);
|
||||
// } else {
|
||||
// navigation.navigate({
|
||||
// routeName: ROUTES.SCREENS.PROFILE,
|
||||
// params,
|
||||
// key: get(_content, 'author'),
|
||||
// });
|
||||
// }
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import { View, Text, TouchableOpacity } from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { withNavigation } from 'react-navigation';
|
||||
import { injectIntl } from 'react-intl';
|
||||
|
||||
@ -12,6 +13,7 @@ import styles from './postHeaderDescriptionStyles';
|
||||
|
||||
import { default as ROUTES } from '../../../../constants/routeNames';
|
||||
import { IconButton } from '../../..';
|
||||
import { showProfileModal } from '../../../../redux/actions/uiAction';
|
||||
|
||||
// Constants
|
||||
const DEFAULT_IMAGE = require('../../../../assets/ecency.png');
|
||||
@ -21,19 +23,12 @@ class PostHeaderDescription extends PureComponent {
|
||||
|
||||
// Component Functions
|
||||
_handleOnUserPress = (username) => {
|
||||
const { navigation, profileOnPress, reputation } = this.props;
|
||||
const { profileOnPress, dispatch } = this.props;
|
||||
|
||||
if (profileOnPress) {
|
||||
profileOnPress(username);
|
||||
} else {
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.PROFILE,
|
||||
params: {
|
||||
username,
|
||||
reputation,
|
||||
},
|
||||
key: username,
|
||||
});
|
||||
dispatch(showProfileModal(username));
|
||||
}
|
||||
};
|
||||
|
||||
@ -181,4 +176,6 @@ class PostHeaderDescription extends PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
export default withNavigation(injectIntl(PostHeaderDescription));
|
||||
const mapStateToProps = () => ({});
|
||||
|
||||
export default connect(mapStateToProps)(withNavigation(injectIntl(PostHeaderDescription)));
|
||||
|
@ -15,6 +15,7 @@ import ROUTES from '../../../constants/routeNames';
|
||||
|
||||
// Components
|
||||
import NotificationScreen from '../screen/notificationScreen';
|
||||
import { showProfileModal } from '../../../redux/actions/uiAction';
|
||||
|
||||
class NotificationContainer extends Component {
|
||||
constructor(props) {
|
||||
@ -118,6 +119,11 @@ class NotificationContainer extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
_handleOnUserPress = (username) => {
|
||||
const { dispatch } = this.props;
|
||||
dispatch(showProfileModal(username));
|
||||
};
|
||||
|
||||
_readAllNotification = () => {
|
||||
const { dispatch, intl, isConnected } = this.props;
|
||||
const { notifications } = this.state;
|
||||
@ -174,6 +180,7 @@ class NotificationContainer extends Component {
|
||||
getActivities={this._getActivities}
|
||||
notifications={notifications}
|
||||
navigateToNotificationRoute={this._navigateToNotificationRoute}
|
||||
handleOnUserPress={this._handleOnUserPress}
|
||||
readAllNotification={this._readAllNotification}
|
||||
handleLoginPress={this._handleOnPressLogin}
|
||||
isNotificationRefreshing={isRefreshing}
|
||||
|
@ -16,6 +16,7 @@ const NotificationScreen = ({
|
||||
getActivities,
|
||||
intl,
|
||||
navigateToNotificationRoute,
|
||||
handleOnUserPress,
|
||||
readAllNotification,
|
||||
isNotificationRefreshing,
|
||||
changeSelectedFilter,
|
||||
@ -42,6 +43,7 @@ const NotificationScreen = ({
|
||||
getActivities={getActivities}
|
||||
notifications={notifications}
|
||||
navigateToNotificationRoute={navigateToNotificationRoute}
|
||||
handleOnUserPress={handleOnUserPress}
|
||||
readAllNotification={readAllNotification}
|
||||
isNotificationRefreshing={isNotificationRefreshing}
|
||||
changeSelectedFilter={changeSelectedFilter}
|
||||
|
Loading…
Reference in New Issue
Block a user