feat(doctor): wire rich rating/review UI to multi-dimensional API

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>
This commit is contained in:
hamed
2026-06-16 00:26:20 +03:30
co-authored by Claude Opus 4.8
parent 12917cd900
commit 7d65239615
18 changed files with 320 additions and 287 deletions
+12 -17
View File
@@ -1,25 +1,20 @@
"use client";
import { useState } from "react";
import ItemUser from "./ItemUser";
function Comment({ comments }) {
const [update, setUpdate] = useState(false);
function Comment({ comments, doctor }) {
if (!comments?.length) {
return (
<p className="text-[#7E7E7E] text-[14px] font-normal mt-4">
هنوز نظری برای این پزشک ثبت نشده است.
</p>
);
}
return (
<ul
className={`flex flex-col comment-list !pl-2.5 justify-start max-h-[492px] overflow-auto items-start gap-12 mt-2 ${
false && "w-full"
}`}
>
{comments?.length > 0 &&
comments.map((item, idx) => (
<ItemUser
key={idx}
data={item}
update={update}
setUpdate={setUpdate}
/>
))}
<ul className="flex flex-col comment-list !pl-2.5 justify-start max-h-[492px] overflow-auto items-start gap-12 mt-2">
{comments.map((item) => (
<ItemUser key={item.uuid} data={item} doctor={doctor} />
))}
</ul>
);
}