refactor: remove FEATURE flags for doctor ratings and sharing in components
This commit is contained in:
@@ -10,7 +10,6 @@ import { isNoindexDoctor } from "@/lib/entityQuality";
|
|||||||
import specialtiesData from "@/data/specialties.json";
|
import specialtiesData from "@/data/specialties.json";
|
||||||
import { safeJsonLd } from "@/lib/sanitize";
|
import { safeJsonLd } from "@/lib/sanitize";
|
||||||
import { imageUrl, doctorTitle } from "@/helper";
|
import { imageUrl, doctorTitle } from "@/helper";
|
||||||
import { FEATURES } from "@/config/features";
|
|
||||||
|
|
||||||
const API_URL = process.env.NEXT_PUBLIC_API_URL;
|
const API_URL = process.env.NEXT_PUBLIC_API_URL;
|
||||||
const FALLBACK_IMG = "/assets/images/og-image.png";
|
const FALLBACK_IMG = "/assets/images/og-image.png";
|
||||||
@@ -190,9 +189,7 @@ async function Doctor({ params }) {
|
|||||||
url: imageUrl(doctor.img[0].url),
|
url: imageUrl(doctor.img[0].url),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
// امتیاز وقتی در صفحه پنهان است نباید در schema بیاید؛ گوگل داده ساختیافتهٔ
|
...(!isUnclaimed && Number(doctor.point) > 0 && {
|
||||||
// نامرئی را نقض راهنما میداند.
|
|
||||||
...(FEATURES.doctorRatings && !isUnclaimed && Number(doctor.point) > 0 && {
|
|
||||||
aggregateRating: {
|
aggregateRating: {
|
||||||
"@type": "AggregateRating",
|
"@type": "AggregateRating",
|
||||||
ratingValue: doctor.point,
|
ratingValue: doctor.point,
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import Telegram from "@/components/icons/Telegram";
|
|||||||
import Aparat from "@/components/icons/Aparat";
|
import Aparat from "@/components/icons/Aparat";
|
||||||
import Youtube from "@/components/icons/Youtube";
|
import Youtube from "@/components/icons/Youtube";
|
||||||
import Linkedin from "@/components/icons/Linkedin";
|
import Linkedin from "@/components/icons/Linkedin";
|
||||||
import { FEATURES } from "@/config/features";
|
|
||||||
|
|
||||||
const SOCIAL_ICONS = {
|
const SOCIAL_ICONS = {
|
||||||
instagram: Instagram,
|
instagram: Instagram,
|
||||||
@@ -23,7 +22,7 @@ const SOCIAL_ICONS = {
|
|||||||
|
|
||||||
function Title({ doctor }) {
|
function Title({ doctor }) {
|
||||||
const isUnclaimed = doctor?.owner_status !== "claimed";
|
const isUnclaimed = doctor?.owner_status !== "claimed";
|
||||||
const hasRating = FEATURES.doctorRatings && Number(doctor?.point) > 0;
|
const hasRating = Number(doctor?.point) > 0;
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col lg:flex-row items-center justify-start gap-[8px] lg:gap-[32px]">
|
<div className="flex flex-col lg:flex-row items-center justify-start gap-[8px] lg:gap-[32px]">
|
||||||
<CircularLoading width={100} height={100}>
|
<CircularLoading width={100} height={100}>
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
import Chart from "./chart";
|
import Chart from "./chart";
|
||||||
import Comment from "@/app/component/comment";
|
import Comment from "@/app/component/comment";
|
||||||
import ModalAnswer from "./modal/ModalAnswer";
|
import ModalAnswer from "./modal/ModalAnswer";
|
||||||
import { FEATURES } from "@/config/features";
|
|
||||||
|
|
||||||
function Comments({ doctor, comments, rateAggregate }) {
|
function Comments({ doctor, comments, rateAggregate }) {
|
||||||
const isUnclaimed = doctor?.owner_status !== "claimed";
|
const isUnclaimed = doctor?.owner_status !== "claimed";
|
||||||
@@ -31,10 +30,7 @@ function Comments({ doctor, comments, rateAggregate }) {
|
|||||||
</p>
|
</p>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{/* نمودار امتیاز/رضایت فعلاً پنهان است؛ خودِ نظرات نمایش داده میشود. */}
|
<Chart comments={comments} rateAggregate={rateAggregate} />
|
||||||
{FEATURES.doctorRatings && (
|
|
||||||
<Chart comments={comments} rateAggregate={rateAggregate} />
|
|
||||||
)}
|
|
||||||
<Comment comments={comments} doctor={doctor} />
|
<Comment comments={comments} doctor={doctor} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -4,16 +4,13 @@ import Title from "./Title";
|
|||||||
import AboutDcotor from "./cards/AboutDcotor";
|
import AboutDcotor from "./cards/AboutDcotor";
|
||||||
import Comments from "./cards/comments";
|
import Comments from "./cards/comments";
|
||||||
import Locations from "./cards/locations";
|
import Locations from "./cards/locations";
|
||||||
import { FEATURES } from "@/config/features";
|
|
||||||
|
|
||||||
function DetailDoctor({ doctor, comments, rateAggregate, addresses, bookableAddressUuids = [] }) {
|
function DetailDoctor({ doctor, comments, rateAggregate, addresses, bookableAddressUuids = [] }) {
|
||||||
return (
|
return (
|
||||||
<div className="w-full lg:w-[59%]">
|
<div className="w-full lg:w-[59%]">
|
||||||
{FEATURES.doctorShare && (
|
<div className="hidden lg:flex">
|
||||||
<div className="hidden lg:flex">
|
<Share data={doctor} />
|
||||||
<Share data={doctor} />
|
</div>
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<Title doctor={doctor} />
|
<Title doctor={doctor} />
|
||||||
<Link />
|
<Link />
|
||||||
<AboutDcotor doctor={doctor} />
|
<AboutDcotor doctor={doctor} />
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import CustomLoading from "@/app/component/loading/Custom";
|
|||||||
import Faq from "@/components/specialties/detail/Faq";
|
import Faq from "@/components/specialties/detail/Faq";
|
||||||
import specialtiesData from "@/data/specialties.json";
|
import specialtiesData from "@/data/specialties.json";
|
||||||
import { doctorTitle } from "@/helper";
|
import { doctorTitle } from "@/helper";
|
||||||
import { FEATURES } from "@/config/features";
|
|
||||||
|
|
||||||
// مقصد تمیز صفحهٔ فرود تخصص؛ اگر تخصص slug نداشت، لیست پزشکان با کوئری قدیمی.
|
// مقصد تمیز صفحهٔ فرود تخصص؛ اگر تخصص slug نداشت، لیست پزشکان با کوئری قدیمی.
|
||||||
const specialtyHref = (name) => {
|
const specialtyHref = (name) => {
|
||||||
@@ -36,11 +35,9 @@ function DoctorPage({ doctor, comments, rateAggregate, addresses, bookableAddres
|
|||||||
<p className="text-[#525252] text-nowrap mr-1">{doctorTitle(doctor?.name)}</p>
|
<p className="text-[#525252] text-nowrap mr-1">{doctorTitle(doctor?.name)}</p>
|
||||||
</div>
|
</div>
|
||||||
</CustomLoading>
|
</CustomLoading>
|
||||||
{FEATURES.doctorShare && (
|
<div className="flex lg:hidden">
|
||||||
<div className="flex lg:hidden">
|
<Share data={doctor} />
|
||||||
<Share data={doctor} />
|
</div>
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</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
|
<DetailDoctor
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { getStateInfoClient } from "@/lib/getStateInfoClient";
|
|||||||
import { doctorTitle } from "@/helper";
|
import { doctorTitle } from "@/helper";
|
||||||
|
|
||||||
import StarDI from "@/components/icons/StarDI";
|
import StarDI from "@/components/icons/StarDI";
|
||||||
|
import { FEATURES } from "@/config/features";
|
||||||
|
|
||||||
const ACCENT = "#16528C";
|
const ACCENT = "#16528C";
|
||||||
const ACCENT_LIGHT = "#2E77C4";
|
const ACCENT_LIGHT = "#2E77C4";
|
||||||
@@ -36,8 +37,8 @@ function PosterLight({ data, onQrReady }) {
|
|||||||
|
|
||||||
const badges = [
|
const badges = [
|
||||||
Number(data?.experience) > 0 && { label: `${data.experience} سال تجربه` },
|
Number(data?.experience) > 0 && { label: `${data.experience} سال تجربه` },
|
||||||
(data?.point ?? 0) > 0 && { icon: <StarDI />, label: `امتیاز ${data.point}` },
|
FEATURES.posterRatings && (data?.point ?? 0) > 0 && { icon: <StarDI />, label: `امتیاز ${data.point}` },
|
||||||
(data?.satisfaction ?? 0) > 0 && { label: `${data.satisfaction}% رضایت بیماران` },
|
FEATURES.posterRatings && (data?.satisfaction ?? 0) > 0 && { label: `${data.satisfaction}% رضایت بیماران` },
|
||||||
].filter(Boolean);
|
].filter(Boolean);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import TelefonPoster from "@/components/icons/TelefonPoster";
|
|||||||
import Instagram from "@/components/icons/Instagram";
|
import Instagram from "@/components/icons/Instagram";
|
||||||
import Telegram from "@/components/icons/Telegram";
|
import Telegram from "@/components/icons/Telegram";
|
||||||
import Whatsapp from "@/components/icons/Whatsapp";
|
import Whatsapp from "@/components/icons/Whatsapp";
|
||||||
|
import { FEATURES } from "@/config/features";
|
||||||
|
|
||||||
const POSTER_BG =
|
const POSTER_BG =
|
||||||
"linear-gradient(160deg, #0B2A4A 0%, #16528C 52%, #2E77C4 100%)";
|
"linear-gradient(160deg, #0B2A4A 0%, #16528C 52%, #2E77C4 100%)";
|
||||||
@@ -66,11 +67,11 @@ function Poster({ data, onQrReady }) {
|
|||||||
icon: <span className="text-[#F6B93B] text-[20px] leading-none">◆</span>,
|
icon: <span className="text-[#F6B93B] text-[20px] leading-none">◆</span>,
|
||||||
label: `${data.experience} سال تجربه`,
|
label: `${data.experience} سال تجربه`,
|
||||||
},
|
},
|
||||||
(data?.point ?? 0) > 0 && {
|
FEATURES.posterRatings && (data?.point ?? 0) > 0 && {
|
||||||
icon: <StarDI />,
|
icon: <StarDI />,
|
||||||
label: `امتیاز ${data.point}`,
|
label: `امتیاز ${data.point}`,
|
||||||
},
|
},
|
||||||
(data?.satisfaction ?? 0) > 0 && {
|
FEATURES.posterRatings && (data?.satisfaction ?? 0) > 0 && {
|
||||||
icon: <span className="text-[#4ADE80] text-[20px] leading-none">♥</span>,
|
icon: <span className="text-[#4ADE80] text-[20px] leading-none">♥</span>,
|
||||||
label: `${data.satisfaction}% رضایت`,
|
label: `${data.satisfaction}% رضایت`,
|
||||||
},
|
},
|
||||||
|
|||||||
+4
-6
@@ -4,11 +4,9 @@
|
|||||||
*/
|
*/
|
||||||
export const FEATURES = {
|
export const FEATURES = {
|
||||||
/**
|
/**
|
||||||
* دکمهٔ «اشتراک گذاری» صفحهٔ پزشک. ساخت **پوستر** هم داخل همین مودال است، پس
|
* امتیاز و درصد رضایت **روی پوسترِ اشتراکگذاری** (هر دو طرح تیره و روشن).
|
||||||
* خاموشکردن این سوییچ هر دو را با هم پنهان میکند.
|
* بقیهٔ نشانهای پوستر (سابقه، تخصص، تماس، QR) دستنخورده میمانند و خودِ
|
||||||
|
* صفحهٔ پزشک هم امتیازش را مثل قبل نشان میدهد.
|
||||||
*/
|
*/
|
||||||
doctorShare: false,
|
posterRatings: false,
|
||||||
|
|
||||||
/** امتیاز و درصد رضایت کاربران — هم زیر نام پزشک و هم نمودارِ بخش نظرات. */
|
|
||||||
doctorRatings: false,
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user