Live location sharing - open location in OpenStreetMap (PSF-1040) (#8695)
* share plain lat,lon string from beacon tooltip and list item Signed-off-by: Kerry Archibald <kerrya@element.io> * export makeMapSiteLink helper fn Signed-off-by: Kerry Archibald <kerrya@element.io> * use currentColor in external-link.svg Signed-off-by: Kerry Archibald <kerrya@element.io> * add open in openstreetmap link Signed-off-by: Kerry Archibald <kerrya@element.io> * fussy import ordering Signed-off-by: Kerry Archibald <kerrya@element.io> * fix icon color var Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
parent
12abbf4042
commit
15c2fb6b71
14 changed files with 254 additions and 31 deletions
|
@ -65,7 +65,7 @@ export const createMarker = (coords: GeolocationCoordinates, element: HTMLElemen
|
|||
return marker;
|
||||
};
|
||||
|
||||
const makeLink = (coords: GeolocationCoordinates): string => {
|
||||
export const makeMapSiteLink = (coords: GeolocationCoordinates): string => {
|
||||
return (
|
||||
"https://www.openstreetmap.org/" +
|
||||
`?mlat=${coords.latitude}` +
|
||||
|
@ -74,18 +74,18 @@ const makeLink = (coords: GeolocationCoordinates): string => {
|
|||
);
|
||||
};
|
||||
|
||||
export const createMapSiteLink = (event: MatrixEvent): string => {
|
||||
export const createMapSiteLinkFromEvent = (event: MatrixEvent): string => {
|
||||
const content: Object = event.getContent();
|
||||
const mLocation = content[M_LOCATION.name];
|
||||
if (mLocation !== undefined) {
|
||||
const uri = mLocation["uri"];
|
||||
if (uri !== undefined) {
|
||||
return makeLink(parseGeoUri(uri));
|
||||
return makeMapSiteLink(parseGeoUri(uri));
|
||||
}
|
||||
} else {
|
||||
const geoUri = content["geo_uri"];
|
||||
if (geoUri) {
|
||||
return makeLink(parseGeoUri(geoUri));
|
||||
return makeMapSiteLink(parseGeoUri(geoUri));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue