feat: رفع لینک /doctor/undefined و متمایزسازی صفحهٔ اصلی شهرها
- ایجاد پرامپت برای رفع خطای 404 ناشی از لینک `/doctor/undefined` در سایتهای بهبهان و یاسوج. - افزودن کامپوننت `CityHighlights` برای نمایش محتوای یکتا و آمار پزشکان و تخصصهای پرمراجعه در صفحهٔ اصلی هر شهر. - بهروزرسانی تستهای مربوط به کامپوننتهای `ItemDoctor` و `CityHighlights` برای اطمینان از عدم وجود لینکهای نامعتبر و نمایش صحیح اطلاعات. - ایجاد سند جدید برای مستندسازی خطاهای Search Console که باگ نیستند و نیاز به رفع ندارند. - افزودن تستهای واحد برای توابع `buildCityIntro` و دیگر توابع مرتبط با تولید متن یکتا برای صفحات لیست.
This commit is contained in:
+30
-22
@@ -14,6 +14,12 @@ import LikeD from "@/components/icons/LikeD";
|
||||
import PointD from "@/components/icons/PointD";
|
||||
|
||||
function ItemDoctor({ doctor, loading, setDoctors, priority = false }) {
|
||||
// بدون uuid لینکی وجود ندارد. اسکلتِ بارگذاری آبجکتِ بیuuid میدهد و پیش از این
|
||||
// شش `<a href="/doctor/undefined">` در HTML مینشست؛ Googlebot همان را crawl میکرد
|
||||
// و ۴۰۴ میگرفت (گزارش Search Console، ۳۰ ژوئیه).
|
||||
const href = doctor?.uuid ? `/doctor/${doctor.uuid}` : null;
|
||||
const label = doctor?.display_name || doctor?.name;
|
||||
|
||||
const handleLoading = () => {
|
||||
setDoctors((prevDoctors) =>
|
||||
prevDoctors.map((item) =>
|
||||
@@ -38,11 +44,13 @@ function ItemDoctor({ doctor, loading, setDoctors, priority = false }) {
|
||||
</CircularLoading>
|
||||
<div className="flex flex-col items-start justify-center gap-2">
|
||||
<TextLoading loading={loading} width={90} height={15}>
|
||||
<Link href={`/doctor/${doctor?.uuid}`}>
|
||||
<p className="text-[#3B3B3B] text-[14px] font-bold">
|
||||
{doctor?.display_name || doctor?.name}
|
||||
</p>
|
||||
</Link>
|
||||
{href ? (
|
||||
<Link href={href}>
|
||||
<p className="text-[#3B3B3B] text-[14px] font-bold">{label}</p>
|
||||
</Link>
|
||||
) : (
|
||||
<p className="text-[#3B3B3B] text-[14px] font-bold">{label}</p>
|
||||
)}
|
||||
</TextLoading>
|
||||
<TextLoading loading={loading} width={120} height={15}>
|
||||
<SpecialtyChips specialties={doctor?.specialties} />
|
||||
@@ -84,23 +92,23 @@ function ItemDoctor({ doctor, loading, setDoctors, priority = false }) {
|
||||
: "نوبتدهی غیرفعال است"}
|
||||
</p>
|
||||
</CustomLoading>
|
||||
{/* Arrow */}
|
||||
<Link
|
||||
href={`/doctor/${doctor?.uuid}`}
|
||||
aria-label={`مشاهده پروفایل ${doctor?.display_name || doctor?.name || "پزشک"}`}
|
||||
>
|
||||
<Button
|
||||
variant="contained"
|
||||
onClick={handleLoading}
|
||||
disabled={doctor?.loading}
|
||||
aria-label={`مشاهده پروفایل ${doctor?.display_name || doctor?.name || "پزشک"}`}
|
||||
className="!p-[14px] !absolute !left-4 !bottom-4 !rounded-full !w-fit"
|
||||
>
|
||||
<div className={doctor && doctor.loading ? "opacity-0" : ""}>
|
||||
<ArrowLeftD />
|
||||
</div>
|
||||
</Button>
|
||||
</Link>
|
||||
{/* Arrow — روی کارتِ بدون uuid (اسکلت بارگذاری) اصلاً رندر نمیشود؛ دکمهای که
|
||||
به جایی نمیرود، هم بیمعناست هم لینکِ شکسته در HTML میگذارد. */}
|
||||
{href && (
|
||||
<Link href={href} aria-label={`مشاهده پروفایل ${label || "پزشک"}`}>
|
||||
<Button
|
||||
variant="contained"
|
||||
onClick={handleLoading}
|
||||
disabled={doctor?.loading}
|
||||
aria-label={`مشاهده پروفایل ${label || "پزشک"}`}
|
||||
className="!p-[14px] !absolute !left-4 !bottom-4 !rounded-full !w-fit"
|
||||
>
|
||||
<div className={doctor && doctor.loading ? "opacity-0" : ""}>
|
||||
<ArrowLeftD />
|
||||
</div>
|
||||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user