CommentManageRightsSettings.tsx 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import type React from 'react';
  2. import type AdminGeneralSecurityContainer from '~/client/services/AdminGeneralSecurityContainer';
  3. type Props = {
  4. adminGeneralSecurityContainer: AdminGeneralSecurityContainer;
  5. t: (key: string) => string;
  6. };
  7. export const CommentManageRightsSettings: React.FC<Props> = ({
  8. adminGeneralSecurityContainer,
  9. t,
  10. }) => {
  11. const { isRomUserAllowedToComment } = adminGeneralSecurityContainer.state;
  12. return (
  13. <>
  14. <h4 className="mb-3">{t('security_settings.comment_manage_rights')}</h4>
  15. <div className="row mb-4">
  16. <div className="col-md-4 text-md-end py-2">
  17. <strong>{t('security_settings.readonly_users_access')}</strong>
  18. </div>
  19. <div className="col-md-8">
  20. <div className="dropdown">
  21. <button
  22. className={`btn btn-outline-secondary dropdown-toggle text-end col-12 col-md-auto ${
  23. adminGeneralSecurityContainer.isWikiModeForced && 'disabled'
  24. }`}
  25. type="button"
  26. id="dropdownMenuButton"
  27. data-bs-toggle="dropdown"
  28. aria-haspopup="true"
  29. aria-expanded="true"
  30. >
  31. <span className="float-start">
  32. {isRomUserAllowedToComment === true &&
  33. t('security_settings.read_only_users_comment.accept')}
  34. {isRomUserAllowedToComment === false &&
  35. t('security_settings.read_only_users_comment.deny')}
  36. </span>
  37. </button>
  38. <div className="dropdown-menu">
  39. <button
  40. className="dropdown-item"
  41. type="button"
  42. onClick={() => {
  43. adminGeneralSecurityContainer.switchIsRomUserAllowedToComment(
  44. false,
  45. );
  46. }}
  47. >
  48. {t('security_settings.read_only_users_comment.deny')}
  49. </button>
  50. <button
  51. className="dropdown-item"
  52. type="button"
  53. onClick={() => {
  54. adminGeneralSecurityContainer.switchIsRomUserAllowedToComment(
  55. true,
  56. );
  57. }}
  58. >
  59. {t('security_settings.read_only_users_comment.accept')}
  60. </button>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. </>
  66. );
  67. };