diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-03-16 18:16:11 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-03-16 18:16:11 -0400 |
commit | 4a4859351a4cd277f94d3faa804daaad0733b270 (patch) | |
tree | 4e7f83d3e2564b9b89d669e9f7905ff11768b11a /webapp/components/user_list_row.jsx | |
parent | 29fe6a3d13c9c7aa490fffebbe5d1b5fdf1e3090 (diff) | |
parent | 12896bd23eeba79884245c1c29fdc568cf21a7fa (diff) | |
download | chat-4a4859351a4cd277f94d3faa804daaad0733b270.tar.gz chat-4a4859351a4cd277f94d3faa804daaad0733b270.tar.bz2 chat-4a4859351a4cd277f94d3faa804daaad0733b270.zip |
Merge pull request #2453 from mattermost/plt-2340
PLT-2340 Converting to Webpack. Stage 1.
Diffstat (limited to 'webapp/components/user_list_row.jsx')
-rw-r--r-- | webapp/components/user_list_row.jsx | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/webapp/components/user_list_row.jsx b/webapp/components/user_list_row.jsx new file mode 100644 index 000000000..ed3a29a61 --- /dev/null +++ b/webapp/components/user_list_row.jsx @@ -0,0 +1,65 @@ +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import Constants from 'utils/constants.jsx'; +import PreferenceStore from 'stores/preference_store.jsx'; +import * as Utils from 'utils/utils.jsx'; +import React from 'react'; + +export default function UserListRow({user, actions}) { + const nameFormat = PreferenceStore.get(Constants.Preferences.CATEGORY_DISPLAY_SETTINGS, 'name_format', ''); + + let name = user.username; + if (user.nickname && nameFormat === Constants.Preferences.DISPLAY_PREFER_NICKNAME) { + name = `${user.nickname} (@${user.username})`; + } else if ((user.first_name || user.last_name) && (nameFormat === Constants.Preferences.DISPLAY_PREFER_NICKNAME || nameFormat === Constants.Preferences.DISPLAY_PREFER_FULL_NAME)) { + name = `${Utils.getFullName(user)} (@${user.username})`; + } + + const buttons = actions.map((Action, index) => { + return ( + <Action + key={index.toString()} + user={user} + /> + ); + }); + + return ( + <div + key={user.id} + className='more-modal__row' + > + <img + className='more-modal__image' + width='38' + height='38' + src={`/api/v1/users/${user.id}/image?time=${user.update_at}`} + /> + <div + className='more-modal__details' + > + <div className='more-modal__name'> + {name} + </div> + <div className='more-modal__description'> + {user.email} + </div> + </div> + <div + className='more-modal__actions' + > + {buttons} + </div> + </div> + ); +} + +UserListRow.defaultProps = { + actions: [] +}; + +UserListRow.propTypes = { + user: React.PropTypes.object.isRequired, + actions: React.PropTypes.arrayOf(React.PropTypes.func) +}; |