Skip to content

Commit

Permalink
show user profile on avatar and name click
Browse files Browse the repository at this point in the history
  • Loading branch information
luacmartins committed Jul 8, 2021
1 parent ac0f038 commit 7729fc0
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions src/pages/home/report/ReportActionItemSingle.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import {View} from 'react-native';
import {View, Pressable} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import PropTypes from 'prop-types';
import _ from 'underscore';
Expand All @@ -14,6 +14,8 @@ import ONYXKEYS from '../../../ONYXKEYS';
import personalDetailsPropType from '../../personalDetailsPropType';
import compose from '../../../libs/compose';
import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize';
import Navigation from '../../../libs/Navigation/Navigation';
import ROUTES from '../../../ROUTES';

const propTypes = {
/** All the data of the action */
Expand Down Expand Up @@ -56,24 +58,33 @@ const ReportActionItemSingle = ({
const personArray = displayName
? [{type: 'TEXT', text: Str.isSMSLogin(login) ? toLocalPhone(displayName) : displayName}]
: action.person;

const showUserDetails = (email) => {
Navigation.navigate(`${ROUTES.DETAILS}/${email}`);
};

return (
<View style={wrapperStyles}>
<Avatar
imageStyles={[styles.actionAvatar]}
source={avatarUrl}
/>
<Pressable onPress={() => showUserDetails(action.actorEmail)}>
<Avatar
imageStyles={[styles.actionAvatar]}
source={avatarUrl}
/>
</Pressable>
<View style={[styles.chatItemRight]}>
<View style={[styles.chatItemMessageHeader]}>
{_.map(personArray, (fragment, index) => (
<ReportActionItemFragment
key={`person-${action.sequenceNumber}-${index}`}
fragment={fragment}
tooltipText={action.actorEmail}
isAttachment={action.isAttachment}
isLoading={action.loading}
isSingleLine
/>
))}
<Pressable onPress={() => showUserDetails(action.actorEmail)}>
{_.map(personArray, (fragment, index) => (
<ReportActionItemFragment
key={`person-${action.sequenceNumber}-${index}`}
fragment={fragment}
tooltipText={action.actorEmail}
isAttachment={action.isAttachment}
isLoading={action.loading}
isSingleLine
/>
))}
</Pressable>
<ReportActionItemDate timestamp={action.timestamp} />
</View>
{children}
Expand Down

0 comments on commit 7729fc0

Please sign in to comment.