2019-04-06 06:32:21 +08:00
|
|
|
import React, { Component } from 'react';
|
2020-05-26 04:00:13 +08:00
|
|
|
import { defineMessages } from 'react-intl';
|
2019-04-12 04:54:15 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2019-04-06 06:32:21 +08:00
|
|
|
|
2022-02-15 23:54:55 +08:00
|
|
|
import Modal from '/imports/ui/components/common/modal/simple/component';
|
2019-04-06 06:32:21 +08:00
|
|
|
|
2019-04-11 03:40:40 +08:00
|
|
|
import Service from './service';
|
|
|
|
|
2021-10-29 03:44:30 +08:00
|
|
|
import Styled from './styles';
|
2019-04-06 06:32:21 +08:00
|
|
|
|
|
|
|
const propTypes = {
|
2020-05-26 04:00:13 +08:00
|
|
|
intl: PropTypes.object.isRequired,
|
2019-04-12 04:54:15 +08:00
|
|
|
meetingId: PropTypes.string.isRequired,
|
|
|
|
requesterUserId: PropTypes.string.isRequired,
|
2019-04-06 06:32:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
const intlMessages = defineMessages({
|
|
|
|
title: {
|
|
|
|
id: 'app.user-info.title',
|
|
|
|
description: 'User info title label',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2019-04-12 04:54:15 +08:00
|
|
|
class UserInfoComponent extends Component {
|
|
|
|
renderUserInfo() {
|
|
|
|
const { UserInfo } = this.props;
|
2019-04-06 06:32:21 +08:00
|
|
|
const userInfoList = UserInfo.map((user, index, array) => {
|
|
|
|
const infoList = user.userInfo.map((info) => {
|
|
|
|
const key = Object.keys(info)[0];
|
|
|
|
return (
|
|
|
|
<tr key={key}>
|
2021-10-29 03:44:30 +08:00
|
|
|
<Styled.KeyCell>{key}</Styled.KeyCell>
|
|
|
|
<Styled.ValueCell>{info[key]}</Styled.ValueCell>
|
2019-04-06 06:32:21 +08:00
|
|
|
</tr>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
if (array.length > 1) {
|
2019-04-12 04:54:15 +08:00
|
|
|
infoList.unshift(
|
|
|
|
<tr key={infoList.length}>
|
2021-10-29 03:44:30 +08:00
|
|
|
<th>{`User ${index + 1}`}</th>
|
2019-04-12 04:54:15 +08:00
|
|
|
</tr>,
|
|
|
|
);
|
2019-04-06 06:32:21 +08:00
|
|
|
}
|
|
|
|
return infoList;
|
|
|
|
});
|
|
|
|
return (
|
2021-10-29 03:44:30 +08:00
|
|
|
<Styled.UserInfoTable>
|
2019-04-06 06:32:21 +08:00
|
|
|
<tbody>
|
|
|
|
{userInfoList}
|
|
|
|
</tbody>
|
2021-10-29 03:44:30 +08:00
|
|
|
</Styled.UserInfoTable>
|
2019-04-06 06:32:21 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2020-04-29 12:41:16 +08:00
|
|
|
const { intl } = this.props;
|
2019-04-06 06:32:21 +08:00
|
|
|
return (
|
|
|
|
<Modal
|
|
|
|
title={intl.formatMessage(intlMessages.title)}
|
2020-04-29 12:41:16 +08:00
|
|
|
onRequestClose={() => Service.handleCloseUserInfo()}
|
2019-04-06 06:32:21 +08:00
|
|
|
>
|
2019-04-12 04:54:15 +08:00
|
|
|
{this.renderUserInfo()}
|
2019-04-06 06:32:21 +08:00
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-12 04:54:15 +08:00
|
|
|
UserInfoComponent.propTypes = propTypes;
|
2019-04-06 06:32:21 +08:00
|
|
|
|
2019-04-12 04:54:15 +08:00
|
|
|
export default UserInfoComponent;
|