diff --git a/src/components/section.tsx b/src/components/section.tsx index 3f62c45..2851a7e 100644 --- a/src/components/section.tsx +++ b/src/components/section.tsx @@ -9,29 +9,21 @@ import { Card, CardHeader, CardTitle, CardDescription, CardContent } from "@/com export function Section() { const openMapsApp = () => { - // URL to the location on Google Maps - const googleMapsUrl = "https://maps.app.goo.gl/FQSY4ww5WZ9mATRP9"; - // Default coordinates for opening on maps + console.log('Button clicked!'); // Add this log to check if the function is being triggered const coordinates = "500 Broadway East, Little Falls, MN 56345"; - - // Check the platform (Android or iOS) + const userAgent = navigator.userAgent || navigator.vendor; - - // For Android (Google Maps) + if (/android/i.test(userAgent)) { - // Open Google Maps app using the deep link window.location.href = `google.navigation:q=${coordinates}`; - } - // For iOS (Apple Maps) - else if (/iPad|iPhone|iPod/.test(userAgent)) { - // Open Apple Maps using the deep link - window.location.href = `maps:0,0?q=${coordinates}`; + } else if (/iPad|iPhone|iPod/.test(userAgent)) { + console.log('Opening Apple Maps...'); + window.location.href = `https://maps.apple.com/?q=${encodeURIComponent(coordinates)}`; } else { - // For other platforms, open Google Maps in the browser - window.open(googleMapsUrl, "_blank"); + window.open("https://maps.app.goo.gl/FQSY4ww5WZ9mATRP9", "_blank"); } }; - + return (