change forder file name + change service url
This commit is contained in:
@@ -40,7 +40,7 @@ function OrderTrackingPage() {
|
||||
const [mapInstance, setMapInstance] = useState<L.Map | null>(null);
|
||||
const [isSearchOpen, setIsSearchOpen] = useState(false);
|
||||
|
||||
const restaurant = aboutData?.data;
|
||||
const shop = aboutData?.data;
|
||||
|
||||
const [mapCenter, setMapCenter] = useState<[number, number]>(() => [
|
||||
Number(params?.get('lat')) || 35.6892,
|
||||
@@ -60,10 +60,10 @@ function OrderTrackingPage() {
|
||||
useEffect(() => {
|
||||
if (editMode && address) {
|
||||
setMapCenter([address.latitude, address.longitude]);
|
||||
} else if (restaurant?.latitude && restaurant?.longitude) {
|
||||
setMapCenter([restaurant.latitude, restaurant.longitude]);
|
||||
} else if (shop?.latitude && shop?.longitude) {
|
||||
setMapCenter([shop.latitude, shop.longitude]);
|
||||
}
|
||||
}, [editMode, address, restaurant]);
|
||||
}, [editMode, address, shop]);
|
||||
|
||||
useEffect(() => {
|
||||
if (editMode && address && !initialPositionSet) {
|
||||
@@ -87,24 +87,24 @@ function OrderTrackingPage() {
|
||||
|
||||
const iconHtml = `
|
||||
<div style="display: flex; flex-direction: column; align-items: center; text-align: center;">
|
||||
<img src="/icons/restaurant-marker.svg" alt="موقعیت فروشگاه" style="width: 32px; height: 40px; display: block;" />
|
||||
<img src="/icons/shop-marker.svg" alt="موقعیت فروشگاه" style="width: 32px; height: 40px; display: block;" />
|
||||
</div>
|
||||
`;
|
||||
|
||||
const restaurantPosition: [number, number] | null =
|
||||
restaurant?.latitude && restaurant?.longitude
|
||||
? [restaurant.latitude, restaurant.longitude]
|
||||
const shopPosition: [number, number] | null =
|
||||
shop?.latitude && shop?.longitude
|
||||
? [shop.latitude, shop.longitude]
|
||||
: null;
|
||||
|
||||
const markersToSet: MarkerData[] = [];
|
||||
|
||||
if (restaurantPosition) {
|
||||
if (shopPosition) {
|
||||
markersToSet.push({
|
||||
position: restaurantPosition,
|
||||
position: shopPosition,
|
||||
title: 'موقعیت فروشگاه',
|
||||
icon: L.divIcon({
|
||||
html: iconHtml,
|
||||
className: 'custom-restaurant-marker',
|
||||
className: 'custom-shop-marker',
|
||||
iconSize: [40, 40],
|
||||
iconAnchor: [20, 40],
|
||||
popupAnchor: [0, -40],
|
||||
@@ -116,7 +116,7 @@ function OrderTrackingPage() {
|
||||
};
|
||||
|
||||
initializeMarkers();
|
||||
}, [restaurant]);
|
||||
}, [shop]);
|
||||
|
||||
const handlePositionSelect = (position: [number, number]) => {
|
||||
setSelectedPosition((prev) => {
|
||||
@@ -237,13 +237,13 @@ function OrderTrackingPage() {
|
||||
);
|
||||
}
|
||||
|
||||
if (!restaurant) {
|
||||
if (!shop) {
|
||||
return null
|
||||
}
|
||||
|
||||
const hasServiceArea = restaurant?.serviceArea &&
|
||||
restaurant.serviceArea.coordinates &&
|
||||
restaurant.serviceArea.coordinates.length > 0;
|
||||
const hasServiceArea = shop?.serviceArea &&
|
||||
shop.serviceArea.coordinates &&
|
||||
shop.serviceArea.coordinates.length > 0;
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 bg-gray-50">
|
||||
@@ -252,7 +252,7 @@ function OrderTrackingPage() {
|
||||
initialPosition={mapCenter}
|
||||
zoom={14}
|
||||
markers={markers}
|
||||
serviceArea={restaurant?.serviceArea || null}
|
||||
serviceArea={shop?.serviceArea || null}
|
||||
onPositionSelect={handlePositionSelect}
|
||||
onZoomChange={handleZoomChange}
|
||||
onClick={handleMapClick}
|
||||
|
||||
Reference in New Issue
Block a user