refactor: update map button functionality to use latitude and longitude for Google Maps links

This commit is contained in:
hamed
2025-11-19 10:24:07 +03:30
parent e7cff90516
commit aef10e7764
2 changed files with 12 additions and 2 deletions
@@ -68,7 +68,12 @@ function DetailLg({ appointmentData, loading }) {
<Button
className="!py-[8px] !px-[12px] !gap-[8px]"
variant="text"
onClick={() => appointmentData?.address?.map && window.open(appointmentData.address.map, '_blank')}
onClick={() => {
const map = appointmentData?.address?.map;
if (map?.latitude && map?.longitude) {
window.open(`https://www.google.com/maps?q=${map.latitude},${map.longitude}`, '_blank');
}
}}
>
<RoutingC />
<p className="text-[#5559CE] text-[14px] font-medium">
@@ -58,7 +58,12 @@ function DetailSm({ appointmentData, loading }) {
<Button
className="!py-[8px] !border-[#EFEFEF] !px-[12px] !gap-[8px]"
variant="outlined"
onClick={() => appointmentData?.address?.map && window.open(appointmentData.address.map, '_blank')}
onClick={() => {
const map = appointmentData?.address?.map;
if (map?.latitude && map?.longitude) {
window.open(`https://www.google.com/maps?q=${map.latitude},${map.longitude}`, '_blank');
}
}}
>
<RoutingC />
<p className="text-[#5559CE] text-[14px] font-medium">