Connect the existing doctor-page review UI to the rebuilt backend contract
(see clinicpro feat/rating-multidimensional).
- page.js fetches the rating aggregate alongside comments and passes
rateAggregate down to the chart (point / satisfaction / 5 dimensions).
- Submit form sends the five dimensions with doctor_uuid; comment/reply
send {doctor_uuid, comment, parent}; 401/403 ERR_RATING_NOT_ELIGIBLE
surface friendly guidance.
- Like/dislike call POST /like/{uuid} with value and update from the
response; replies render nested.
- ModalAnswer gates the submit button on GET /rate/{uuid}/eligibility.
- services/response.js: getRateEligibility, postCommentsLike(uuid, value),
drop unused patchDoctorRate. Fix hardcoded modal title; empty-state for
no comments. Remove orphaned AnswerField.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
"use client";
|
|
|
|
import Chart from "./chart";
|
|
import Comment from "@/app/component/comment";
|
|
import ModalAnswer from "./modal/ModalAnswer";
|
|
|
|
function Comments({ doctor, comments, rateAggregate }) {
|
|
return (
|
|
<div className="mt-[24px] sm:mt-[27px] md:mt-[29px] lg:mt-[32px]">
|
|
<a
|
|
id="comments"
|
|
className="absolute -translate-y-[148px] sm:-translate-y-[157px] md:-translate-y-[166px] lg:-translate-y-[176px]"
|
|
></a>
|
|
<p className="text-[#525252] text-[16px] md:text-[18px] lg:text-[20px] font-bold">
|
|
نظرات کاربران{" "}
|
|
</p>
|
|
<div className="mt-[12px] sm:mt-[18px] md:mt-[24px] lg:mt-[32px] flex flex-col md:flex-row gap-y-[20px] items-start md:items-center justify-start">
|
|
<p className="text-[#616161] text-[16px] font-normal">
|
|
شما هم نظر خود را در مورد این پزشک به اشتراک بگذارید:
|
|
</p>
|
|
<ModalAnswer doctor={doctor} />
|
|
</div>
|
|
<Chart comments={comments} rateAggregate={rateAggregate} />
|
|
<Comment comments={comments} doctor={doctor} />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default Comments;
|