refactor: pass doctorSlug prop to AppointmentList and ItemAppointment components

This commit is contained in:
hamed
2025-11-12 21:05:06 +03:30
parent 7e655356e5
commit 573edc1eb9
4 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ async function Doctor({ params: { slug } }) {
return ( return (
<Layout> <Layout>
<DoctorPage doctor={doctor} comments={comments} /> <DoctorPage doctor={doctor} comments={comments} slug={slug} />
</Layout> </Layout>
); );
} }
@@ -6,7 +6,7 @@ import { Button } from "@mui/material";
import Image from "next/image"; import Image from "next/image";
import Link from "next/link"; import Link from "next/link";
function ItemAppointment({ turn, loading }) { function ItemAppointment({ turn, loading, doctorSlug }) {
return ( return (
<li <li
key={turn.id} key={turn.id}
@@ -50,7 +50,7 @@ function ItemAppointment({ turn, loading }) {
</p> </p>
</TextLoading> </TextLoading>
</div> </div>
<Link href={loading ? "#" : `/appointment/${turn.id}`}> <Link href={loading ? "#" : `/appointment/${doctorSlug}`}>
<Button <Button
variant="contained" variant="contained"
className="!py-2 !px-3 xl:!px-6 gap-1" className="!py-2 !px-3 xl:!px-6 gap-1"
+3 -3
View File
@@ -5,12 +5,12 @@ import ItemAppointment from "./ItemAppointment";
import ArrowLeftD from "@/components/icons/ArrowLeftD"; import ArrowLeftD from "@/components/icons/ArrowLeftD";
import Link from "next/link"; import Link from "next/link";
function AppointmentList({ doctor, loading }) { function AppointmentList({ doctor, loading, doctorSlug }) {
return ( return (
<> <>
<ul className="hidden sticky top-[122px] sm:top-[150px] mt:top-[178px] lg:top-[206px] lg:flex w-[38%] flex-col justify-start items-center gap-8"> <ul className="hidden sticky top-[122px] sm:top-[150px] mt:top-[178px] lg:top-[206px] lg:flex w-[38%] flex-col justify-start items-center gap-8">
{doctor && ( {doctor && (
<ItemAppointment loading={loading} turn={doctor} key={doctor.id} /> <ItemAppointment loading={loading} turn={doctor} key={doctor.id} doctorSlug={doctorSlug} />
)} )}
</ul> </ul>
<div <div
@@ -20,7 +20,7 @@ function AppointmentList({ doctor, loading }) {
<p className="text-[#05BA58] text-[11px] font-normal"> <p className="text-[#05BA58] text-[11px] font-normal">
{doctor && doctor?.free_turn} {doctor && doctor?.free_turn}
</p> </p>
<Link href={`/appointment/${doctor && doctor?.id}`}> <Link href={`/appointment/${doctorSlug}`}>
<Button <Button
variant="contained" variant="contained"
className="!py-2 !px-4 gap-1 !text-[14px] !font-medium" className="!py-2 !px-4 gap-1 !text-[14px] !font-medium"
+2 -2
View File
@@ -3,7 +3,7 @@ import DetailDoctor from "./detailDoctor";
import Share from "./detailDoctor/Share"; import Share from "./detailDoctor/Share";
import CustomLoading from "@/app/component/loading/Custom"; import CustomLoading from "@/app/component/loading/Custom";
function DoctorPage({ doctor, comments }) { function DoctorPage({ doctor, comments, slug }) {
return ( return (
<div className="pt-[92px] sm:pt-[120px] mt:pt-[148px] lg:pt-[176px] mt-[px] padding-responsive"> <div className="pt-[92px] sm:pt-[120px] mt:pt-[148px] lg:pt-[176px] mt-[px] padding-responsive">
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
@@ -24,7 +24,7 @@ function DoctorPage({ doctor, comments }) {
</div> </div>
<div className="flex items-start justify-center gap-6 mt-[30px]"> <div className="flex items-start justify-center gap-6 mt-[30px]">
<DetailDoctor doctor={doctor} comments={comments} /> <DetailDoctor doctor={doctor} comments={comments} />
<AppointmentList doctor={doctor} /> <AppointmentList doctor={doctor} doctorSlug={slug} />
</div> </div>
</div> </div>
); );