ExternalAccountLinkedMe.jsx 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import React, { Fragment } from 'react';
  2. import PropTypes from 'prop-types';
  3. import { withTranslation } from 'react-i18next';
  4. import { createSubscribedElement } from '../UnstatedUtils';
  5. import AppContainer from '../../services/AppContainer';
  6. import PersonalContainer from '../../services/PersonalContainer';
  7. import ExternalAccountRow from './ExternalAccountRow';
  8. class ExternalAccountLinkedMe extends React.Component {
  9. render() {
  10. const { t, personalContainer } = this.props;
  11. const { externalAccounts } = personalContainer.state;
  12. return (
  13. <Fragment>
  14. <h2 className="border-bottom">
  15. <button type="button" className="btn btn-default btn-sm pull-right">
  16. <i className="icon-plus" aria-hidden="true" />
  17. Add
  18. </button>
  19. { t('External Accounts') }
  20. </h2>
  21. <div className="row">
  22. <div className="col-md-12">
  23. <table className="table table-bordered table-user-list">
  24. <thead>
  25. <tr>
  26. <th width="120px">Authentication Provider</th>
  27. <th>
  28. <code>accountId</code>
  29. </th>
  30. <th width="200px">{ t('Created') }</th>
  31. <th width="150px">{ t('Admin') }</th>
  32. </tr>
  33. </thead>
  34. <tbody>
  35. {externalAccounts !== 0 && externalAccounts.map(account => <ExternalAccountRow account={account} />)}
  36. </tbody>
  37. </table>
  38. </div>
  39. </div>
  40. </Fragment>
  41. );
  42. }
  43. }
  44. const ExternalAccountLinkedMeWrapper = (props) => {
  45. return createSubscribedElement(ExternalAccountLinkedMe, props, [AppContainer, PersonalContainer]);
  46. };
  47. ExternalAccountLinkedMe.propTypes = {
  48. t: PropTypes.func.isRequired, // i18next
  49. appContainer: PropTypes.instanceOf(AppContainer).isRequired,
  50. personalContainer: PropTypes.instanceOf(PersonalContainer).isRequired,
  51. };
  52. export default withTranslation()(ExternalAccountLinkedMeWrapper);