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:
Kerry 2022-05-27 11:58:39 +02:00 committed by GitHub
parent 12abbf4042
commit 15c2fb6b71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 254 additions and 31 deletions

View file

@ -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;