diff --git a/package.json b/package.json index cbb68a7..cd0e072 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "dev": "next dev", "build": "next build", "start": "next start", + "publish-3001": "next start -p 3001", "lint": "next lint" }, "dependencies": { diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 9359b01..84ffa11 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -71,7 +71,10 @@ "text_field_enter_your_navgan_id": "شماره ناوگان خود را وارد کنید", "error_message_required": "اجباری!", "button_request_verification": "دریافت کد یکبارمصرف", - "button_submit": "ورود" + "button_submit": "ورود", + "button_back_to_send_data": "بازگشت", + "sent_token_to": "ارسال پیامک به شماره", + "change_phone_number": "تغییر شماره" }, "Dashboard": { "dashboard_page": "داشبورد" diff --git a/src/components/register-navy/SendToken.jsx b/src/components/register-navy/SendToken.jsx index 62bbb86..376e18b 100644 --- a/src/components/register-navy/SendToken.jsx +++ b/src/components/register-navy/SendToken.jsx @@ -1,3 +1,4 @@ +import LinkRouting from "@/core/components/LinkRouting"; import Notifications from "@/core/components/notifications"; import StyledForm from "@/core/components/StyledForm"; import { REGISTER } from "@/core/data/apiRoutes"; @@ -6,12 +7,17 @@ import FullPageLayout from "@/layouts/FullPageLayout"; import useDirection from "@/lib/app/hooks/useDirection"; import useUser from "@/lib/app/hooks/useUser"; import LoginIcon from "@mui/icons-material/Login"; +import ReplyAllIcon from "@mui/icons-material/ReplyAll"; import { Box, Button, Container, + Grid, + Link, Paper, - Stack, TextField, Typography + Stack, + TextField, + Typography, } from "@mui/material"; import axios from "axios"; import { Field, Formik } from "formik"; @@ -19,7 +25,7 @@ import { useTranslations } from "next-intl"; import Image from "next/image"; import * as Yup from "yup"; -const SendToken = ({ PhoneNumber, nationalId, navganId, typeId }) => { +const SendToken = ({ PhoneNumber, nationalId, navganId, typeId, setOtpToken }) => { const t = useTranslations(); const { directionApp } = useDirection(); const { setToken } = useUser(); @@ -106,6 +112,33 @@ const SendToken = ({ PhoneNumber, nationalId, navganId, typeId }) => { : null } /> + {/* + + + */} + {/* */} + + {/* */} + {/* */} diff --git a/src/components/register-navy/SendUserData.jsx b/src/components/register-navy/SendUserData.jsx index 1433266..5bb09f4 100644 --- a/src/components/register-navy/SendUserData.jsx +++ b/src/components/register-navy/SendUserData.jsx @@ -23,8 +23,11 @@ import * as Yup from "yup"; const SendUserData = ({ setOtpToken, setPhoneNumber, + PhoneNumber, setNationalId, + nationalId, setNavganId, + navganId, setTypeId, }) => { const t = useTranslations(); @@ -35,9 +38,9 @@ const SendUserData = ({ const initialValues = { type_id: "1", - phone_number: "", - national_id: "", - navgan_id: "", + phone_number: PhoneNumber, + national_id: nationalId, + navgan_id: navganId, }; const validationSchema = Yup.object().shape({ phone_number: Yup.string().required( diff --git a/src/components/register-navy/index.jsx b/src/components/register-navy/index.jsx index 7a136c7..89b3596 100644 --- a/src/components/register-navy/index.jsx +++ b/src/components/register-navy/index.jsx @@ -17,6 +17,9 @@ const RegisterNavyComponent = () => { setNationalId={setNationalId} setNavganId={setNavganId} setTypeId={setTypeId} + PhoneNumber={PhoneNumber} + nationalId={nationalId} + navganId={navganId} /> ); } else { @@ -26,6 +29,7 @@ const RegisterNavyComponent = () => { nationalId={nationalId} navganId={navganId} typeId={typeId} + setOtpToken={setOtpToken} /> ); } diff --git a/src/core/data/headerProfileItems.jsx b/src/core/data/headerProfileItems.jsx index 63e661a..90831ba 100644 --- a/src/core/data/headerProfileItems.jsx +++ b/src/core/data/headerProfileItems.jsx @@ -2,18 +2,6 @@ import BorderColorIcon from "@mui/icons-material/BorderColor"; import PasswordIcon from "@mui/icons-material/Password"; const headerProfileItems = [ - { - key: 0, - name: "header.edit_profile", - route: "/dashboard/edit-profile", - icon: , - }, - { - key: 1, - name: "header.change_password", - route: "/dashboard/change-password", - icon: , - }, ]; export default headerProfileItems; diff --git a/src/layouts/AppLayout.jsx b/src/layouts/AppLayout.jsx index 2f7988e..fc4445f 100644 --- a/src/layouts/AppLayout.jsx +++ b/src/layouts/AppLayout.jsx @@ -1,4 +1,5 @@ import theme from "@/core/utils/theme"; +import useLanguage from "@/lib/app/hooks/useLanguage"; import useLoading from "@/lib/app/hooks/useLoading"; import useUser from "@/lib/app/hooks/useUser"; import Head from "next/head"; @@ -6,11 +7,17 @@ import NextNProgress from "nextjs-progressbar"; import { useEffect } from "react"; function AppLayout({ children, isBot }) { + const { languageIsReady } = useLanguage(); const { setLoadingPage } = useLoading(); - const { token, isAuth } = useUser(); + const { userChangedLanguage, token, isAuth } = useUser(); useEffect(() => { + if (languageIsReady) { if (token) { if (isAuth) { + if (userChangedLanguage) { + setLoadingPage(true); + return; + } setLoadingPage(false); return; } @@ -19,7 +26,14 @@ function AppLayout({ children, isBot }) { } setLoadingPage(false); return; - }, [token, isAuth]); + } + setLoadingPage(true); + }, [languageIsReady, token, isAuth, userChangedLanguage]); + + if (!isBot) { + if (userChangedLanguage) return; + if (!languageIsReady) return; + } return ( <> diff --git a/src/layouts/dashboardLayouts/header/ProfileData.jsx b/src/layouts/dashboardLayouts/header/ProfileData.jsx index c3fdf58..eb25403 100644 --- a/src/layouts/dashboardLayouts/header/ProfileData.jsx +++ b/src/layouts/dashboardLayouts/header/ProfileData.jsx @@ -10,9 +10,6 @@ export default function ProfileData() { alt="User Image" src={user.user_avatar} /> - - {user.user_username} - ); }