import React from 'react';
import Parser from 'html-react-parser';
import { useSelector } from 'react-redux';
import { selectUserTermsToAccept } from 'app/modules/user/store/user.selectors';

const TermsNeedingAccept = () => {
  const termsToAccept = useSelector(selectUserTermsToAccept);

  if (!termsToAccept) {
    return (
      <>
        { 'Something went wrong please contact with our support.' }
      </>
    );
  }
  return (
    <div className="c-terms-needing-accept o-gutter-md-right--big u-align--left">
      { Parser(termsToAccept.text) }
    </div>
  );
};

export { TermsNeedingAccept };
