+ Linked to: {corporateUserToShow?.corporateInformation?.companyInformation.name || corporateUserToShow.name}
+
+ )}
+ ,
+ value: Object.keys(groupBySession(stats)).length,
+ label: "Exams",
+ },
+ {
+ icon: ,
+ value: stats.length,
+ label: "Exercises",
+ },
+ {
+ icon: ,
+ value: `${stats.length > 0 ? averageScore(stats) : 0}%`,
+ label: "Average Score",
+ },
+ ]}
+ />
- const inviter = users.find((u) => u.id === invite.from);
- const name = !inviter
- ? null
- : inviter.type === "corporate"
- ? inviter.corporateInformation?.companyInformation?.name || inviter.name
- : inviter.name;
+ {/* Bio */}
+
+ Bio
+
+ {user.bio || "Your bio will appear here, you can change it by clicking on your name in the top right corner."}
+
+
- const decide = (decision: "accept" | "decline") => {
- if (!confirm(`Are you sure you want to ${decision} this invite?`)) return;
+ {/* Assignments */}
+
+
+
+ Assignments
+
+
+
+
+ {assignments.filter((a) => moment(a.endDate).isSameOrAfter(moment())).length === 0 &&
+ "Assignments will appear here. It seems that for now there are no assignments for you."}
+ {assignments
+ .filter((a) => moment(a.endDate).isSameOrAfter(moment()))
+ .sort((a, b) => moment(a.startDate).diff(b.startDate))
+ .map((assignment) => (
+
- )}
-
- ),
- value: Object.keys(groupBySession(stats)).length,
- label: "Exams",
- },
- {
- icon: (
-
- ),
- value: stats.length,
- label: "Exercises",
- },
- {
- icon: (
-
- ),
- value: `${stats.length > 0 ? averageScore(stats) : 0}%`,
- label: "Average Score",
- },
- ]}
- />
-
-
- Bio
-
- {user.bio ||
- "Your bio will appear here, you can change it by clicking on your name in the top right corner."}
-
-
-
-
-
-
-
- Assignments
-
-
-
-
-
- {assignments.filter((a) => moment(a.endDate).isSameOrAfter(moment()))
- .length === 0 &&
- "Assignments will appear here. It seems that for now there are no assignments for you."}
- {assignments
- .filter((a) => moment(a.endDate).isSameOrAfter(moment()))
- .sort((a, b) => moment(a.startDate).diff(b.startDate))
- .map((assignment) => (
-
-
- You are not the person in charge of your time credits, please contact your administrator about this situation.
-
-
- If you believe this to be a mistake, please contact the platform's administration, thank you for your
- patience.
-
-
-
- An admin nor your agent have yet set the price intended to your requirements in terms of the amount of users you
- desire and your expected monthly duration.
-
-
- Please try again later or contact your agent or an admin, thank you for your patience.
-
-
+
+ You are not the person in charge of your time credits, please
+ contact your administrator about this situation.
+
+
+ If you believe this to be a mistake, please contact the
+ platform's administration, thank you for your patience.
+
+
+
+ An admin nor your agent have yet set the price intended to
+ your requirements in terms of the amount of users you desire
+ and your expected monthly duration.
+
+
+ Please try again later or contact your agent or an admin,
+ thank you for your patience.
+
+
+ )}
+
+
+ ) : (
+
+ )}
+ >
+ );
}
diff --git a/src/pages/action.tsx b/src/pages/action.tsx
index ea1d9687..f7564cd5 100644
--- a/src/pages/action.tsx
+++ b/src/pages/action.tsx
@@ -1,157 +1,227 @@
/* eslint-disable @next/next/no-img-element */
-import {toast, ToastContainer} from "react-toastify";
+import { toast, ToastContainer } from "react-toastify";
import axios from "axios";
-import {FormEvent, useEffect, useState} from "react";
+import { FormEvent, useEffect, useState } from "react";
import Head from "next/head";
import useUser from "@/hooks/useUser";
-import {Divider} from "primereact/divider";
+import { Divider } from "primereact/divider";
import Button from "@/components/Low/Button";
-import {BsArrowRepeat} from "react-icons/bs";
+import { BsArrowRepeat } from "react-icons/bs";
import Link from "next/link";
import Input from "@/components/Low/Input";
-import {useRouter} from "next/router";
+import { useRouter } from "next/router";
-export function getServerSideProps({query, res}: {query: {oobCode: string; mode: string; apiKey?: string; continueUrl?: string}; res: any}) {
- if (!query || !query.oobCode || !query.mode) {
- res.setHeader("location", "/login");
- res.statusCode = 302;
- res.end();
- return {
- props: {},
- };
- }
+export function getServerSideProps({
+ query,
+ res,
+}: {
+ query: {
+ oobCode: string;
+ mode: string;
+ continueUrl?: string;
+ };
+ res: any;
+}) {
+ if (!query || !query.oobCode || !query.mode) {
+ res.setHeader("location", "/login");
+ res.statusCode = 302;
+ res.end();
+ return {
+ props: {},
+ };
+ }
- return {
- props: {
- code: query.oobCode,
- mode: query.mode,
- apiKey: query.apiKey,
- ...query.continueUrl ? { continueUrl: query.continueUrl } : {},
- },
- };
+ return {
+ props: {
+ code: query.oobCode,
+ mode: query.mode,
+ ...(query.continueUrl ? { continueUrl: query.continueUrl } : {}),
+ },
+ };
}
-export default function Reset({code, mode, apiKey, continueUrl}: {code: string; mode: string; apiKey?: string; continueUrl?: string}) {
- const [password, setPassword] = useState("");
- const [isLoading, setIsLoading] = useState(false);
+export default function Reset({
+ code,
+ mode,
+ continueUrl,
+}: {
+ code: string;
+ mode: string;
+ continueUrl?: string;
+}) {
+ const [password, setPassword] = useState("");
+ const [isLoading, setIsLoading] = useState(false);
- const router = useRouter();
+ const router = useRouter();
- useUser({
- redirectTo: "/",
- redirectIfFound: true,
- });
+ useUser({
+ redirectTo: "/",
+ redirectIfFound: true,
+ });
- useEffect(() => {
- if (mode === "signIn") {
- axios
- .post<{ok: boolean}>("/api/reset/verify", {
- email: continueUrl?.replace("https://platform.encoach.com/", ""),
- })
- .then((response) => {
- if (response.data.ok) {
- toast.success("Your account has been verified!", {toastId: "verify-successful"});
- setTimeout(() => {
- router.reload();
- }, 1000);
- return;
- }
+ useEffect(() => {
+ if (mode === "signIn") {
+ axios
+ .post<{ ok: boolean }>("/api/reset/verify", {
+ email: continueUrl?.replace("https://platform.encoach.com/", ""),
+ })
+ .then((response) => {
+ if (response.data.ok) {
+ toast.success("Your account has been verified!", {
+ toastId: "verify-successful",
+ });
+ setTimeout(() => {
+ router.push("/");
+ }, 1000);
+ return;
+ }
- toast.error("Something went wrong! Please make sure to click the link in your e-mail again and input the correct e-mail!", {
- toastId: "verify-error",
- });
- })
- .catch(() => {
- toast.error("Something went wrong! Please make sure to click the link in your e-mail again and input the correct e-mail!", {
- toastId: "verify-error",
- });
- setIsLoading(false);
- });
- }
- });
+ toast.error(
+ "Something went wrong! Please make sure to click the link in your e-mail again and input the correct e-mail!",
+ {
+ toastId: "verify-error",
+ },
+ );
+ })
+ .catch(() => {
+ toast.error(
+ "Something went wrong! Please make sure to click the link in your e-mail again and input the correct e-mail!",
+ {
+ toastId: "verify-error",
+ },
+ );
+ setIsLoading(false);
+ });
+ }
+ });
- const login = (e: FormEvent) => {
- e.preventDefault();
+ const login = (e: FormEvent) => {
+ e.preventDefault();
- setIsLoading(true);
- axios
- .post<{ok: boolean}>("/api/reset/confirm", {code, password})
- .then((response) => {
- if (response.data.ok) {
- toast.success("Your password has been reset!", {toastId: "reset-successful"});
- setTimeout(() => {
- router.push("/login");
- }, 1000);
- return;
- }
+ setIsLoading(true);
+ axios
+ .post<{ ok: boolean }>("/api/reset/confirm", { code, password })
+ .then((response) => {
+ if (response.data.ok) {
+ toast.success("Your password has been reset!", {
+ toastId: "reset-successful",
+ });
+ setTimeout(() => {
+ router.push("/login");
+ }, 1000);
+ return;
+ }
- toast.error("Something went wrong! Please make sure to click the link in your e-mail again!", {toastId: "reset-error"});
- })
- .catch(() => {
- toast.error("Something went wrong! Please make sure to click the link in your e-mail again!", {toastId: "reset-error"});
- })
- .finally(() => setIsLoading(false));
- };
+ toast.error(
+ "Something went wrong! Please make sure to click the link in your e-mail again!",
+ { toastId: "reset-error" },
+ );
+ })
+ .catch(() => {
+ toast.error(
+ "Something went wrong! Please make sure to click the link in your e-mail again!",
+ { toastId: "reset-error" },
+ );
+ })
+ .finally(() => setIsLoading(false));
+ };
- return (
- <>
-
- Reset | EnCoach
-
-
-
-
-
-
-
-
-
-
- {mode === "resetPassword" && (
-
-
-
-
Reset your password
-
to your registered Email Address
-
-
-
+
+ Don't have an account?{" "}
+
+ Sign up
+
+
+
+ )}
+ {mode === "signIn" && (
+
+
+
+
+ Confirm your account
+
+
+ to your registered Email Address
+
+
+
+
+
+ Your e-mail is currently being verified, please wait a second.{" "}
+
+ Once it has been verified, you will be redirected to the home
+ page.
+
+