From fda66b32eaf347ad992db87659fc17c6994750d0 Mon Sep 17 00:00:00 2001 From: Amirhossein Mahmoodi Date: Tue, 1 Aug 2023 10:05:35 +0330 Subject: [PATCH 1/3] fixed title pages --- src/pages/_app.jsx | 2 ++ src/pages/dashboard/change-password/index.jsx | 3 +-- src/pages/dashboard/edit-profile/index.jsx | 3 +-- src/pages/dashboard/index.jsx | 3 +-- src/pages/dashboard/machinary-expert/index.jsx | 3 +-- src/pages/dashboard/passenger-boss/index.jsx | 3 +-- src/pages/dashboard/passenger-office-chief/index.jsx | 3 +-- src/pages/dashboard/province-manager/index.jsx | 3 +-- src/pages/dashboard/transportation-assistant/index.jsx | 3 +-- src/pages/index.jsx | 3 +-- src/pages/login-expert.jsx | 3 +-- 11 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx index 573bef2..85b03cd 100644 --- a/src/pages/_app.jsx +++ b/src/pages/_app.jsx @@ -6,6 +6,7 @@ import {LoadingProvider} from "@/lib/app/contexts/loading"; import {UserProvider} from "@/lib/app/contexts/user"; import "moment/locale/fa"; import {NextIntlProvider} from "next-intl"; +import TitlePage from "@/core/components/TitlePage"; const App = ({Component, pageProps}) => { return ( @@ -14,6 +15,7 @@ const App = ({Component, pageProps}) => { + diff --git a/src/pages/dashboard/change-password/index.jsx b/src/pages/dashboard/change-password/index.jsx index 380b5ff..670e184 100644 --- a/src/pages/dashboard/change-password/index.jsx +++ b/src/pages/dashboard/change-password/index.jsx @@ -1,12 +1,10 @@ import DashboardChangePasswordComponent from "@/components/dashboard/change-password"; -import TitlePage from "@/core/components/TitlePage"; import WithAuthMiddleware from "@/middlewares/WithAuth"; import {parse} from "next-useragent"; export default function LoanFollowUp() { return ( - ); @@ -17,6 +15,7 @@ export async function getServerSideProps({req, locale}) { return { props: { messages: (await import(`&/locales/${locale}/app.json`)).default, + title: "Dashboard.change_password", isBot, }, }; diff --git a/src/pages/dashboard/edit-profile/index.jsx b/src/pages/dashboard/edit-profile/index.jsx index cf68add..9460506 100644 --- a/src/pages/dashboard/edit-profile/index.jsx +++ b/src/pages/dashboard/edit-profile/index.jsx @@ -1,12 +1,10 @@ import DashboardEditProfile from "@/components/dashboard/edit-profile"; -import TitlePage from "@/core/components/TitlePage"; import WithAuthMiddleware from "@/middlewares/WithAuth"; import {parse} from "next-useragent"; export default function LoanFollowUp() { return ( - ); @@ -17,6 +15,7 @@ export async function getServerSideProps({req, locale}) { return { props: { messages: (await import(`&/locales/${locale}/app.json`)).default, + title: "Dashboard.edit_profile", isBot, }, }; diff --git a/src/pages/dashboard/index.jsx b/src/pages/dashboard/index.jsx index 83bbb7c..af824d5 100644 --- a/src/pages/dashboard/index.jsx +++ b/src/pages/dashboard/index.jsx @@ -1,12 +1,10 @@ import DashboardFirstComponent from "@/components/dashboard/first"; -import TitlePage from "@/core/components/TitlePage"; import WithAuthMiddleware from "@/middlewares/WithAuth"; import {parse} from "next-useragent"; export default function Dashboard() { return ( - ); @@ -17,6 +15,7 @@ export async function getServerSideProps({req, locale}) { return { props: { messages: (await import(`&/locales/${locale}/app.json`)).default, + title: "Dashboard.dashboard_page", isBot, }, }; diff --git a/src/pages/dashboard/machinary-expert/index.jsx b/src/pages/dashboard/machinary-expert/index.jsx index 0f94415..edef041 100644 --- a/src/pages/dashboard/machinary-expert/index.jsx +++ b/src/pages/dashboard/machinary-expert/index.jsx @@ -1,5 +1,4 @@ import DashboardMachinaryOfficeComponent from "@/components/dashboard/machinary-office"; -import TitlePage from "@/core/components/TitlePage"; import RolePermission from "@/middlewares/RolePermission"; import WithAuthMiddleware from "@/middlewares/WithAuth"; import {parse} from "next-useragent"; @@ -9,7 +8,6 @@ export default function PassengerOffice() { return ( - @@ -21,6 +19,7 @@ export async function getServerSideProps({req, locale}) { return { props: { messages: (await import(`&/locales/${locale}/app.json`)).default, + title: "Dashboard.machinary_office_page", isBot, }, }; diff --git a/src/pages/dashboard/passenger-boss/index.jsx b/src/pages/dashboard/passenger-boss/index.jsx index ab40851..1d36dcb 100644 --- a/src/pages/dashboard/passenger-boss/index.jsx +++ b/src/pages/dashboard/passenger-boss/index.jsx @@ -1,5 +1,4 @@ import DashboardPassengerBossComponent from "@/components/dashboard/passenger-boss"; -import TitlePage from "@/core/components/TitlePage"; import RolePermission from "@/middlewares/RolePermission"; import WithAuthMiddleware from "@/middlewares/WithAuth"; import {parse} from "next-useragent"; @@ -9,7 +8,6 @@ export default function PassengerBoss() { return ( - @@ -21,6 +19,7 @@ export async function getServerSideProps({req, locale}) { return { props: { messages: (await import(`&/locales/${locale}/app.json`)).default, + title: "Dashboard.passenger_boss_page", isBot, }, }; diff --git a/src/pages/dashboard/passenger-office-chief/index.jsx b/src/pages/dashboard/passenger-office-chief/index.jsx index 0ff7720..1fa2c64 100644 --- a/src/pages/dashboard/passenger-office-chief/index.jsx +++ b/src/pages/dashboard/passenger-office-chief/index.jsx @@ -1,5 +1,4 @@ import DashboardPassengerOfficeComponent from "@/components/dashboard/passenger-office"; -import TitlePage from "@/core/components/TitlePage"; import RolePermission from "@/middlewares/RolePermission"; import WithAuthMiddleware from "@/middlewares/WithAuth"; import {parse} from "next-useragent"; @@ -9,7 +8,6 @@ export default function PassengerOffice() { return ( - @@ -21,6 +19,7 @@ export async function getServerSideProps({req, locale}) { return { props: { messages: (await import(`&/locales/${locale}/app.json`)).default, + title: "Dashboard.passenger_office_page", isBot, }, }; diff --git a/src/pages/dashboard/province-manager/index.jsx b/src/pages/dashboard/province-manager/index.jsx index 748ba4c..cd362f4 100644 --- a/src/pages/dashboard/province-manager/index.jsx +++ b/src/pages/dashboard/province-manager/index.jsx @@ -1,5 +1,4 @@ import DashboardProvinceManagerComponent from "@/components/dashboard/province-manager"; -import TitlePage from "@/core/components/TitlePage"; import RolePermission from "@/middlewares/RolePermission"; import WithAuthMiddleware from "@/middlewares/WithAuth"; import {parse} from "next-useragent"; @@ -9,7 +8,6 @@ export default function PassengerOffice() { return ( - @@ -21,6 +19,7 @@ export async function getServerSideProps({req, locale}) { return { props: { messages: (await import(`&/locales/${locale}/app.json`)).default, + title: "Dashboard.province_manager_page", isBot, }, }; diff --git a/src/pages/dashboard/transportation-assistant/index.jsx b/src/pages/dashboard/transportation-assistant/index.jsx index 5727284..63beeb1 100644 --- a/src/pages/dashboard/transportation-assistant/index.jsx +++ b/src/pages/dashboard/transportation-assistant/index.jsx @@ -1,5 +1,4 @@ import DashboardTransportationAssistanceComponent from "@/components/dashboard/transportation-assistance"; -import TitlePage from "@/core/components/TitlePage"; import RolePermission from "@/middlewares/RolePermission"; import WithAuthMiddleware from "@/middlewares/WithAuth"; import {parse} from "next-useragent"; @@ -9,7 +8,6 @@ export default function TransportationAssistance() { return ( - @@ -21,6 +19,7 @@ export async function getServerSideProps({req, locale}) { return { props: { messages: (await import(`&/locales/${locale}/app.json`)).default, + title: "Dashboard.transportation_assistance", isBot, }, }; diff --git a/src/pages/index.jsx b/src/pages/index.jsx index 82c1f58..2e146c6 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -1,11 +1,9 @@ import FirstComponent from "@/components/first"; -import TitlePage from "@/core/components/TitlePage"; import {parse} from "next-useragent"; export default function Home() { return ( <> - ); @@ -16,6 +14,7 @@ export async function getServerSideProps({req, locale}) { return { props: { messages: (await import(`&/locales/${locale}/app.json`)).default, + title: "first_page", isBot, }, }; diff --git a/src/pages/login-expert.jsx b/src/pages/login-expert.jsx index 19eefc8..accace0 100644 --- a/src/pages/login-expert.jsx +++ b/src/pages/login-expert.jsx @@ -1,5 +1,4 @@ import LoginComponent from "@/components/login-expert"; -import TitlePage from "@/core/components/TitlePage"; import WithoutAuthMiddleware from "@/middlewares/WithoutAuth"; import {parse} from "next-useragent"; import "react-toastify/dist/ReactToastify.css"; @@ -10,7 +9,6 @@ export default function Login() { const {directionApp} = useDirection(); return ( - {directionApp === "rtl" ? : } @@ -22,6 +20,7 @@ export async function getServerSideProps({req, locale}) { return { props: { messages: (await import(`&/locales/${locale}/app.json`)).default, + title: "Titles.title_login_expert_page", isBot, }, }; From 2d577756d5752e37bb4e41d303b924d0cb091d98 Mon Sep 17 00:00:00 2001 From: Amirhossein Mahmoodi Date: Tue, 1 Aug 2023 10:06:42 +0330 Subject: [PATCH 2/3] fixed _document page --- src/pages/_document.jsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/pages/_document.jsx b/src/pages/_document.jsx index f71303f..c9c28bb 100644 --- a/src/pages/_document.jsx +++ b/src/pages/_document.jsx @@ -1,4 +1,4 @@ -import {createEmotionCacheLtr} from "@/core/utils/createEmotionCache"; +import {createEmotionCacheRtl} from "@/core/utils/createEmotionCache"; import theme from "@/core/utils/theme"; import createEmotionServer from "@emotion/server/create-instance"; import Document, {Head, Html, Main, NextScript} from "next/document"; @@ -13,10 +13,6 @@ export default function MyDocument(props) { - {emotionStyleTags} @@ -32,7 +28,7 @@ MyDocument.getInitialProps = async (ctx) => { let cache; switch (ctx.locale) { case "fa": - cache = createEmotionCacheLtr(); + cache = createEmotionCacheRtl(); break; } From f7a3ec3e2b9ff7f09a61eace1fa3fabaca02dacf Mon Sep 17 00:00:00 2001 From: Amirhossein Mahmoodi Date: Tue, 1 Aug 2023 10:10:49 +0330 Subject: [PATCH 3/3] fixed ToastContainer --- src/layouts/AppLayout.jsx | 6 ++++++ src/layouts/dashboardLayouts/index.jsx | 5 ----- src/pages/login-expert.jsx | 5 ----- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/layouts/AppLayout.jsx b/src/layouts/AppLayout.jsx index d2c5da5..d0f26d7 100644 --- a/src/layouts/AppLayout.jsx +++ b/src/layouts/AppLayout.jsx @@ -5,11 +5,16 @@ 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"; +import "react-toastify/dist/ReactToastify.css"; 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 +96,7 @@ function AppLayout({children, isBot}) { color={theme.palette.secondary.dark} options={{showSpinner: false}} /> + {directionApp === "rtl" ? : } {children} ); diff --git a/src/layouts/dashboardLayouts/index.jsx b/src/layouts/dashboardLayouts/index.jsx index ed0ee31..fae51d2 100644 --- a/src/layouts/dashboardLayouts/index.jsx +++ b/src/layouts/dashboardLayouts/index.jsx @@ -4,14 +4,10 @@ import Header from "./header"; import Sidebar from "./sidebar"; import {Toolbar} from "@mui/material"; import BreadCrumbs from "./breadcrumbs"; -import {ToastContainer} from "react-toastify"; -import "react-toastify/dist/ReactToastify.css"; -import useDirection from "@/lib/app/hooks/useDirection"; const drawerWidth = 240; const DashboardLayouts = (props) => { - const {directionApp} = useDirection(); const {window} = props; const [mobileOpen, setMobileOpen] = useState(false); const container = @@ -42,7 +38,6 @@ const DashboardLayouts = (props) => { {props.children} - {directionApp === "rtl" ? : } ); }; diff --git a/src/pages/login-expert.jsx b/src/pages/login-expert.jsx index accace0..1cc6abf 100644 --- a/src/pages/login-expert.jsx +++ b/src/pages/login-expert.jsx @@ -1,16 +1,11 @@ import LoginComponent from "@/components/login-expert"; 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 ( - {directionApp === "rtl" ? : } ); }