diff --git a/frontend/src/components/inbox/components/Chat.tsx b/frontend/src/components/inbox/components/Chat.tsx index bcb47a51..edcf7611 100644 --- a/frontend/src/components/inbox/components/Chat.tsx +++ b/frontend/src/components/inbox/components/Chat.tsx @@ -6,7 +6,6 @@ * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). */ - import { Avatar, ChatContainer, diff --git a/frontend/src/components/inbox/components/GeolocationMessage.tsx b/frontend/src/components/inbox/components/GeolocationMessage.tsx new file mode 100644 index 00000000..b9c11a6c --- /dev/null +++ b/frontend/src/components/inbox/components/GeolocationMessage.tsx @@ -0,0 +1,54 @@ +/* + * Copyright © 2025 Hexastack. All rights reserved. + * + * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: + * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. + * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). + */ + +import { useRef } from "react"; + +import { StdIncomingLocationMessage } from "@/types/message.types"; + +export interface GeolocationMessageProps { + message: StdIncomingLocationMessage; +} + +const GeolocationMessage: React.FC = ({ message }) => { + const iframeRef = useRef(null); + + if (!("coordinates" in message)) { + throw new Error("Unable to find coordinates"); + } + + const { lat, lon } = message.coordinates || { lat: 0.0, lng: 0.0 }; + const openStreetMapUrl = `https://www.openstreetmap.org/export/embed.html?bbox=${ + lon - 0.1 + },${lat - 0.1},${lon + 0.1},${lat + 0.1}&layer=mapnik&marker=${lat},${lon}`; + + return ( +
+