From 179a6d51638ebfd43b7081017efa2798f8a498d7 Mon Sep 17 00:00:00 2001 From: hamed <15238-genius.ha@users.noreply.drupalcode.org> Date: Tue, 18 Aug 2026 16:38:12 +0330 Subject: [PATCH] feat(doctor): open the first location on load MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every address started collapsed, so a doctor with one office made the visitor click before seeing where that office is — the thing they came to the section for. The first entry now renders expanded; the rest stay closed so a long list does not push the page down. Co-Authored-By: Claude Opus 5 (1M context) --- components/doctor/detailDoctor/cards/locations/Item.js | 4 ++-- components/doctor/detailDoctor/cards/locations/index.js | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/components/doctor/detailDoctor/cards/locations/Item.js b/components/doctor/detailDoctor/cards/locations/Item.js index 9433b68..b308979 100644 --- a/components/doctor/detailDoctor/cards/locations/Item.js +++ b/components/doctor/detailDoctor/cards/locations/Item.js @@ -11,8 +11,8 @@ import RoutingC from "@/components/icons/RoutingC"; // Leaflet به window نیاز دارد → فقط کلاینت const MapView = dynamic(() => import("@/components/common/MapView"), { ssr: false }); -function Item({ data, bookable = true }) { - const [isOpen, setIsOpen] = useState(false); +function Item({ data, bookable = true, defaultOpen = false }) { + const [isOpen, setIsOpen] = useState(defaultOpen); const [open, setOpen] = useState(false); const handleOpen = () => setOpen(true); diff --git a/components/doctor/detailDoctor/cards/locations/index.js b/components/doctor/detailDoctor/cards/locations/index.js index 950ad22..d5141c5 100644 --- a/components/doctor/detailDoctor/cards/locations/index.js +++ b/components/doctor/detailDoctor/cards/locations/index.js @@ -14,7 +14,13 @@ function Locations({ addresses, bookableAddressUuids = [] }) { {addresses.map((item, idx) => (
  • - + {/* اولین محل از ابتدا باز است: بازدیدکننده معمولاً یک آدرس بیشتر + نمی‌خواهد و بستنِ همه یعنی یک کلیک اضافه برای همان یک آدرس. */} + {addresses.length > idx + 1 && ( )}