mirror of
https://github.com/hexastack/hexabot
synced 2025-02-23 04:48:51 +00:00
fix: apply feedback
This commit is contained in:
parent
bc9e35977e
commit
2fde4e3439
@ -8,14 +8,10 @@
|
|||||||
|
|
||||||
import { useRef } from "react";
|
import { useRef } from "react";
|
||||||
|
|
||||||
|
import { StdIncomingLocationMessage } from "@/types/message.types";
|
||||||
|
|
||||||
export interface GeolocationMessageProps {
|
export interface GeolocationMessageProps {
|
||||||
message: {
|
message: StdIncomingLocationMessage;
|
||||||
type: "location";
|
|
||||||
coordinates: {
|
|
||||||
lat: number;
|
|
||||||
lon: number;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const GeolocationMessage: React.FC<GeolocationMessageProps> = ({ message }) => {
|
const GeolocationMessage: React.FC<GeolocationMessageProps> = ({ message }) => {
|
||||||
@ -25,15 +21,10 @@ const GeolocationMessage: React.FC<GeolocationMessageProps> = ({ message }) => {
|
|||||||
throw new Error("Unable to find coordinates");
|
throw new Error("Unable to find coordinates");
|
||||||
}
|
}
|
||||||
|
|
||||||
const coordinates = {
|
const { lat, lon } = message?.coordinates || { lat: 0.0, lng: 0.0 };
|
||||||
lat: message?.coordinates?.lat || 0.0,
|
|
||||||
lng: message?.coordinates?.lon || 0.0,
|
|
||||||
};
|
|
||||||
const openStreetMapUrl = `https://www.openstreetmap.org/export/embed.html?bbox=${
|
const openStreetMapUrl = `https://www.openstreetmap.org/export/embed.html?bbox=${
|
||||||
coordinates.lng - 0.1
|
lon - 0.1
|
||||||
},${coordinates.lat - 0.1},${coordinates.lng + 0.1},${
|
},${lat - 0.1},${lon + 0.1},${lat + 0.1}&layer=mapnik&marker=${lat},${lon}`;
|
||||||
coordinates.lat + 0.1
|
|
||||||
}&layer=mapnik&marker=${coordinates.lat},${coordinates.lng}`;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
Loading…
Reference in New Issue
Block a user