The profile decided "نوبتدهی غیرفعال است" from `doctor.active` alone, while the page already had `booking_locations` — the more precise source, since the backend only returns locations that are genuinely bookable. The two could disagree, and for a doctor bookable only at a clinic they did. A shared `bookingState` helper now drives both the desktop card and the mobile bar: any location means bookable, the label comes from the earliest `next_available_at`, and locations with no capacity yet read as "فعلاً نوبت خالی ندارد" rather than disabled. With no locations at all it falls back to the previous `doctor.active` / `free_turn` fields. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
52 lines
2.0 KiB
JavaScript
52 lines
2.0 KiB
JavaScript
import Link from "next/link";
|
|
import AppointmentList from "./appointmentList";
|
|
import ClaimProfileSection from "./claim";
|
|
import DetailDoctor from "./detailDoctor";
|
|
import Share from "./detailDoctor/Share";
|
|
import CustomLoading from "@/app/component/loading/Custom";
|
|
|
|
function DoctorPage({ doctor, comments, rateAggregate, addresses, bookableAddressUuids = [], bookingLocations = [], slug }) {
|
|
return (
|
|
<div className="pt-[92px] sm:pt-[120px] mt:pt-[148px] lg:pt-[176px] mt-[px] padding-responsive">
|
|
<div className="flex items-center justify-between">
|
|
<CustomLoading width={180} height={25}>
|
|
<div className="flex items-center justify-start text-[14px] md:text-[16px] font-normal">
|
|
<h2 className="text-[#9B9B9B] text-nowrap flex items-center">
|
|
{doctor?.specialties?.map((item, idx) => (
|
|
<span key={item.id ?? item.name} className="flex items-center">
|
|
<Link
|
|
href={`/doctors?specialty=${encodeURIComponent(item.name)}`}
|
|
className="hover:text-[#525252]"
|
|
>
|
|
{item.name}
|
|
</Link>
|
|
<span className="mx-1">
|
|
{doctor.specialties.length === idx + 1 ? ">" : "|"}
|
|
</span>
|
|
</span>
|
|
))}
|
|
</h2>
|
|
<p className="text-[#525252] text-nowrap mr-1">{doctor?.name}</p>
|
|
</div>
|
|
</CustomLoading>
|
|
<div className="flex lg:hidden">
|
|
<Share data={doctor} />
|
|
</div>
|
|
</div>
|
|
<div className="flex items-start justify-center gap-6 mt-[30px]">
|
|
<DetailDoctor
|
|
doctor={doctor}
|
|
comments={comments}
|
|
rateAggregate={rateAggregate}
|
|
addresses={addresses}
|
|
bookableAddressUuids={bookableAddressUuids}
|
|
/>
|
|
<AppointmentList doctor={doctor} doctorSlug={slug} bookingLocations={bookingLocations} />
|
|
</div>
|
|
<ClaimProfileSection doctor={doctor} />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default DoctorPage;
|