You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mvfront-react/components/admin/ParamsField.tsx

50 lines
1.6 KiB

import {useTranslation} from 'next-i18next';
import {Container} from 'reactstrap';
import {faArrowRight} from '@fortawesome/free-solid-svg-icons';
import Button from '@components/Button';
import Grades from './Grades';
import LimitDate from './LimitDate';
import AccessResults from './AccessResults';
import Order from './Order';
import Private from './Private';
import {useElection} from '@services/ElectionContext';
const ParamsField = ({onSubmit}) => {
const {t} = useTranslation();
const election = useElection();
const checkDisability = election.restricted && (typeof election.emails === "undefined" || election.emails.length === 0) || election.grades.filter(g => g.active).length < 2;
return (
<Container className="params d-flex flex-column flex-grow-1 my-5">
<Container className="px-0 d-md-none mb-5">
<h4>{t('admin.params-title')}</h4>
</Container>
<div className="d-flex flex-grow-1 flex-column justify-content-between">
<div className="d-flex flex-column">
<AccessResults />
<LimitDate />
<Grades />
<Order />
<Private />
</div>
<Container className="my-5 d-md-flex d-grid justify-content-md-center">
<Button
outline={true}
color="secondary"
className="bg-blue"
onClick={onSubmit}
disabled={checkDisability}
icon={faArrowRight}
position="right"
>
{t('admin.params-submit')}
</Button>
</Container>
</div>
</Container>
);
};
export default ParamsField;