create address + fix location restaurant

This commit is contained in:
hamid zarghami
2025-11-27 09:47:14 +03:30
parent b3716d8602
commit fa7f95df43
17 changed files with 711 additions and 368 deletions
@@ -32,31 +32,35 @@ function OrderTrackingPage() {
const router = useRouter();
const { state: cancelModal, toggle: toggleCancelModal } = useToggle();
// Example initial position (Tehran)
const initialPosition = React.useMemo<[number, number]>(() => [35.6892, 51.3890], []);
useEffect(() => {
// Initialize markers on the client side
const initializeMarkers = async () => {
// Dynamic import of Leaflet on the client side
const L = (await import('leaflet')).default;
const iconHtml = `
<div style="display: flex; flex-direction: column; align-items: center; text-align: center;">
<img src="/icons/restaurant-marker.svg" alt="موقعیت رستوران" style="width: 24px; height: 30px; display: block;" />
</div>
`;
setMarkers([
{
position: initialPosition,
title: 'Restaurant Location',
icon: new L.Icon({
iconUrl: '/icons/restaurant-marker.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
position: mapCenter,
title: 'موقعیت رستوران',
icon: L.divIcon({
html: iconHtml,
className: 'custom-restaurant-marker',
iconSize: [32, 32],
iconAnchor: [16, 32],
popupAnchor: [0, -32],
})
}
]);
};
initializeMarkers();
}, [initialPosition]);
}, [mapCenter]);
const handleZoomChange = (zoom: number) => {