fix(dashboard): appointment detail fields + sidebar hydration
- Appointment detail (DetailLg/DetailSm) read the real response shape: date/time from slot_start, specialty from doctor.specialties[0].name, phone from address.telephone. - Sidebar Head reads userInfo (cookie) after mount to avoid an SSR/client hydration mismatch on the user's name. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -60,7 +60,7 @@ function DetailLg({ appointmentData, loading }) {
|
||||
</TextLoading>
|
||||
<TextLoading loading={loading} width={80} height={18}>
|
||||
<p className="text-[#616161] text-[14px] md:text-[15px] lg:text-[16px] font-medium">
|
||||
تخصص: {appointmentData?.doctor?.specialty?.name}
|
||||
تخصص: {appointmentData?.doctor?.specialties?.[0]?.name}
|
||||
</p>
|
||||
</TextLoading>
|
||||
</div>
|
||||
@@ -73,7 +73,7 @@ function DetailLg({ appointmentData, loading }) {
|
||||
<p className="text-[#616161] text-[14px] lg:text-[20px] font-medium">
|
||||
تاریخ نوبت:{" "}
|
||||
<span className="text-[#2F2F2F] text-[14px] lg:text-[20px] font-bold">
|
||||
{convertTimestampToJalali(appointmentData?.start_time)}
|
||||
{convertTimestampToJalali(appointmentData?.slot_start)}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
@@ -84,7 +84,7 @@ function DetailLg({ appointmentData, loading }) {
|
||||
<p className="text-[#616161] text-[14px] lg:text-[20px] font-medium">
|
||||
زمان نوبت:{" "}
|
||||
<span className="text-[#2F2F2F] text-[14px] lg:text-[20px] font-bold">
|
||||
ساعت {appointmentData?.slot?.time}
|
||||
ساعت {convertTimestampToTime(appointmentData?.slot_start)}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
@@ -126,7 +126,7 @@ function DetailLg({ appointmentData, loading }) {
|
||||
<p className="text-[#616161] text-[14px] lg:text-[16px] font-normal">
|
||||
تلفن:{" "}
|
||||
<span className="text-[#2F2F2F] text-[14px] lg:text-[16px] font-normal">
|
||||
{appointmentData?.address?.phone}
|
||||
{appointmentData?.address?.telephone}
|
||||
</span>
|
||||
</p>
|
||||
</li>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Button } from "@mui/material";
|
||||
import React, { useRef } from "react";
|
||||
import ButtonData from "./ButtonData";
|
||||
import TextLoading from "@/app/component/loading/Text";
|
||||
import { convertTimestampToJalali } from "@/helper";
|
||||
import { convertTimestampToJalali, convertTimestampToTime } from "@/helper";
|
||||
import html2canvas from "html2canvas";
|
||||
import jsPDF from "jspdf";
|
||||
|
||||
@@ -56,7 +56,7 @@ function DetailSm({ appointmentData, loading }) {
|
||||
</TextLoading>
|
||||
<TextLoading loading={loading} width={70} height={14}>
|
||||
<p className="text-[#7E7E7E] text-[14px] font-normal">
|
||||
{appointmentData?.doctor?.specialty?.name}
|
||||
{appointmentData?.doctor?.specialties?.[0]?.name}
|
||||
</p>
|
||||
</TextLoading>
|
||||
</div>
|
||||
@@ -70,7 +70,7 @@ function DetailSm({ appointmentData, loading }) {
|
||||
</TextLoading>
|
||||
<TextLoading loading={loading} width={55} height={16}>
|
||||
<p className="text-[#525252] text-[16px] font-medium">
|
||||
{convertTimestampToJalali(appointmentData?.start_time)}
|
||||
{convertTimestampToJalali(appointmentData?.slot_start)}
|
||||
</p>
|
||||
</TextLoading>
|
||||
</li>
|
||||
@@ -81,7 +81,7 @@ function DetailSm({ appointmentData, loading }) {
|
||||
</TextLoading>
|
||||
<TextLoading loading={loading} width={60} height={16}>
|
||||
<p className="text-[#525252] text-[16px] font-medium">
|
||||
{appointmentData?.slot?.time}
|
||||
{convertTimestampToTime(appointmentData?.slot_start)}
|
||||
</p>
|
||||
</TextLoading>
|
||||
</li>
|
||||
@@ -112,7 +112,7 @@ function DetailSm({ appointmentData, loading }) {
|
||||
</li>
|
||||
<TextLoading loading={loading} width={100} height={18}>
|
||||
<p className="text-[#7E7E7E] text-[14px] font-normal mt-[12px]">
|
||||
تلفن: <span className="text-[#616161]">{appointmentData?.address?.phone}</span>
|
||||
تلفن: <span className="text-[#616161]">{appointmentData?.address?.telephone}</span>
|
||||
</p>
|
||||
</TextLoading>
|
||||
</ul>
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
import { getParsedUserInfo } from "@/helper";
|
||||
import Image from "next/image";
|
||||
import { imageUrl } from "@/helper";
|
||||
"use client";
|
||||
|
||||
function Head({ user }) {
|
||||
const userInfo = getParsedUserInfo();
|
||||
import { useEffect, useState } from "react";
|
||||
import { getParsedUserInfo, imageUrl } from "@/helper";
|
||||
import Image from "next/image";
|
||||
|
||||
function Head() {
|
||||
const [userInfo, setUserInfo] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
setUserInfo(getParsedUserInfo());
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="w-full flex flex-row md:flex-col items-center justify-center md:justify-start gap-[12px] md:gap-[4px]">
|
||||
|
||||
Reference in New Issue
Block a user