Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add profile details to avatar and names #3912

Merged
merged 2 commits into from
Jul 9, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}`);
};

luacmartins marked this conversation as resolved.
Show resolved Hide resolved
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