diff --git a/src/app/blog/Card13.tsx b/src/app/blog/Card13.tsx index 71e2c90..54d30c1 100644 --- a/src/app/blog/Card13.tsx +++ b/src/app/blog/Card13.tsx @@ -14,7 +14,7 @@ const Card13: FC = ({ className = "", post }) => { return ( -
+

diff --git a/src/app/blog/[...slug]/page.tsx b/src/app/blog/[...slug]/page.tsx index 47d68f1..25aa5af 100644 --- a/src/app/blog/[...slug]/page.tsx +++ b/src/app/blog/[...slug]/page.tsx @@ -1,4 +1,4 @@ -"use client" +"use client"; import React, { useEffect, useState } from "react"; import { DEMO_POSTS } from "@/data/posts"; @@ -14,7 +14,7 @@ import Image from "next/image"; import travelhero2Image from "@/images/travelhero2.png"; import Link from "next/link"; import { Route } from "@/routers/types"; -import { BiLike , BiDislike } from "react-icons/bi"; +import { BiLike, BiDislike } from "react-icons/bi"; import Survey from "./Survey"; import axiosInstance from "@/components/api/axios"; @@ -25,21 +25,14 @@ const Page = ({ params: { stepIndex: string }; searchParams?: { [key: string]: string | string[] | undefined }; }) => { + const [blog, setBlog] = useState(); - const [ blog , setBlog] = useState() - - useEffect(()=>{ - - axiosInstance.get(`/api/blogs/${params.slug[0]}/`) - .then((response)=>{ + useEffect(() => { + axiosInstance.get(`/api/blogs/${params.slug[0]}/`).then((response) => { setBlog(response.data); - - }) - - }) + }); + }); const renderHeader = () => { - - return (
@@ -94,36 +87,32 @@ const Page = ({
+ > +
); }; const renderTags = () => { - return ( - - ); - }; + console.log(blog?.tags[0].name); + return( + + (
+ {blog?.tags.map((item) => ( + + + + {item.name} + + + ))} +
) +) + }; const renderCommentForm = () => { return ( @@ -214,7 +203,7 @@ const Page = ({ {renderContent()} {renderTags()}
- + {/* {renderCommentForm()} */} {/* {renderCommentLists()} */}
diff --git a/src/app/forgot-password/page.tsx b/src/app/forgot-password/page.tsx index efa6d26..45df5a1 100644 --- a/src/app/forgot-password/page.tsx +++ b/src/app/forgot-password/page.tsx @@ -10,6 +10,7 @@ import { useUserContext } from "@/components/contexts/userContext"; import { ToastContainer, toast } from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; import { PhoneNumberUtil, PhoneNumberFormat } from "google-libphonenumber"; // Import libphonenumber +import { BiShow, BiHide } from "react-icons/bi"; export interface PageSignUpProps {} @@ -18,14 +19,20 @@ const PageSignUp: FC = () => { const { setForm, setMethod } = useUserContext(); const phoneUtil = PhoneNumberUtil.getInstance(); - const [name, setName] = useState(''); - const [countryCode, setCountryCode] = useState('968'); - const [phoneNumber, setPhoneNumber] = useState(''); - const [password, setPassword] = useState(''); - const [confirmPassword, setConfirmPassword] = useState(''); - const [loading , setLoading] = useState(false) - - const [errors, setErrors] = useState<{ phoneNumber?: string; password?: string; confirmPassword?: string; countryCode? : string }>({}); + const [name, setName] = useState(""); + const [countryCode, setCountryCode] = useState("968"); + const [phoneNumber, setPhoneNumber] = useState(""); + const [password, setPassword] = useState(""); + const [confirmPassword, setConfirmPassword] = useState(""); + const [loading, setLoading] = useState(false); + const [showPassword, setShowPassword] = useState(false); + const [showConfirm, setShowConfirm] = useState(false); + const [errors, setErrors] = useState<{ + phoneNumber?: string; + password?: string; + confirmPassword?: string; + countryCode?: string; + }>({}); const countryCodeHandler = (e: React.ChangeEvent) => { if (e.target.value.length <= 3) { @@ -35,7 +42,10 @@ const PageSignUp: FC = () => { const validatePhoneNumber = () => { try { - const number = phoneUtil.parseAndKeepRawInput("+" + countryCode + phoneNumber, countryCode); + const number = phoneUtil.parseAndKeepRawInput( + "+" + countryCode + phoneNumber, + countryCode + ); if (!phoneUtil.isValidNumber(number)) { return "Invalid phone number."; } @@ -46,12 +56,17 @@ const PageSignUp: FC = () => { }; const validateForm = () => { - const newErrors: { phoneNumber?: string; password?: string; confirmPassword?: string } = {}; + const newErrors: { + phoneNumber?: string; + password?: string; + confirmPassword?: string; + } = {}; const phoneError = validatePhoneNumber(); if (phoneError) newErrors.phoneNumber = phoneError; if (!password) newErrors.password = "Password is required."; - if (password !== confirmPassword) newErrors.confirmPassword = "Passwords do not match."; + if (password !== confirmPassword) + newErrors.confirmPassword = "Passwords do not match."; setErrors(newErrors); return Object.keys(newErrors).length === 0; // Return true if no errors @@ -73,7 +88,7 @@ const PageSignUp: FC = () => { }, [errors]); const submitHandler = async () => { - setLoading(true) + setLoading(true); setErrors({}); // Clear previous errors if (!validateForm()) { @@ -108,10 +123,9 @@ const PageSignUp: FC = () => { progress: undefined, theme: "light", }); - }finally{ - setLoading(false) + } finally { + setLoading(false); } - }; return ( @@ -121,13 +135,24 @@ const PageSignUp: FC = () => { Change Password

-
e.preventDefault()}> + e.preventDefault()} + >
diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx index 9588c88..b28c86b 100644 --- a/src/app/login/page.tsx +++ b/src/app/login/page.tsx @@ -9,7 +9,8 @@ import { useRouter } from "next/navigation"; import { useUserContext } from "@/components/contexts/userContext"; import { ToastContainer, toast } from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; -import { PhoneNumberUtil } from 'google-libphonenumber'; +import { PhoneNumberUtil } from "google-libphonenumber"; +import { BiShow, BiHide } from "react-icons/bi"; export interface PageLoginProps {} @@ -23,6 +24,7 @@ const PageLogin: FC = () => { const [countryCode, setCountryCode] = useState("968"); const [loading, setLoading] = useState(false); const [errors, setErrors] = useState<{ phoneNumber?: string; password?: string }>({}); + const [showPassword, setShowPassword] = useState(false); // New state for show/hide password // Redirect to home if the user is already logged in useEffect(() => { @@ -149,12 +151,12 @@ const PageLogin: FC = () => {
e.preventDefault()}>