fix: replace mediocre by excellent

pull/100/head
Pierre-Louis Guhur 1 year ago
parent 8599c462b9
commit 4d02be2d3d

@ -1,9 +1,9 @@
import { useState } from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faXmark, faRotateLeft } from '@fortawesome/free-solid-svg-icons';
import { useSortable } from '@dnd-kit/sortable';
import { ElectionTypes, useElection } from '@services/ElectionContext';
import { getGradeColor, gradeColors } from '@services/grades';
import {useState} from 'react';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import {faXmark, faRotateLeft} from '@fortawesome/free-solid-svg-icons';
import {useSortable} from '@dnd-kit/sortable';
import {ElectionTypes, useElection} from '@services/ElectionContext';
import {getGradeColor, gradeColors} from '@services/grades';
import VerticalGripDots from '@components/VerticalGripDots';
import GradeModalSet from './GradeModalSet';
@ -11,7 +11,7 @@ export interface GradeInterface {
value: number;
}
export default ({ value }: GradeInterface) => {
export default ({value}: GradeInterface) => {
const [election, dispatch] = useElection();
const grade = election.grades.filter((g) => g.value === value)[0];
@ -19,8 +19,8 @@ export default ({ value }: GradeInterface) => {
const numGrades = activeGrade.length;
const gradeIdx = activeGrade.map((g) => g.value).indexOf(value);
const { attributes, listeners, setNodeRef, transform, transition } =
useSortable({ id: grade.name });
const {attributes, listeners, setNodeRef, transform, transition} =
useSortable({id: grade.name});
const [visible, setVisible] = useState<boolean>(false);
const toggle = () => setVisible((v) => !v);
@ -37,7 +37,7 @@ export default ({ value }: GradeInterface) => {
});
};
const color = getGradeColor(gradeIdx, numGrades);
const color = getGradeColor(grade.value, numGrades);
const style = {
color: grade.active ? 'white' : '#8F88BA',
@ -58,7 +58,7 @@ export default ({ value }: GradeInterface) => {
<VerticalGripDots height={15} width={30} />
</div>
<div
style={{ touchAction: 'none' }}
style={{touchAction: 'none'}}
className={grade.active ? '' : 'text-decoration-line-through'}
role="button"
onClick={toggle}
@ -71,7 +71,7 @@ export default ({ value }: GradeInterface) => {
<FontAwesomeIcon
onClick={handleActive}
icon={grade.active ? faXmark : faRotateLeft}
style={{ color: 'black', opacity: '25%' }}
style={{color: 'black', opacity: '25%'}}
/>
</>
) : (

@ -1,22 +1,22 @@
/**
* A field to update the grades
*/
import { useState, useEffect } from 'react';
import { useTranslation } from 'next-i18next';
import { Container, Row, Col } from 'reactstrap';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faPlus } from '@fortawesome/free-solid-svg-icons';
import { DndContext } from '@dnd-kit/core';
import { arrayMove, SortableContext } from '@dnd-kit/sortable';
import { DEFAULT_GRADES } from '@services/constants';
import { ElectionTypes, useElection } from '@services/ElectionContext';
import {useState, useEffect} from 'react';
import {useTranslation} from 'next-i18next';
import {Container, Row, Col} from 'reactstrap';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import {faPlus} from '@fortawesome/free-solid-svg-icons';
import {DndContext} from '@dnd-kit/core';
import {arrayMove, SortableContext} from '@dnd-kit/sortable';
import {DEFAULT_GRADES} from '@services/constants';
import {ElectionTypes, useElection} from '@services/ElectionContext';
import GradeField from './GradeField';
import GradeModalAdd from './GradeModalAdd';
import { gradeColors } from '@services/grades';
import {gradeColors} from '@services/grades';
import Switch from '@components/Switch';
const AddField = () => {
const { t } = useTranslation();
const {t} = useTranslation();
const [modal, setModal] = useState(false);
const toggle = () => setModal((m) => !m);
@ -29,9 +29,8 @@ const AddField = () => {
<Row
role={disabled ? null : 'button'}
onClick={disabled ? null : toggle}
className={`${
disabled ? 'bg-light text-black-50' : 'bg-primary text-white'
} p-2 m-1 rounded-1`}
className={`${disabled ? 'bg-light text-black-50' : 'bg-primary text-white'
} p-2 m-1 rounded-1`}
>
<Col className="col-auto">
<FontAwesomeIcon icon={faPlus} />
@ -46,7 +45,7 @@ const AddField = () => {
};
const Grades = () => {
const { t } = useTranslation();
const {t} = useTranslation();
const [election, dispatch] = useElection();
@ -66,24 +65,20 @@ const Grades = () => {
value: defaultGrades,
});
}
/*if (election.grades !== defaultGrades) {
setVisible(true);
}*/
}, []);
const handleDragEnd = (event) => {
/**
* Update the list of grades after dragging an item
*/
const { active, over } = event;
const {active, over} = event;
if (active.id !== over.id) {
const names = election.grades.map((g) => g.name);
const activeIdx = names.indexOf(active.id);
const overIdx = names.indexOf(over.id);
const newGrades = arrayMove(election.grades, activeIdx, overIdx);
newGrades.forEach((g, i) => (g.value = i));
newGrades.forEach((g, i) => (g.value = newGrades.length - i - 1));
dispatch({
type: ElectionTypes.SET,
field: 'grades',

@ -103,6 +103,7 @@
"faq.sec-19-desc": "Did you enjoy your democratic majority-judgment voting experience? We're thrilled! You can help us return elections to voters by donating to our association here:",
"faq.sec-18-title": "How secure is my data?",
"faq.sec-18-desc": "In order to guarantee the security of your data, their transmission is encrypted and your votes are anonymized.",
"grades.excellent": "Excellent",
"grades.very-good": "Very good",
"grades.good": "Good",
"grades.passable": "Passable",

@ -104,11 +104,11 @@
"faq.sec-19-desc": "Vous avez apprécié votre expérience de vote démocratique au jugement majoritaire ? Nous en sommes ravis ! Vous pouvez nous aider à rendre les élections aux électeurs en faisant un don à notre association ici :",
"faq.sec-18-title": "Quelle sécurité pour mes données ?",
"faq.sec-18-desc": "Afin de garantir la sécurité de vos données, leur transmission est chiffrée et vos votes sont anonymisés.",
"grades.excellent": "Excellent",
"grades.very-good": "Très bien",
"grades.good": "Bien",
"grades.passable": "Passable",
"grades.inadequate": "Insuffisant",
"grades.mediocre": "À rejeter",
"admin.admin-title": "Administration du vote",
"admin.close-election": "Clôturer l'élection",
"admin.date-limit": "Fixer une date limite pour le vote",

@ -9,12 +9,12 @@ export const CONTACT_MAIL =
export const DEFAULT_GRADES = process.env.NEXT_PUBLIC_DEFAULT_GRADES
? process.env.NEXT_PUBLIC_DEFAULT_GRADES.split(',')
: [
'grades.very-good',
'grades.good',
'grades.passable',
'grades.inadequate',
'grades.mediocre',
];
'grades.excellent',
'grades.very-good',
'grades.good',
'grades.passable',
'grades.inadequate',
];
export const IMGPUSH_URL =
process.env.NEXT_PUBLIC_IMGPUSH_URL || 'https://imgpush.mieuxvoter.fr';
export const GRADE_COLORS = [

@ -363,6 +363,11 @@ h5 {
// color: white;
border: none;
}
.form-control:focus {
background: transparent;
border: none;
box-shadow: none;
}
/*
.form-control::placeholder {
color: white;

Loading…
Cancel
Save