feat(doctor map): replace Google Maps iframe with Leaflet (OSM)
The Google Maps iframe was blocked by CSP (frame-src falls back to default-src 'self'). Switched the doctor-page location map to react-leaflet with OpenStreetMap tiles — no iframe, and CSP already allows https image tiles (img-src 'self' https:). Marker icons are bundled from the leaflet package (no CDN). MapView is dynamically imported (ssr:false) since Leaflet needs window. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import dynamic from "next/dynamic";
|
||||
import { Button } from "@mui/material";
|
||||
import ArrowBottomGrayD from "@/components/icons/ArrowBottomGrayD";
|
||||
import ModalOpenLocation from "@/app/component/openLocation";
|
||||
import RoutingWhiteC from "@/components/icons/RoutingWhiteC";
|
||||
import RoutingC from "@/components/icons/RoutingC";
|
||||
|
||||
// Leaflet به window نیاز دارد → فقط کلاینت
|
||||
const MapView = dynamic(() => import("./MapView"), { ssr: false });
|
||||
|
||||
function Item({ data }) {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
@@ -64,13 +68,10 @@ function Item({ data }) {
|
||||
</div>
|
||||
{isOpen && data?.map?.latitude && data?.map?.longitude && (
|
||||
<div className="w-full relative h-[219px] sm:h-[302px] md:h-[385px] lg:h-[470px] mt-[24px]">
|
||||
<iframe
|
||||
src={`https://maps.google.com/maps?q=${data.map.latitude},${data.map.longitude}&z=14&output=embed`}
|
||||
className="w-full rounded-lg mt-4 h-full"
|
||||
referrerPolicy="no-referrer-when-downgrade"
|
||||
allowFullScreen=""
|
||||
loading="lazy"
|
||||
></iframe>
|
||||
<MapView
|
||||
latitude={data.map.latitude}
|
||||
longitude={data.map.longitude}
|
||||
/>
|
||||
|
||||
<ModalOpenLocation
|
||||
open={open}
|
||||
|
||||
Reference in New Issue
Block a user