diff --git a/public/sitemap-0.xml b/public/sitemap-0.xml index 5296d57..f72be69 100644 --- a/public/sitemap-0.xml +++ b/public/sitemap-0.xml @@ -1,11 +1,11 @@ -https://modstagram.com/robots.txt2026-07-07T08:04:14.348Zdaily0.7 -https://modstagram.com/sitemap.xml2026-07-07T08:04:14.349Zdaily0.7 -https://modstagram.com/explore2026-07-07T08:04:14.350Zdaily0.7 -https://modstagram.com/academy/payment/failed2026-07-07T08:04:14.350Zdaily0.7 -https://modstagram.com/academy/payment/success2026-07-07T08:04:14.350Zdaily0.7 -https://modstagram.com/about-us2026-07-07T08:04:14.350Zmonthly0.8 +https://modstagram.com/robots.txt2026-07-07T14:45:45.374Zdaily0.7 +https://modstagram.com/sitemap.xml2026-07-07T14:45:45.376Zdaily0.7 +https://modstagram.com/explore2026-07-07T14:45:45.376Zdaily0.7 +https://modstagram.com/academy/payment/success2026-07-07T14:45:45.376Zdaily0.7 +https://modstagram.com/academy/payment/failed2026-07-07T14:45:45.376Zdaily0.7 +https://modstagram.com/about-us2026-07-07T14:45:45.376Zmonthly0.8 https://modstagram.comdaily1 https://modstagram.com/projectsdaily0.9 https://modstagram.com/billboardsdaily0.9 diff --git a/src/app/(auth)/(login)/forget-password-otp/page.tsx b/src/app/(auth)/(login)/forget-password-otp/page.tsx index 4eee0d4..0ea0242 100644 --- a/src/app/(auth)/(login)/forget-password-otp/page.tsx +++ b/src/app/(auth)/(login)/forget-password-otp/page.tsx @@ -15,6 +15,7 @@ import * as yup from "yup"; import { useRouter } from "next/navigation"; import { IVerifyOtp } from "@/types/types"; import { setAuthSession } from "@/lib/auth/session"; +import { AUTH_SUCCESS_DELAY_MS, pause } from "@/lib/auth/feedback"; // Validation schema using Yup const schema = yup.object({ @@ -29,6 +30,8 @@ function ForgetPasswordOtp() { const [isModalOpen, setModalOpen] = useState(false); const [otpExpired, setOtpExpired] = useState(false); const [resendLoading, setResendLoading] = useState(false); + const [isSuccess, setIsSuccess] = useState(false); + const [otpError, setOtpError] = useState(false); const { request, loading } = useAxios(); const mobile = typeof window !== "undefined" ? localStorage.getItem("mobile") : null; @@ -52,8 +55,12 @@ function ForgetPasswordOtp() { })) as IVerifyOtp; await setAuthSession(response.token); await localStorage.setItem("otp", values.otp); + setIsSuccess(true); + await pause(AUTH_SUCCESS_DELAY_MS); router.push("/change-passowrd"); } catch (err: any) { + setOtpError(true); + setIsSuccess(false); console.log("Unhandled error:", err?.message); } }, @@ -73,6 +80,8 @@ function ForgetPasswordOtp() { try { await request("POST", "/login", { mobile }); formik.setFieldValue("otp", ""); + setOtpError(false); + setIsSuccess(false); } finally { setResendLoading(false); } @@ -85,10 +94,15 @@ function ForgetPasswordOtp() { formik.setFieldValue("otp", otp)} + onChange={(otp) => { + formik.setFieldValue("otp", otp); + setOtpError(false); + setIsSuccess(false); + }} onComplete={() => setTimeout(() => formik.submitForm(), 400)} - error={Boolean(formik.touched.otp && formik.errors.otp)} - disabled={loading || otpExpired} + error={otpError || Boolean(formik.touched.otp && formik.errors.otp)} + success={isSuccess} + disabled={loading || otpExpired || isSuccess} /> {formik.touched.otp && formik.errors.otp && ( {formik.errors.otp} @@ -96,7 +110,7 @@ function ForgetPasswordOtp() { تایید کد diff --git a/src/app/(auth)/(login)/login-with-username/page.tsx b/src/app/(auth)/(login)/login-with-username/page.tsx index def2e84..1e3fe8f 100644 --- a/src/app/(auth)/(login)/login-with-username/page.tsx +++ b/src/app/(auth)/(login)/login-with-username/page.tsx @@ -15,6 +15,7 @@ import * as yup from "yup"; import { useRouter } from "next/navigation"; import { IVerifyOtp } from "@/types/types"; import { setAuthSession } from "@/lib/auth/session"; +import { AUTH_SUCCESS_DELAY_MS, pause } from "@/lib/auth/feedback"; // Validation schema using Yup const schema = yup.object().shape({ @@ -32,6 +33,8 @@ const schema = yup.object().shape({ function LoginWithUsername() { const router = useRouter(); const [isModalOpen, setModalOpen] = useState(false); + const [isSuccess, setIsSuccess] = useState(false); + const [authError, setAuthError] = useState(false); const { request, loading } = useAxios(); const mobile = typeof window !== "undefined" ? localStorage.getItem("mobile") : null; @@ -56,6 +59,8 @@ function LoginWithUsername() { user_type: response.user_type, step: response.step, }); + setIsSuccess(true); + await pause(AUTH_SUCCESS_DELAY_MS); router.refresh(); router.push("/"); break; @@ -64,12 +69,16 @@ function LoginWithUsername() { id: response.id, step: response.step, }); + setIsSuccess(true); + await pause(AUTH_SUCCESS_DELAY_MS); router.push("/auth"); break; default: break; } } catch (err: any) { + setAuthError(true); + setIsSuccess(false); console.log("Unhandled error:", err?.message); } }, @@ -87,16 +96,18 @@ function LoginWithUsername() { name="username" type="text" placeholder="نام کاربری" - className={`border ${ - formik.touched.username && formik.errors.username - ? "border-red-500 dark:border-red-500" - : "border-gray-300" - }`} + success={isSuccess} + error={authError || Boolean(formik.touched.username && formik.errors.username)} value={formik.values.username} - onChange={formik.handleChange} + onChange={(e) => { + setAuthError(false); + setIsSuccess(false); + formik.handleChange(e); + }} onBlur={formik.handleBlur} + disabled={loading || isSuccess} /> - {formik.touched.username && formik.errors.username && ( + {formik.touched.username && formik.errors.username && !authError && ( {formik.errors.username} @@ -105,21 +116,23 @@ function LoginWithUsername() { name="password" placeholder="کلمه عبور" wrapperClassName="mt-4" - className={`border ${ - formik.touched.password && formik.errors.password - ? "border-red-500 dark:border-red-500" - : "border-gray-300" - }`} + success={isSuccess} + error={authError || Boolean(formik.touched.password && formik.errors.password)} value={formik.values.password} - onChange={formik.handleChange} + onChange={(e) => { + setAuthError(false); + setIsSuccess(false); + formik.handleChange(e); + }} onBlur={formik.handleBlur} + disabled={loading || isSuccess} /> - {formik.touched.password && formik.errors.password && ( + {formik.touched.password && formik.errors.password && !authError && ( {formik.errors.password} )} - + ورود diff --git a/src/app/(auth)/(login)/verify-otp/page.tsx b/src/app/(auth)/(login)/verify-otp/page.tsx index cc6cc03..4871a52 100644 --- a/src/app/(auth)/(login)/verify-otp/page.tsx +++ b/src/app/(auth)/(login)/verify-otp/page.tsx @@ -15,6 +15,7 @@ import * as yup from "yup"; import { useRouter } from "next/navigation"; import { IVerifyOtp } from "@/types/types"; import { setAuthSession } from "@/lib/auth/session"; +import { AUTH_SUCCESS_DELAY_MS, pause } from "@/lib/auth/feedback"; // Validation schema using Yup const schema = yup.object({ @@ -29,6 +30,8 @@ function VerifyOtp() { const [isModalOpen, setModalOpen] = useState(false); const [otpExpired, setOtpExpired] = useState(false); const [resendLoading, setResendLoading] = useState(false); + const [isSuccess, setIsSuccess] = useState(false); + const [otpError, setOtpError] = useState(false); const { request, loading } = useAxios(); const mobile = typeof window !== "undefined" ? localStorage.getItem("mobile") : null; @@ -58,6 +61,8 @@ function VerifyOtp() { user_type: response.user_type, step: response.step, }); + setIsSuccess(true); + await pause(AUTH_SUCCESS_DELAY_MS); router.refresh(); router.push("/"); break; @@ -66,6 +71,8 @@ function VerifyOtp() { id: response.id, step: response.step, }); + setIsSuccess(true); + await pause(AUTH_SUCCESS_DELAY_MS); switch (response.step) { case "user_name": @@ -90,6 +97,8 @@ function VerifyOtp() { } // router.push("/dashboard"); } catch (err: any) { + setOtpError(true); + setIsSuccess(false); console.log("Unhandled error:", err?.message); } }, @@ -109,6 +118,8 @@ function VerifyOtp() { try { await request("POST", "/login", { mobile }); formik.setFieldValue("otp", ""); + setOtpError(false); + setIsSuccess(false); } finally { setResendLoading(false); } @@ -121,10 +132,15 @@ function VerifyOtp() { formik.setFieldValue("otp", otp)} + onChange={(otp) => { + formik.setFieldValue("otp", otp); + setOtpError(false); + setIsSuccess(false); + }} onComplete={() => setTimeout(() => formik.submitForm(), 400)} - error={Boolean(formik.touched.otp && formik.errors.otp)} - disabled={loading || otpExpired} + error={otpError || Boolean(formik.touched.otp && formik.errors.otp)} + success={isSuccess} + disabled={loading || otpExpired || isSuccess} /> {formik.touched.otp && formik.errors.otp && ( @@ -133,7 +149,7 @@ function VerifyOtp() { تایید کد diff --git a/src/app/(auth)/(register)/register-otp/page.tsx b/src/app/(auth)/(register)/register-otp/page.tsx index f5ce4b7..e53f0fb 100644 --- a/src/app/(auth)/(register)/register-otp/page.tsx +++ b/src/app/(auth)/(register)/register-otp/page.tsx @@ -16,6 +16,7 @@ import * as yup from "yup"; import { IVerifyOtp } from "@/types/types"; import { useRouter } from "next/navigation"; import { setAuthSession } from "@/lib/auth/session"; +import { AUTH_SUCCESS_DELAY_MS, pause } from "@/lib/auth/feedback"; // Validation schema using Yup const schema = yup.object({ @@ -30,6 +31,8 @@ function RegisterOtp() { const [isModalOpen, setModalOpen] = useState(false); const [otpExpired, setOtpExpired] = useState(false); const [resendLoading, setResendLoading] = useState(false); + const [isSuccess, setIsSuccess] = useState(false); + const [otpError, setOtpError] = useState(false); const { request, loading } = useAxios(); const mobile = typeof window !== "undefined" ? localStorage.getItem("mobile") : null; @@ -53,6 +56,8 @@ function RegisterOtp() { })) as IVerifyOtp; await localStorage.setItem("otp", values.otp); await setAuthSession(response.token, { step: response.step }); + setIsSuccess(true); + await pause(AUTH_SUCCESS_DELAY_MS); response.step === "user_name" ? router.push("/register/username") : response.step === "password" @@ -63,6 +68,8 @@ function RegisterOtp() { ? router.push("/register/usertype") : router.push("/verify/avatar"); } catch (err: any) { + setOtpError(true); + setIsSuccess(false); console.log("Unhandled error:", err.message); } }, @@ -82,6 +89,8 @@ function RegisterOtp() { try { await request("POST", "/register", { mobile }); formik.setFieldValue("otp", ""); + setOtpError(false); + setIsSuccess(false); } finally { setResendLoading(false); } @@ -94,10 +103,15 @@ function RegisterOtp() { formik.setFieldValue("otp", otp)} + onChange={(otp) => { + formik.setFieldValue("otp", otp); + setOtpError(false); + setIsSuccess(false); + }} onComplete={() => setTimeout(() => formik.submitForm(), 400)} - error={Boolean(formik.touched.otp && formik.errors.otp)} - disabled={loading || otpExpired} + error={otpError || Boolean(formik.touched.otp && formik.errors.otp)} + success={isSuccess} + disabled={loading || otpExpired || isSuccess} /> {formik.touched.otp && formik.errors.otp && ( {formik.errors.otp} @@ -105,7 +119,7 @@ function RegisterOtp() { تایید کد diff --git a/src/app/(auth)/verify/confirm/page.tsx b/src/app/(auth)/verify/confirm/page.tsx index 4facdd1..9c48f93 100644 --- a/src/app/(auth)/verify/confirm/page.tsx +++ b/src/app/(auth)/verify/confirm/page.tsx @@ -2,24 +2,43 @@ "use client"; import Container from "@/components/elements/Container"; -import React, { useState } from "react"; +import React, { useEffect, useState } from "react"; import { useRouter } from "next/navigation"; import AuthNextButton from "@/components/auth/AuthNextButton"; import Modal from "@/components/elements/Modal"; import Link from "next/link"; -import Image from "next/image"; import ProfileAvatar from "@/components/main/ProfileAvatar"; +import VerificationBadge from "@/components/main/VerificationBadge"; import { useUser } from "@/hooks/useUser"; +import useAxios from "@/hooks/useAxios"; function Confirm() { - const user = useUser(); + const { request } = useAxios(); const router = useRouter(); const [showModal, setShowModal] = useState(false); const [navigating, setNavigating] = useState(false); const userType: string | null = typeof window !== "undefined" ? localStorage.getItem("usertype") : null; + const [verifiedStatus, setVerifiedStatus] = useState(null); + + useEffect(() => { + const markComplete = async () => { + try { + const response = await request<{ is_verified?: string }>( + "POST", + "/verify/complete", + {} + ); + setVerifiedStatus(response?.is_verified ?? "pending"); + } catch { + setVerifiedStatus(user?.is_verified ?? "pending"); + } + }; + markComplete(); + }, []); + const confirmHandler = () => { setNavigating(true); if (userType !== "employer") { @@ -49,26 +68,11 @@ function Confirm() { {user?.first_name && user?.first_name + " " + user?.last_name} -
- {user?.user_name} - {user?.is_verified === "verified" ? ( - {"verify - ) : user?.is_verified === "pending" ? ( - {"not-verify - ) : ( - "" - )} - +
+ {user?.user_name} +
diff --git a/src/app/(auth)/verify/location/page.tsx b/src/app/(auth)/verify/location/page.tsx index 2327e1b..c5bfbdd 100644 --- a/src/app/(auth)/verify/location/page.tsx +++ b/src/app/(auth)/verify/location/page.tsx @@ -91,8 +91,8 @@ function LocationPage() { address: values.address, province_id: values.stateId, city_id: values.cityId, - lat: values.markerCoordinate[0], - lng: values.markerCoordinate[1], + lat: values.markerCoordinate[1], + lng: values.markerCoordinate[0], show_location: isCheckedOne, }); router.push("/verify/national-cart"); @@ -230,7 +230,12 @@ function LocationPage() { )}