fix: url for links

pull/89/head
Pierre-Louis Guhur 1 year ago
parent 461674e923
commit 9a41f72e70

@ -48,28 +48,24 @@ const CandidateField = ({
: 'border border-dashed border-2 border-light border-opacity-25'; : 'border border-dashed border-2 border-light border-opacity-25';
return ( return (
<Row <div
className={`${activeClass} align-items-center ${className}`} className={`${activeClass} d-flex justify-content-between align-items-center ${className}`}
{...props} {...props}
> >
<Col onClick={toggleSet} role="button" className="col-10 me-auto"> <div onClick={toggleSet} role="button" className="py-3 flex-fill d-flex align-items-center ">
<Row className="gx-3"> <Image
<Col className="col-2 justify-content-start align-items-center d-flex"> src={image}
<Image width={24}
src={image} height={24}
width={24} className={`${image == defaultAvatar ? 'default-avatar' : ''
height={24} } bg-primary`}
className={`${image == defaultAvatar ? 'default-avatar' : '' alt={t('common.thumbnail')}
} bg-primary`} />
alt={t('common.thumbnail')} <div className="ps-2 fw-bold">
/> {candidate.name ? candidate.name : t('admin.add-candidate')}
</Col> </div>
<Col className="col-10 fw-bold"> </div>
{candidate.name ? candidate.name : t('admin.add-candidate')} <div role="button" className="text-end">
</Col>
</Row>
</Col>
<Col role="button" className="col-2 text-end">
{active ? ( {active ? (
<FontAwesomeIcon <FontAwesomeIcon
icon={faTrashCan} icon={faTrashCan}
@ -79,7 +75,7 @@ const CandidateField = ({
) : ( ) : (
<FontAwesomeIcon icon={faPlus} onClick={addCandidate} /> <FontAwesomeIcon icon={faPlus} onClick={addCandidate} />
)} )}
</Col> </div>
<CandidateModalSet <CandidateModalSet
toggle={toggleSet} toggle={toggleSet}
isOpen={modalSet} isOpen={modalSet}
@ -90,7 +86,7 @@ const CandidateField = ({
isOpen={modalDel} isOpen={modalDel}
position={position} position={position}
/> />
</Row> </div >
); );
}; };

@ -54,7 +54,7 @@ const CandidatesField = ({onSubmit}) => {
<CandidateField <CandidateField
key={index} key={index}
position={index} position={index}
className="px-1 py-3 my-3" className="px-4 my-3"
/> />
); );
})} })}

@ -60,7 +60,7 @@ const CandidatesField = () => {
<CandidateField <CandidateField
position={i} position={i}
key={i} key={i}
className="text-primary m-0 py-2" className="text-primary m-0"
/> />
))} ))}
</Container> </Container>

@ -19,7 +19,6 @@ const Order = () => {
value: !election.randomOrder, value: !election.randomOrder,
}); });
}; };
console.log(election.randomOrder)
return ( return (
<> <>

@ -57,7 +57,7 @@ export const sendAdminMail = async (
urlAdmin: URL, urlAdmin: URL,
) => { ) => {
/** /**
* Send an invitation mail using a micro-service with Netlify * Send a reminder to admink panel
*/ */
if (!mail || !validateMail(mail)) { if (!mail || !validateMail(mail)) {
throw new Error('Incorrect format for the email'); throw new Error('Incorrect format for the email');

@ -4,25 +4,25 @@
import {getWindowUrl, displayRef} from './utils'; import {getWindowUrl, displayRef} from './utils';
export const CREATE_ELECTION = '/admin/new/'; export const CREATE_ELECTION = '/admin/new';
export const BALLOT = '/ballot/'; export const BALLOT = '/ballot';
export const ENDED_VOTE = '/ballot/end'; export const ENDED_VOTE = '/ballot/end';
export const VOTE = '/vote/'; export const VOTE = '/vote';
export const RESULTS = '/result/'; export const RESULTS = '/result';
export const getUrlVote = (electionRef: string | number, token?: string): URL => { export const getUrlVote = (electionRef: string | number, token?: string): URL => {
const origin = getWindowUrl(); const origin = getWindowUrl();
const ref = typeof electionRef === "string" ? electionRef : electionRef.toString(); const ref = typeof electionRef === "string" ? electionRef : electionRef.toString();
if (token) if (token)
return new URL(`/${VOTE}/${displayRef(ref)}/${token}`, origin); return new URL(`${VOTE}/${displayRef(ref)}/${token}`, origin);
return new URL(`/${VOTE}/${displayRef(ref)}`, origin); return new URL(`${VOTE}/${displayRef(ref)}`, origin);
} }
export const getUrlResults = (electionRef: string | number): URL => { export const getUrlResults = (electionRef: string | number): URL => {
const origin = getWindowUrl(); const origin = getWindowUrl();
const ref = typeof electionRef === "string" ? electionRef : electionRef.toString(); const ref = typeof electionRef === "string" ? electionRef : electionRef.toString();
return new URL(`/${RESULTS}/${displayRef(ref)}`, origin); return new URL(`${RESULTS}/${displayRef(ref)}`, origin);
} }
export const getUrlAdmin = (electionRef: string | number, adminToken: string): URL => { export const getUrlAdmin = (electionRef: string | number, adminToken: string): URL => {

Loading…
Cancel
Save