change function and design page doctors & signin & signup & home & specialties & helper

This commit is contained in:
Ehsan
2025-05-21 16:44:34 +03:30
parent c8c217e286
commit 6c7709c342
13 changed files with 96 additions and 86 deletions
+15
View File
@@ -0,0 +1,15 @@
import Image from "next/image";
import Logo from "@/public/assets/images/logo.png";
function Poster() {
return (
<div className="bg-poster !pt-[32px] p-[24px]">
<div className="flex items-center justify-start gap-[5px]">
<Image src={Logo} width={30} height={30} alt="logo" />
<p className="text-[#E7EEF6] text-[16px] font-bold">nobat724.com</p>
</div>
</div>
);
}
export default Poster;
+1 -1
View File
@@ -41,7 +41,7 @@ function Share() {
sx={styleDefault}
className="!pt-[12px] md:!pt-[14px] lg:!py-[16px]
!px-[12px] sm:!px-[16px] md:!px-[20px] lg:!px-[24px]
!pb-[12px] sm:!pb-[16px] lg:!pb-[20px]"
!pb-[12px] sm:!pb-[16px] lg:!pb-[20px] !rounded-[8px] overflow-hidden"
>
<div className="flex items-center justify-between w-full">
<p className="text-[#3B3B3B] text-[14px] sm:text-[16px] md:text-[18px] lg:text-[20px] font-medium">
+2
View File
@@ -5,6 +5,7 @@ import AppointmentList from "./appointmentList";
import DetailDoctor from "./detailDoctor";
import Share from "./detailDoctor/Share";
import CustomLoading from "@/app/component/loading/Custom";
import Poster from "./Poster";
function DoctorPage({ doctor }) {
const [loading, setLoading] = useState(true);
@@ -30,6 +31,7 @@ function DoctorPage({ doctor }) {
<Share />
</div>
</div>
<Poster />
<div className="flex items-start justify-center gap-6 mt-[30px]">
<DetailDoctor doctor={doctor} loading={loading} />
<AppointmentList doctor={doctor} loading={loading} />
+7 -8
View File
@@ -18,19 +18,18 @@ function DoctorsPage({ params, matchedCity, matchedState }) {
province: matchedState?.name || params?.province,
city: matchedCity?.name || params?.city,
});
const findItem = (name, value) =>
specialties.find((item) => item[name] === value);
const itemCategory = findItem("id", params.category);
const itemSpecialties = findItem("id", params.specialties);
const findSpecial = (id) => specialties.find((item) => item.id === id);
const [data, setData] = useState({
category: itemCategory || "",
specialties: itemSpecialties
? { ...itemSpecialties, label: itemSpecialties.name }
category: findSpecial(params.specialties)?.parent
? findSpecial(findSpecial(params.specialties)?.parent)
: findSpecial(params.specialties) || "",
specialties: findSpecial(params.specialties)?.parent
? findSpecial(params.specialties)
: "",
turn: params && params.hasOwnProperty("turn") ? JSON.parse(params.turn) : 1,
gender: params.gender || "هر دو",
degree: params.degree || "متخصص",
degree: params.degree || "همه موارد",
});
useEffect(() => {
+11 -16
View File
@@ -3,25 +3,22 @@ import RadioContent from "./RadioContent";
import { FormControlLabel, Switch } from "@mui/material";
import { useRouter } from "next/navigation";
import { filterList } from "@/helper";
const group1 = ["خانم", "آقا", "هر دو"];
const group2 = ["فوق تخصص", "دکترای تخصصی", "متخصص", "دکتری"];
const gender = ["زن", "مرد", "هر دو"];
const degree = ["پزشک عمومی", "پزشک متخصص", "پزشک فوق تخصص", "همه موارد"];
function Content({ data, setData }) {
const router = useRouter();
const { parentList, childrenList } = filterList(data);
const changeUrl = (value, name, removeSpecialties) => {
const changeUrl = (value) => {
const current = new URLSearchParams(window.location.search);
current.set(name, value.id || value);
if (removeSpecialties) {
current.delete("specialties");
}
current.set("specialties", value.id || value);
const queryString = current.toString();
router.push(`/doctors?${queryString}`);
};
const changeData = (value, name, removeSpecialties) => {
changeUrl(value, name, removeSpecialties);
changeUrl(value);
const newData = data;
newData[name] = value;
if (removeSpecialties) {
@@ -34,20 +31,18 @@ function Content({ data, setData }) {
<div className="mt-[50px] px-[0px] md:px-[19px] lg:px-[38px] mb-[32px]">
<AutoCompleteSelect
list={parentList}
updateData={(value, name) => changeData(value, name, true)}
updateData={(value) => changeData(value, "category", true)}
sendAll={true}
value={data.category.name}
value={data.category?.name}
label="دسته بندی"
name="category"
/>
{!!childrenList.length && (
<div className="mt-[24px]">
<AutoCompleteSelect
list={childrenList}
updateData={changeData}
updateData={(value) => changeData(value, "specialties")}
sendAll={true}
value={data.specialties}
name="specialties"
value={data.specialties?.name}
label="تخصص"
/>
</div>
@@ -57,7 +52,7 @@ function Content({ data, setData }) {
changeData={changeData}
value={data.gender}
text="جنسیت پزشک"
group={group1}
group={gender}
name="gender"
/>
<span className="block mt-[16px] mb-[24px] w-full h-px bg-[#EFEFEF]"></span>
@@ -65,7 +60,7 @@ function Content({ data, setData }) {
changeData={changeData}
value={data.degree}
text="درجه علمی"
group={group2}
group={degree}
name="degree"
/>
<span className="block mt-[16px] mb-[24px] w-full h-px bg-[#EFEFEF]"></span>
-4
View File
@@ -1,12 +1,9 @@
import { frequentSearches } from "@/constans";
import { filterList } from "@/helper";
import { Button } from "@mui/material";
import specialties from "@/data/specialties.json";
import Link from "next/link";
function FrequentSearches() {
const childrenList = specialties.filter((item) => item.parent);
console.log(childrenList);
return (
<div className="flex items-center justify-center gap-[8px] sm:gap-[10px] md:gap-[13px] lg:gap-[16px] w-full">
@@ -20,7 +17,6 @@ function FrequentSearches() {
href={{
pathname: "/doctors",
query: {
category: item.parent,
specialties: item.id,
},
}}
+14 -2
View File
@@ -1,5 +1,6 @@
import Field from "@/app/component/element/Field";
import { formatPhoneNumber, validatePhoneNumber } from "@/helper";
import { request } from "@/services/response";
import { Button, InputAdornment } from "@mui/material";
import Link from "next/link";
import { useState } from "react";
@@ -15,6 +16,18 @@ function LogInPage({ setIsSendMsg, setStep, matchedCity }) {
setNum(formatted);
};
const handleReq = () => {
request
.auth("/")
.then(() => {
setIsSendMsg && setIsSendMsg(true);
setStep && setStep((prev) => prev + 1);
})
.catch(() => {
setLoading(false);
});
};
return (
<div
className="rounded-[16px] mt-[28px] opacity-page sm:mt-[14px] border border-solid sm:border-[#EFEFEF] bg-transparent sm:bg-[#FFF]
@@ -73,8 +86,7 @@ function LogInPage({ setIsSendMsg, setStep, matchedCity }) {
setError(checkedNum);
return;
}
setIsSendMsg && setIsSendMsg(true);
setStep && setStep((prev) => prev + 1);
handleReq();
}}
className="!rounded-[8px] !bg-[#5559CE] !py-[7.5px] md:!py-[8.5px] lg:!py-[10px]"
>