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:
@@ -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>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user