ReconnectControls.tsx 955 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import React from 'react';
  2. import { useTranslation } from 'next-i18next';
  3. import { LoadingSpinner } from '~/components/LoadingSpinner';
  4. type Props = {
  5. isEnabled?: boolean,
  6. isProcessing?: boolean,
  7. onReconnectingRequested: () => void,
  8. }
  9. const ReconnectControls = (props: Props): JSX.Element => {
  10. const { t } = useTranslation('admin');
  11. const { isEnabled, isProcessing } = props;
  12. return (
  13. <>
  14. <button
  15. type="submit"
  16. className={`btn ${isEnabled ? 'btn-outline-success' : 'btn-outline-secondary'}`}
  17. onClick={() => { props.onReconnectingRequested() }}
  18. disabled={!isEnabled}
  19. >
  20. { isProcessing && <LoadingSpinner className="me-2" /> }
  21. { t('full_text_search_management.reconnect_button') }
  22. </button>
  23. <p className="form-text text-muted">
  24. { t('full_text_search_management.reconnect_description') }<br />
  25. </p>
  26. </>
  27. );
  28. };
  29. export default ReconnectControls;