added internationalization to pages [WIP]

This commit is contained in:
daniel31x13
2024-06-04 16:59:49 -04:00
parent 2c87459f35
commit d261bd39ec
32 changed files with 1299 additions and 1263 deletions
+14 -9
View File
@@ -1,19 +1,25 @@
import CenteredForm from "@/layouts/CenteredForm";
import { signIn } from "next-auth/react";
import Link from "next/link";
import { useRouter } from "next/router";
import React, { useState } from "react";
import toast from "react-hot-toast";
import { useTranslation } from "next-i18next";
import getServerSideProps from "@/lib/client/getServerSideProps";
export default function EmailConfirmaion() {
const router = useRouter();
const { t } = useTranslation();
const [submitLoader, setSubmitLoader] = useState(false);
const resend = async () => {
if (submitLoader) return;
else if (!router.query.email) return;
setSubmitLoader(true);
const load = toast.loading("Authenticating...");
const load = toast.loading(t("authenticating"));
const res = await signIn("email", {
email: decodeURIComponent(router.query.email as string),
@@ -25,29 +31,28 @@ export default function EmailConfirmaion() {
setSubmitLoader(false);
toast.success("Verification email sent.");
toast.success(t("verification_email_sent"));
};
return (
<CenteredForm>
<div className="p-4 max-w-[30rem] min-w-80 w-full rounded-2xl shadow-md mx-auto border border-neutral-content bg-base-200">
<p className="text-center text-2xl sm:text-3xl font-extralight mb-2 ">
Please check your Email
{t("check_your_email")}
</p>
<div className="divider my-3"></div>
<p>
A sign in link has been sent to your email address. If you don't see
the email, check your spam folder.
</p>
<p>{t("verification_email_sent_desc")}</p>
<div className="mx-auto w-fit mt-3">
<div className="btn btn-ghost btn-sm" onClick={resend}>
Resend Email
{t("resend_email")}
</div>
</div>
</div>
</CenteredForm>
);
}
export { getServerSideProps };