add publish script and work on registery pages

This commit is contained in:
2023-07-24 12:52:58 +03:30
parent 14b13e1309
commit a9929e8a09
8 changed files with 68 additions and 23 deletions

View File

@@ -6,6 +6,7 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"publish-3001": "next start -p 3001",
"lint": "next lint"
},
"dependencies": {

View File

@@ -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": "داشبورد"

View File

@@ -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
}
/>
{/* <Grid
container
rowSpacing={{ xs: 1, sm: 0 }}
sx={{
flexDirection: { xs: "column-reverse", sm: "row" },
}}
>
<Grid item xs={12} sm={6} sx={{ pr: { xs: 0, sm: 1 } }}>
<Button
fullWidth
type="back"
variant="outlined"
size="large"
onClick={() => setOtpToken(false)}
endIcon={<ReplyAllIcon />}
disabled={props.isSubmitting ? true : false}
>
{t("RegisterPage.button_back_to_send_data")}
</Button>
</Grid> */}
{/* <Grid item xs={12} sm={6} sx={{ pl: { xs: 0, sm: 1 } }}> */}
<Button size="small" onClick={() => setOtpToken(false)}>
<Link underline="hover">
{t("RegisterPage.sent_token_to")}: {PhoneNumber}{" "}
{t("RegisterPage.change_phone_number")}
</Link>
</Button>
<Button
fullWidth
type="submit"
@@ -116,6 +149,8 @@ const SendToken = ({ PhoneNumber, nationalId, navganId, typeId }) => {
>
{t("RegisterPage.button_submit")}
</Button>
{/* </Grid> */}
{/* </Grid> */}
</Stack>
</StyledForm>
</Stack>

View File

@@ -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(

View File

@@ -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}
/>
);
}

View File

@@ -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: <BorderColorIcon />,
},
{
key: 1,
name: "header.change_password",
route: "/dashboard/change-password",
icon: <PasswordIcon />,
},
];
export default headerProfileItems;

View File

@@ -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 (
<>

View File

@@ -10,9 +10,6 @@ export default function ProfileData() {
alt="User Image"
src={user.user_avatar}
/>
<Typography sx={{ fontSize: 15, fontWeight: 600 }} textAlign="center">
{user.user_username}
</Typography>
</Stack>
);
}