-
Notifications
You must be signed in to change notification settings - Fork 3k
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 feature to view Profile Picture in full screen #8483
Changes from 4 commits
3b49343
7fb0b2a
d74a1e8
5f24f5d
f8852d8
e91b09a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import _ from 'underscore'; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import AttachmentModal from './AttachmentModal'; | ||
import withLocalize, {withLocalizePropTypes} from './withLocalize'; | ||
|
||
const propTypes = { | ||
/** Determines title of the modal header depending on if we are viewing a profile picture or not */ | ||
isProfilePicture: PropTypes.bool, | ||
|
||
/** DisplayName to be used as headerTitle if isProfilePicture is true. */ | ||
displayName: PropTypes.string, | ||
|
||
...withLocalizePropTypes, | ||
}; | ||
|
||
const defaultProps = { | ||
isProfilePicture: false, | ||
displayName: null, | ||
}; | ||
|
||
const PreviewAttachmentModal = (props) => { | ||
const propsToPass = _.omit(props, 'displayName', 'isProfilePicture'); | ||
return ( | ||
<AttachmentModal | ||
headerTitle={props.isProfilePicture ? props.displayName : props.translate('common.attachment')} | ||
allowDownload={!props.isProfilePicture} | ||
/* eslint-disable-next-line react/jsx-props-no-spreading */ | ||
{...propsToPass} | ||
/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets remove this component and directly use |
||
); | ||
}; | ||
|
||
PreviewAttachmentModal.propTypes = propTypes; | ||
PreviewAttachmentModal.defaultProps = defaultProps; | ||
PreviewAttachmentModal.displayName = 'PreviewAttachmentModal'; | ||
export default withLocalize(PreviewAttachmentModal); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
import AttachmentModal from './AttachmentModal'; | ||
import withLocalize, {withLocalizePropTypes} from './withLocalize'; | ||
|
||
const propTypes = { | ||
...withLocalizePropTypes, | ||
}; | ||
|
||
const UploadAttachmentModal = props => ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets remove this component and directly use These components are not adding much value. |
||
<AttachmentModal | ||
headerTitle={props.translate('reportActionCompose.sendAttachment')} | ||
/* eslint-disable-next-line react/jsx-props-no-spreading */ | ||
{...props} | ||
/> | ||
); | ||
|
||
UploadAttachmentModal.propTypes = propTypes; | ||
UploadAttachmentModal.displayName = 'UploadAttachmentModal'; | ||
export default withLocalize(UploadAttachmentModal); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,6 +99,7 @@ function formatPersonalDetails(personalDetailsList) { | |
const lastName = details.lastName || ''; | ||
const payPalMeAddress = details.expensify_payPalMeAddress || ''; | ||
const phoneNumber = details.phoneNumber || ''; | ||
const avatarHighResolution = details.avatar || details.avatarThumbnail; | ||
formattedResult[sanitizedLogin] = { | ||
login: sanitizedLogin, | ||
avatar, | ||
|
@@ -109,6 +110,7 @@ function formatPersonalDetails(personalDetailsList) { | |
timezone, | ||
payPalMeAddress, | ||
phoneNumber, | ||
avatarHighResolution, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be better to use the Now use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@parasharrajat Do we want to do this change here? This might require massive code refactoring. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was expecting it to be done here because of the keys. But I don't mind another PR doing that. At last, I am fine with this as well if @Julesssss is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I think that's okay. |
||
}; | ||
}); | ||
Timing.end(CONST.TIMING.PERSONAL_DETAILS_FORMATTED); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ import * as ReportUtils from '../libs/reportUtils'; | |
import DateUtils from '../libs/DateUtils'; | ||
import * as Expensicons from '../components/Icon/Expensicons'; | ||
import MenuItem from '../components/MenuItem'; | ||
import PreviewAttachmentModal from '../components/PreviewAttachmentModal'; | ||
import PressableWithoutFocus from '../components/PressableWithoutFocus'; | ||
import * as Report from '../libs/actions/Report'; | ||
|
||
const matchType = PropTypes.shape({ | ||
|
@@ -98,11 +100,25 @@ const DetailsPage = (props) => { | |
{details ? ( | ||
<ScrollView> | ||
<View style={styles.pageWrapper}> | ||
<Avatar | ||
containerStyles={[styles.avatarLarge, styles.mb3]} | ||
imageStyles={[styles.avatarLarge]} | ||
source={details.avatar} | ||
/> | ||
<PreviewAttachmentModal | ||
sourceURL={details.avatarHighResolution} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't we do that directly here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of this directly use |
||
isAuthTokenRequired | ||
displayName={isSMSLogin ? props.toLocalPhone(details.displayName) : details.displayName} | ||
isProfilePicture | ||
> | ||
{({show}) => ( | ||
<PressableWithoutFocus | ||
style={styles.noOutline} | ||
onPress={show} | ||
> | ||
<Avatar | ||
containerStyles={[styles.avatarLarge, styles.mb3]} | ||
imageStyles={[styles.avatarLarge]} | ||
source={details.avatar} | ||
/> | ||
</PressableWithoutFocus> | ||
)} | ||
</PreviewAttachmentModal> | ||
{details.displayName && ( | ||
<Text style={[styles.displayName, styles.mb6]} numberOfLines={1}> | ||
{isSMSLogin ? props.toLocalPhone(details.displayName) : details.displayName} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be like this.