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:
@@ -1,7 +1,7 @@
|
||||
import { numberToArStyle } from "@/helper";
|
||||
import { LinearProgress } from "@mui/material";
|
||||
|
||||
const label = [
|
||||
const fallbackLabels = [
|
||||
"برخورد مناسب پزشک",
|
||||
"تشخیص درست",
|
||||
"زمان انتظار در مطب",
|
||||
@@ -10,13 +10,16 @@ const label = [
|
||||
];
|
||||
|
||||
function ProgressDetail({ data, idx }) {
|
||||
const label = data?.label ?? fallbackLabels[idx];
|
||||
const progress = typeof data === "object" && data !== null ? data.progress : data;
|
||||
|
||||
return (
|
||||
<li className="flex items-center justify-start gap-2 w-full">
|
||||
<p className="text-[#525252] text-[14px] font-normal min-w-[120px] w-[118px]">
|
||||
{label[idx]}
|
||||
{label}
|
||||
</p>
|
||||
<LinearProgress
|
||||
value={data || 0}
|
||||
value={progress || 0}
|
||||
variant="determinate"
|
||||
className="!w-full lg:!w-[265px] !rounded-[10px] !bg-[#D7D7D7] !h-[11px]"
|
||||
sx={{
|
||||
@@ -27,9 +30,9 @@ function ProgressDetail({ data, idx }) {
|
||||
}}
|
||||
/>
|
||||
<p
|
||||
className={`text-[#525252] font-medium ${data ? "text-[20px]" : "text-[18px]"}`}
|
||||
className={`text-[#525252] font-medium ${progress ? "text-[20px]" : "text-[18px]"}`}
|
||||
>
|
||||
{data ? `${numberToArStyle(data)}%` : "بدون نمره"}
|
||||
{progress ? `${numberToArStyle(progress)}%` : "بدون نمره"}
|
||||
</p>
|
||||
</li>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user