import { Divider, Tag } from "antd"; import ProInputCard from "components/ProInputCard/ProInputCard"; import ProText from "components/ProText"; import { useTranslation } from "react-i18next"; import styles from "./LocationCard.module.css"; import { GoogleMap } from "components/CustomBottomSheet/GoogleMap"; import DirectionsIcon from "components/Icons/DirectionsIcon"; import { useGetRedeemDetailsQuery } from "redux/api/others"; import { useParams } from "react-router-dom"; export function LocationCard() { const { t } = useTranslation(); const { voucherId } = useParams(); const { data: redeemDetails } = useGetRedeemDetailsQuery(voucherId || "", { skip: !voucherId, }); const handleGetDirections = () => { const lat = redeemDetails?.gift?.lat; const lng = redeemDetails?.gift?.lng; if (lat && lng) { // Google Maps URL that works on both mobile and desktop // On mobile devices, this will open the Google Maps app if installed const googleMapsUrl = `https://www.google.com/maps/dir/?api=1&destination=${lat},${lng}`; // Use window.location.href for better mobile compatibility (works in webviews) window.location.href = googleMapsUrl; } }; return ( <>
{redeemDetails?.gift?.restaurant} {redeemDetails?.gift?.restaurant}
{t("redeem.getDirections")}
); }