From 9a41f72e70730784b5f698635859de9c5d5a2922 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Guhur Date: Thu, 1 Dec 2022 17:40:45 +0100 Subject: [PATCH] fix: url for links --- components/admin/CandidateField.tsx | 40 +++++++++++++--------------- components/admin/CandidatesField.tsx | 2 +- components/admin/ConfirmField.tsx | 2 +- components/admin/Order.tsx | 1 - services/mail.ts | 2 +- services/routes.ts | 14 +++++----- 6 files changed, 28 insertions(+), 33 deletions(-) diff --git a/components/admin/CandidateField.tsx b/components/admin/CandidateField.tsx index 6fb13d2..a7d1ade 100644 --- a/components/admin/CandidateField.tsx +++ b/components/admin/CandidateField.tsx @@ -48,28 +48,24 @@ const CandidateField = ({ : 'border border-dashed border-2 border-light border-opacity-25'; return ( - - - - - {t('common.thumbnail')} - - - {candidate.name ? candidate.name : t('admin.add-candidate')} - - - - +
+ {t('common.thumbnail')} +
+ {candidate.name ? candidate.name : t('admin.add-candidate')} +
+
+
{active ? ( )} - +
-
+ ); }; diff --git a/components/admin/CandidatesField.tsx b/components/admin/CandidatesField.tsx index e94436c..dfb8b0d 100644 --- a/components/admin/CandidatesField.tsx +++ b/components/admin/CandidatesField.tsx @@ -54,7 +54,7 @@ const CandidatesField = ({onSubmit}) => { ); })} diff --git a/components/admin/ConfirmField.tsx b/components/admin/ConfirmField.tsx index ef50360..e9142e2 100644 --- a/components/admin/ConfirmField.tsx +++ b/components/admin/ConfirmField.tsx @@ -60,7 +60,7 @@ const CandidatesField = () => { ))} diff --git a/components/admin/Order.tsx b/components/admin/Order.tsx index 19d02f9..4db3cf1 100644 --- a/components/admin/Order.tsx +++ b/components/admin/Order.tsx @@ -19,7 +19,6 @@ const Order = () => { value: !election.randomOrder, }); }; - console.log(election.randomOrder) return ( <> diff --git a/services/mail.ts b/services/mail.ts index 2d38b0a..6e0c106 100644 --- a/services/mail.ts +++ b/services/mail.ts @@ -57,7 +57,7 @@ export const sendAdminMail = async ( urlAdmin: URL, ) => { /** - * Send an invitation mail using a micro-service with Netlify + * Send a reminder to admink panel */ if (!mail || !validateMail(mail)) { throw new Error('Incorrect format for the email'); diff --git a/services/routes.ts b/services/routes.ts index 0a44a52..5908e75 100644 --- a/services/routes.ts +++ b/services/routes.ts @@ -4,25 +4,25 @@ import {getWindowUrl, displayRef} from './utils'; -export const CREATE_ELECTION = '/admin/new/'; -export const BALLOT = '/ballot/'; +export const CREATE_ELECTION = '/admin/new'; +export const BALLOT = '/ballot'; export const ENDED_VOTE = '/ballot/end'; -export const VOTE = '/vote/'; -export const RESULTS = '/result/'; +export const VOTE = '/vote'; +export const RESULTS = '/result'; export const getUrlVote = (electionRef: string | number, token?: string): URL => { const origin = getWindowUrl(); const ref = typeof electionRef === "string" ? electionRef : electionRef.toString(); if (token) - return new URL(`/${VOTE}/${displayRef(ref)}/${token}`, origin); - return new URL(`/${VOTE}/${displayRef(ref)}`, origin); + return new URL(`${VOTE}/${displayRef(ref)}/${token}`, origin); + return new URL(`${VOTE}/${displayRef(ref)}`, origin); } export const getUrlResults = (electionRef: string | number): URL => { const origin = getWindowUrl(); 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 => {