bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/user-info/component.jsx

71 lines
1.6 KiB
React
Raw Normal View History

import React, { Component } from 'react';
import { defineMessages } from 'react-intl';
2019-04-12 04:54:15 +08:00
import PropTypes from 'prop-types';
2022-02-15 23:54:55 +08:00
import Modal from '/imports/ui/components/common/modal/simple/component';
2019-04-11 03:40:40 +08:00
import Service from './service';
2021-10-29 03:44:30 +08:00
import Styled from './styles';
const propTypes = {
intl: PropTypes.object.isRequired,
2019-04-12 04:54:15 +08:00
meetingId: PropTypes.string.isRequired,
requesterUserId: PropTypes.string.isRequired,
};
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;
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>
</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>,
);
}
return infoList;
});
return (
2021-10-29 03:44:30 +08:00
<Styled.UserInfoTable>
<tbody>
{userInfoList}
</tbody>
2021-10-29 03:44:30 +08:00
</Styled.UserInfoTable>
);
}
render() {
2020-04-29 12:41:16 +08:00
const { intl } = this.props;
return (
<Modal
title={intl.formatMessage(intlMessages.title)}
2020-04-29 12:41:16 +08:00
onRequestClose={() => Service.handleCloseUserInfo()}
>
2019-04-12 04:54:15 +08:00
{this.renderUserInfo()}
</Modal>
);
}
}
2019-04-12 04:54:15 +08:00
UserInfoComponent.propTypes = propTypes;
2019-04-12 04:54:15 +08:00
export default UserInfoComponent;