// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import ProfilePicture from 'components/profile_picture.jsx'; import UserStore from 'stores/user_store.jsx'; import * as Utils from 'utils/utils.jsx'; import {Client4} from 'mattermost-redux/client'; import PropTypes from 'prop-types'; import React from 'react'; import {FormattedHTMLMessage} from 'react-intl'; export default function UserListRow({user, extraInfo, actions, actionProps, actionUserProps, userCount}) { const displayName = Utils.displayUsernameForUser(user); let name = `${displayName} (@${user.username})`; if (displayName === user.username) { name = user.username; } let buttons = null; if (actions) { buttons = actions.map((Action, index) => { return ( ); }); } // QUICK HACK, NEEDS A PROP FOR TOGGLING STATUS let email = user.email; let emailStyle = 'more-modal__description'; let status; if (extraInfo && extraInfo.length > 0) { email = ( ); emailStyle = ''; } else if (user.status) { status = user.status; } else { status = UserStore.getStatus(user.id); } let userCountID = null; let userCountEmail = null; if (userCount >= 0) { userCountID = Utils.createSafeId('userListRowName' + userCount); userCountEmail = Utils.createSafeId('userListRowEmail' + userCount); } return (
{name}
{email}
{extraInfo}
{buttons}
); } UserListRow.defaultProps = { extraInfo: [], actions: [], actionProps: {}, actionUserProps: {} }; UserListRow.propTypes = { user: PropTypes.object.isRequired, extraInfo: PropTypes.arrayOf(PropTypes.object), actions: PropTypes.arrayOf(PropTypes.func), actionProps: PropTypes.object, actionUserProps: PropTypes.object, userCount: PropTypes.number };