CustomBotWithoutProxyConnectionStatus.jsx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import Bridge from './Bridge';
  4. const CustomBotWithoutProxyConnectionStatus = (props) => {
  5. const { siteName, connectionStatuses } = props;
  6. const connectionStatusValues = Object.values(connectionStatuses); // type: ConnectionStatus[]
  7. const totalCount = connectionStatusValues.length;
  8. const errorCount = connectionStatusValues.filter(connectionStatus => connectionStatus.error != null).length;
  9. let workspaceName;
  10. if (totalCount > 0) {
  11. workspaceName = connectionStatusValues[0].workspaceName;
  12. }
  13. return (
  14. <div className="d-flex justify-content-center my-5 bot-integration">
  15. <div className="card rounded shadow border-0 w-50 admin-bot-card mb-0">
  16. <h5 className="card-title font-weight-bold mt-3 ms-4">Slack</h5>
  17. <div className="card-body px-4 text-center mx-md-5">
  18. {totalCount > 0 ? (
  19. <div className="card slack-work-space-name-card">
  20. <div className="m-2 text-center">
  21. <h5 className="font-weight-bold">
  22. {workspaceName != null ? workspaceName : 'Settings #1'}
  23. </h5>
  24. <img width={20} height={20} src="/images/slack-integration/growi-bot-kun-icon.png" />
  25. </div>
  26. </div>
  27. ) : ''}
  28. </div>
  29. </div>
  30. <div className="text-center w-25">
  31. <Bridge errorCount={errorCount} totalCount={totalCount} />
  32. </div>
  33. <div className="card rounded-lg shadow border-0 w-50 admin-bot-card mb-0">
  34. <h5 className="card-title font-weight-bold mt-3 ms-4">GROWI App</h5>
  35. <div className="card-body p-4 text-center">
  36. <div className="border p-2 bg-primary text-light mx-md-5">
  37. {siteName}
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. );
  43. };
  44. CustomBotWithoutProxyConnectionStatus.propTypes = {
  45. siteName: PropTypes.string.isRequired,
  46. connectionStatuses: PropTypes.object.isRequired,
  47. };
  48. export default CustomBotWithoutProxyConnectionStatus;