|
|
|
@ -7,7 +7,7 @@ import { useTranslation } from 'next-i18next';
|
|
|
|
|
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
|
|
|
|
|
import {faPlus, faTrashCan} from '@fortawesome/free-solid-svg-icons';
|
|
|
|
|
import {useSortable} from '@dnd-kit/sortable';
|
|
|
|
|
import { ElectionTypes, useElection } from '@services/ElectionContext';
|
|
|
|
|
import {ElectionTypes, useElection, isCreated} from '@services/ElectionContext';
|
|
|
|
|
import VerticalGripDots from '@components/VerticalGripDots';
|
|
|
|
|
import whiteAvatar from '../../public/avatar.svg';
|
|
|
|
|
import CandidateModalSet from './CandidateModalSet';
|
|
|
|
@ -42,7 +42,9 @@ const CandidateField = ({
|
|
|
|
|
useSortable({id: position + 1});
|
|
|
|
|
|
|
|
|
|
const addCandidate = () => {
|
|
|
|
|
if (!isCreated(election)) {
|
|
|
|
|
dispatch({type: ElectionTypes.CANDIDATE_PUSH, value: 'default'});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const toggleSet = () => setModalSet((m) => !m);
|
|
|
|
@ -74,8 +76,7 @@ const CandidateField = ({
|
|
|
|
|
src={image}
|
|
|
|
|
width={24}
|
|
|
|
|
height={24}
|
|
|
|
|
className={`${
|
|
|
|
|
image == defaultAvatar ? 'default-avatar' : ''
|
|
|
|
|
className={`${image == defaultAvatar ? 'default-avatar' : ''
|
|
|
|
|
} bg-primary`}
|
|
|
|
|
alt={t('common.thumbnail')}
|
|
|
|
|
/>
|
|
|
|
|