- {i + 1} |
+ {i + 1} |
{/*candidate.label*/}
-
+
{gradeIds
@@ -224,7 +222,7 @@ const Result = ({ candidates, numGrades, title, pid, err }) => {
return (
array.sort(() => Math.random() - 0.5);
-export async function getServerSideProps({ query: { pid, tid }, locale }) {
+export async function getServerSideProps({query: {pid, tid}, locale}) {
const [details, translations] = await Promise.all([
getDetails(pid),
- serverSideTranslations(locale, [], config),
+ serverSideTranslations(locale, ["resource", "common", "locale"]),
]);
if (typeof details === "string" || details instanceof String) {
- return { props: { err: details, ...translations } };
+ return {props: {err: details, ...translations}};
}
if (!details.candidates || !Array.isArray(details.candidates)) {
- return { props: { err: "Unknown error", ...translations } };
+ return {props: {err: "Unknown error", ...translations}};
}
shuffle(details.candidates);
@@ -35,7 +34,7 @@ export async function getServerSideProps({ query: { pid, tid }, locale }) {
...translations,
invitationOnly: details.on_invitation_only,
restrictResults: details.restrict_results,
- candidates: details.candidates.map((name, i) => ({ id: i, label: name })),
+ candidates: details.candidates.map((name, i) => ({id: i, label: name})),
title: details.title,
numGrades: details.num_grades,
pid: pid,
@@ -44,8 +43,8 @@ export async function getServerSideProps({ query: { pid, tid }, locale }) {
};
}
-const VoteBallot = ({ candidates, title, numGrades, pid, err, token }) => {
- const { t } = useTranslation();
+const VoteBallot = ({candidates, title, numGrades, pid, err, token}) => {
+ const {t} = useTranslation();
if (err) {
return ;
@@ -138,11 +137,11 @@ const VoteBallot = ({ candidates, title, numGrades, pid, err, token }) => {
lg={colSizeGradeLg}
key={gradeId}
className="text-center p-0"
- style={{ lineHeight: 2 }}
+ style={{lineHeight: 2}}
>
{grade.label}
@@ -180,7 +179,7 @@ const VoteBallot = ({ candidates, title, numGrades, pid, err, token }) => {
className="check"
>
{
return (
@@ -191,11 +190,11 @@ const VoteBallot = ({ candidates, title, numGrades, pid, err, token }) => {
})
);
})
- ? { backgroundColor: grade.color, color: "#fff" }
+ ? {backgroundColor: grade.color, color: "#fff"}
: {
- backgroundColor: "transparent",
- color: "#000",
- }
+ backgroundColor: "transparent",
+ color: "#000",
+ }
}
>
{grade.label}
@@ -230,11 +229,11 @@ const VoteBallot = ({ candidates, title, numGrades, pid, err, token }) => {
})
);
})
- ? { backgroundColor: grade.color, color: "#fff" }
+ ? {backgroundColor: grade.color, color: "#fff"}
: {
- backgroundColor: "transparent",
- color: "#000",
- }
+ backgroundColor: "transparent",
+ color: "#000",
+ }
}
/>
@@ -253,12 +252,12 @@ const VoteBallot = ({ candidates, title, numGrades, pid, err, token }) => {
onClick={handleSubmitWithoutAllRate}
className="btn btn-dark "
>
-
+
{t("Submit my vote")}
) : (
)}
diff --git a/pages/vote/[pid]/confirm.jsx b/pages/vote/[pid]/confirm.jsx
index 7f1ffc2..00bdb2b 100644
--- a/pages/vote/[pid]/confirm.jsx
+++ b/pages/vote/[pid]/confirm.jsx
@@ -1,26 +1,25 @@
import Head from "next/head";
-import { Col, Container, Row } from "reactstrap";
+import {Col, Container, Row} from "reactstrap";
import Link from "next/link";
-import { useTranslation } from "next-i18next";
-import { serverSideTranslations } from "next-i18next/serverSideTranslations";
+import {useTranslation} from "next-i18next";
+import {serverSideTranslations} from "next-i18next/serverSideTranslations";
import Paypal from "@components/banner/Paypal";
import Gform from "@components/banner/Gform";
import Error from "@components/Error";
-import { getDetails, apiErrors } from "@services/api";
-import config from "../../../next-i18next.config.js";
+import {getDetails, apiErrors} from "@services/api";
-export async function getServerSideProps({ query: { pid }, locale }) {
+export async function getServerSideProps({query: {pid}, locale}) {
const [details, translations] = await Promise.all([
getDetails(pid),
- serverSideTranslations(locale, [], config),
+ serverSideTranslations(locale, ["resource", "common", "locale"]),
]);
if (typeof details === "string" || details instanceof String) {
- return { props: { err: res.slice(1, -1), ...translations } };
+ return {props: {err: res.slice(1, -1), ...translations}};
}
if (!details.candidates || !Array.isArray(details.candidates)) {
- return { props: { err: "Unknown error", ...translations } };
+ return {props: {err: "Unknown error", ...translations}};
}
return {
@@ -28,7 +27,7 @@ export async function getServerSideProps({ query: { pid }, locale }) {
...translations,
invitationOnly: details.on_invitation_only,
restrictResults: details.restrict_results,
- candidates: details.candidates.map((name, i) => ({ id: i, label: name })),
+ candidates: details.candidates.map((name, i) => ({id: i, label: name})),
title: details.title,
numGrades: details.num_grades,
pid: pid,
@@ -36,8 +35,9 @@ export async function getServerSideProps({ query: { pid }, locale }) {
};
}
-const VoteSuccess = ({ title, invitationOnly, pid, err }) => {
- const { t } = useTranslation();
+
+const VoteSuccess = ({title, invitationOnly, pid, err}) => {
+ const {t} = useTranslation();
if (err && err !== "") {
return ;
}
@@ -55,10 +55,8 @@ const VoteSuccess = ({ title, invitationOnly, pid, err }) => {
/>
-
-
-
-
+
+
|