- Bumped versions for several packages including: - @emotion/styled from ^11.14.0 to ^11.14.1 - @maptiler/sdk from ^2.4.0 to ^2.5.1 - @mui/icons-material from ^7.1.0 to ^7.3.6 - @mui/material from ^7.1.0 to ^7.3.6 - @mui/styled-engine-sc from ^6.0.0-alpha.18 to ^6.4.9 - @mui/x-charts from ^7.16.0 to ^7.29.1 - @mui/x-date-pickers from ^7.17.0 to ^7.29.4 - @next/third-parties from ^15.1.0 to ^15.5.7 - axios from ^1.7.7 to ^1.13.2 - dayjs from ^1.11.13 to ^1.11.19 - jspdf from ^3.0.1 to ^3.0.4 - next from ^14.2.20 to ^15.5.7 - next-themes from ^0.3.0 to ^0.4.6 - npm from ^10.8.2 to ^10.9.4 - react from ^18.0.0 to ^18.3.1 - react-dom from ^18 to ^18.3.1 - react-easy-crop from ^5.1.0 to ^5.5.6 - react-toastify from ^10.0.6 to ^11.0.5 - sharp from ^0.34.1 to ^0.34.5 - styled-components from ^6.1.11 to ^6.1.19 - stylis from ^4.3.4 to ^4.3.6 - swiper from ^11.1.9 to ^11.2.10 - postcss from ^8 to ^8.5.6 - prettier from ^3.5.3 to ^3.7.4 - tailwindcss from ^3.4.1 to ^3.4.18
112 lines
3.9 KiB
JavaScript
112 lines
3.9 KiB
JavaScript
import Image from "next/image";
|
|
import { Button } from "@mui/material";
|
|
import Link from "next/link";
|
|
import CustomLoading from "./loading/Custom";
|
|
import TextLoading from "./loading/Text";
|
|
import CircularLoading from "./loading/Circular";
|
|
|
|
// Icons
|
|
import ArrowLeftD from "@/components/icons/ArrowLeftD";
|
|
import ClockD from "@/components/icons/ClockD";
|
|
import LikeD from "@/components/icons/LikeD";
|
|
import PointD from "@/components/icons/PointD";
|
|
|
|
function ItemDoctor({ doctor, loading, setDoctors }) {
|
|
const handleLoading = () => {
|
|
setDoctors((prevDoctors) =>
|
|
prevDoctors.map((item) =>
|
|
item.id === doctor.id
|
|
? { ...item, loading: true }
|
|
: { ...item, loading: false }
|
|
)
|
|
);
|
|
};
|
|
|
|
return (
|
|
<li className="p-4 relative rounded-lg bg-[#FFF] border border-[#EFEFEF]">
|
|
{/* Detail Doctor */}
|
|
<div className="flex items-center justify-start gap-2.5">
|
|
<CircularLoading loading={loading} width={66} height={66}>
|
|
<Image
|
|
width={72}
|
|
height={72}
|
|
alt="image-doctor"
|
|
src={doctor?.img?.[0]?.url || "/assets/images/user.png"}
|
|
className="object-contain rounded-full w-[64px] md:w-[68px] lg:w-[72px] h-[64px] md:h-[68px] lg:h-[72px]"
|
|
/>
|
|
</CircularLoading>
|
|
<div className="flex flex-col items-start justify-center gap-2">
|
|
<TextLoading loading={loading} width={90} height={15}>
|
|
<Link href={`/doctor/${doctor?.uuid}`}>
|
|
<p className="text-[#3B3B3B] text-[14px] font-bold">
|
|
{doctor?.name}
|
|
</p>
|
|
</Link>
|
|
</TextLoading>
|
|
<TextLoading loading={loading} width={120} height={15}>
|
|
<p className="text-[#616161] text-[14px] font-normal">
|
|
تخصص:
|
|
{doctor?.specialties?.map(
|
|
(item, idx) =>
|
|
`${item.name} ${doctor.specialties.length === idx + 1 ? "" : "|"} `
|
|
)}
|
|
</p>
|
|
</TextLoading>
|
|
<CustomLoading loading={loading} width={100} height={25}>
|
|
<div className="flex rounded items-center justify-start gap-2">
|
|
<div className="p-1 bg-[#F8F8FF] flex items-center rounded-[4px] gap-0.5">
|
|
<LikeD />
|
|
<p className="text-[#616161] text-[12px] font-normal">
|
|
{doctor?.satisfaction}%
|
|
</p>
|
|
</div>
|
|
<div className="p-1 bg-[#F8F8FF] flex items-center rounded-[4px] gap-0.5">
|
|
<PointD />
|
|
<p className="text-[#616161] text-[12px] font-normal">
|
|
{doctor?.point}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</CustomLoading>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Hours of work */}
|
|
<div className="flex my-4 items-center justify-start gap-0.5">
|
|
<ClockD />
|
|
<TextLoading loading={loading} width={150} height={15}>
|
|
<p className="text-[#7E7E7E] text-[12px] font-normal">
|
|
ساعت کاری: {doctor?.hours_of_work}
|
|
</p>
|
|
</TextLoading>
|
|
</div>
|
|
<CustomLoading loading={loading} width={150} height={20}>
|
|
<p
|
|
className={`text-[12px] font-medium rounded w-fit p-1.5 ml-[52px]
|
|
${Number(doctor?.active)
|
|
? "bg-[rgba(5,_186,_88,_0.04)] text-[#05BA58]"
|
|
: "bg-[rgba(211,_47,_47,_0.04)] text-[#D32F2F]"
|
|
}`}
|
|
>
|
|
{doctor?.free_turn}
|
|
</p>
|
|
</CustomLoading>
|
|
{/* Arrow */}
|
|
<Link href={`/doctor/${doctor?.uuid}`}>
|
|
<Button
|
|
variant="contained"
|
|
onClick={handleLoading}
|
|
loading={doctor?.loading}
|
|
className="!p-[14px] !absolute !left-4 !bottom-4 !rounded-full !w-fit"
|
|
>
|
|
<div className={doctor && doctor.loading ? "opacity-0" : ""}>
|
|
<ArrowLeftD />
|
|
</div>
|
|
</Button>
|
|
</Link>
|
|
</li>
|
|
);
|
|
}
|
|
|
|
export default ItemDoctor;
|