fixed ToastContainer

This commit is contained in:
Amirhossein Mahmoodi
2023-08-01 09:22:22 +03:30
parent 131f80b0b5
commit 94bfa0c83f
5 changed files with 5 additions and 16 deletions

View File

@@ -5,11 +5,15 @@ import useUser from "@/lib/app/hooks/useUser";
import Head from "next/head";
import NextNProgress from "nextjs-progressbar";
import {useEffect} from "react";
import {ToastContainer} from "react-toastify";
import useDirection from "@/lib/app/hooks/useDirection";
function AppLayout({children, isBot}) {
const {languageIsReady} = useLanguage();
const {setLoadingPage} = useLoading();
const {userChangedLanguage, token, isAuth} = useUser();
const {directionApp} = useDirection();
useEffect(() => {
if (languageIsReady) {
if (token) {
@@ -91,6 +95,7 @@ function AppLayout({children, isBot}) {
color={theme.palette.secondary.dark}
options={{showSpinner: false}}
/>
{directionApp === "rtl" ? <ToastContainer rtl/> : <ToastContainer ltr/>}
{children}
</>
);

View File

@@ -2,15 +2,11 @@ import LoginComponent from "@/components/login";
import WithoutAuthMiddleware from "@/middlewares/WithoutAuth";
import {parse} from "next-useragent";
import "react-toastify/dist/ReactToastify.css";
import {ToastContainer} from "react-toastify";
import useDirection from "@/lib/app/hooks/useDirection";
export default function Login() {
const {directionApp} = useDirection();
return (
<WithoutAuthMiddleware>
<LoginComponent/>
{directionApp === "rtl" ? <ToastContainer rtl/> : <ToastContainer ltr/>}
</WithoutAuthMiddleware>
);
}

View File

@@ -2,15 +2,11 @@ import RegisterComponent from "@/components/register";
import WithoutAuthMiddleware from "@/middlewares/WithoutAuth";
import {parse} from "next-useragent";
import "react-toastify/dist/ReactToastify.css";
import {ToastContainer} from "react-toastify";
import useDirection from "@/lib/app/hooks/useDirection";
export default function Register() {
const {directionApp} = useDirection();
return (
<WithoutAuthMiddleware>
<RegisterComponent/>
{directionApp === "rtl" ? <ToastContainer rtl/> : <ToastContainer ltr/>}
</WithoutAuthMiddleware>
);
}

View File

@@ -2,15 +2,11 @@ import NavyComponent from "@/components/register/navy";
import WithoutAuthMiddleware from "@/middlewares/WithoutAuth";
import {parse} from "next-useragent";
import "react-toastify/dist/ReactToastify.css";
import {ToastContainer} from "react-toastify";
import useDirection from "@/lib/app/hooks/useDirection";
export default function Register() {
const {directionApp} = useDirection();
return (
<WithoutAuthMiddleware>
<NavyComponent/>
{directionApp === "rtl" ? <ToastContainer rtl/> : <ToastContainer ltr/>}
</WithoutAuthMiddleware>
);
}

View File

@@ -2,15 +2,11 @@ import WelfareServicesComponent from "@/components/register/welfare-services";
import WithoutAuthMiddleware from "@/middlewares/WithoutAuth";
import {parse} from "next-useragent";
import "react-toastify/dist/ReactToastify.css";
import {ToastContainer} from "react-toastify";
import useDirection from "@/lib/app/hooks/useDirection";
export default function Register() {
const {directionApp} = useDirection();
return (
<WithoutAuthMiddleware>
<WelfareServicesComponent/>
{directionApp === "rtl" ? <ToastContainer rtl/> : <ToastContainer ltr/>}
</WithoutAuthMiddleware>
);
}