feat(doctor): open the first location on load

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) <noreply@anthropic.com>
This commit is contained in:
hamed
2026-08-18 16:38:12 +03:30
co-authored by Claude Opus 5
parent 6293c64c25
commit 179a6d5163
2 changed files with 9 additions and 3 deletions
@@ -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);
@@ -14,7 +14,13 @@ function Locations({ addresses, bookableAddressUuids = [] }) {
{addresses.map((item, idx) => (
<CustomLoading key={idx} width="full" height={40}>
<li className="w-full">
<Item data={item} bookable={bookable.has(item.uuid)} />
{/* اولین محل از ابتدا باز است: بازدیدکننده معمولاً یک آدرس بیشتر
نمی‌خواهد و بستنِ همه یعنی یک کلیک اضافه برای همان یک آدرس. */}
<Item
data={item}
bookable={bookable.has(item.uuid)}
defaultOpen={idx === 0}
/>
{addresses.length > idx + 1 && (
<span className="w-full h-px bg-[#EFEFEF] block my-[12px] md:my-[14px] lg:my-[16px]"></span>
)}