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