2020-10-01 17:11:45 +03:00
|
|
|
import React from 'react';
|
2018-09-21 14:49:13 +01:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { Button, Panel } from '@freecodecamp/react-bootstrap';
|
2020-12-16 02:02:52 -06:00
|
|
|
import { useTranslation } from 'react-i18next';
|
2018-09-21 14:49:13 +01:00
|
|
|
|
2019-02-22 18:58:38 +05:30
|
|
|
import { FullWidthRow } from '../helpers';
|
2018-09-21 14:49:13 +01:00
|
|
|
import SectionHeader from './SectionHeader';
|
2019-02-22 18:58:38 +05:30
|
|
|
import HonestyPolicy from '../../resources/honesty-policy';
|
2018-09-21 14:49:13 +01:00
|
|
|
|
|
|
|
import './honesty.css';
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
isHonest: PropTypes.bool,
|
|
|
|
updateIsHonest: PropTypes.func.isRequired
|
|
|
|
};
|
|
|
|
|
2020-10-01 17:11:45 +03:00
|
|
|
const Honesty = ({ isHonest, updateIsHonest }) => {
|
2020-12-16 02:02:52 -06:00
|
|
|
const { t } = useTranslation();
|
2020-10-01 17:11:45 +03:00
|
|
|
const button = isHonest ? (
|
2019-10-22 17:20:33 +05:30
|
|
|
<Button
|
|
|
|
block={true}
|
|
|
|
bsStyle='primary'
|
|
|
|
className='disabled-agreed'
|
|
|
|
disabled={true}
|
|
|
|
>
|
2020-12-16 02:02:52 -06:00
|
|
|
<p>{t('buttons.accepted-honesty')}</p>
|
2019-10-22 17:20:33 +05:30
|
|
|
</Button>
|
2020-10-01 17:11:45 +03:00
|
|
|
) : (
|
|
|
|
<Button
|
|
|
|
block={true}
|
|
|
|
bsStyle='primary'
|
|
|
|
onClick={() => updateIsHonest({ isHonest: true })}
|
|
|
|
>
|
2020-12-16 02:02:52 -06:00
|
|
|
{t('buttons.agree')}
|
2020-10-01 17:11:45 +03:00
|
|
|
</Button>
|
2018-09-21 14:49:13 +01:00
|
|
|
);
|
2020-10-01 17:11:45 +03:00
|
|
|
return (
|
2021-05-07 02:39:38 +05:30
|
|
|
<section className='honesty-policy'>
|
2020-12-16 02:02:52 -06:00
|
|
|
<SectionHeader>{t('settings.headings.honesty')}</SectionHeader>
|
2020-10-01 17:11:45 +03:00
|
|
|
<FullWidthRow>
|
|
|
|
<Panel className='honesty-panel'>
|
|
|
|
<HonestyPolicy />
|
|
|
|
</Panel>
|
|
|
|
<br />
|
|
|
|
{button}
|
|
|
|
</FullWidthRow>
|
|
|
|
</section>
|
|
|
|
);
|
|
|
|
};
|
2018-09-21 14:49:13 +01:00
|
|
|
|
|
|
|
Honesty.displayName = 'Honesty';
|
|
|
|
Honesty.propTypes = propTypes;
|
|
|
|
|
|
|
|
export default Honesty;
|