diff --git a/src/Core.js b/src/Core.js
index 408ca67..337cb87 100644
--- a/src/Core.js
+++ b/src/Core.js
@@ -16,7 +16,6 @@ function Core() {
data: coreState.data,
close: () => dispatch(setPlugin(false))
};
- const dummyButtons = ["Maps", "Phone"];
return <>
{voiceState.recording ? :
@@ -41,9 +40,8 @@ function Core() {
label="Pet Mode" />
)
}
diff --git a/src/plugins/Maps.js b/src/plugins/Maps.js
new file mode 100644
index 0000000..8d85dfb
--- /dev/null
+++ b/src/plugins/Maps.js
@@ -0,0 +1,53 @@
+import React, { useState, useEffect } from "react";
+import PropTypes from "prop-types";
+import { Box, Button } from "grommet";
+
+import { MAPS_API } from "../config";
+
+function Maps(props) {
+ const [ location, setLocation ] = useState([null, null]);
+ useEffect(() => {
+ navigator.geolocation.getCurrentPosition(
+ position => setLocation([position.coords.latitude, position.coords.longitude]),
+ () => {}
+ );
+ });
+
+ const mapsEmbedUrl = new URL("https://www.google.com/maps/embed/v1/view");
+ mapsEmbedUrl.searchParams.append("key", MAPS_API);
+ mapsEmbedUrl.searchParams.append("center", `${location[0]},${location[1]}`);
+ mapsEmbedUrl.searchParams.append("zoom", 14);
+ return (
+
+ {location[0] === null ?
+ "Loading Location":
+
+ }
+
+
+ );
+}
+
+Maps.propTypes = {
+ data: PropTypes.object,
+ close: PropTypes.func
+};
+
+Maps.pluginName = "Maps";
+
+export default Maps;
diff --git a/src/plugins/index.js b/src/plugins/index.js
index 1d00b3f..8e1121a 100644
--- a/src/plugins/index.js
+++ b/src/plugins/index.js
@@ -4,6 +4,7 @@ import Temperature from "./Temperature";
import Accident from "./Accident";
import PetMode from "./PetMode";
import SmartHome from "./SmartHome";
+import Maps from "./Maps";
export default {
warning: Warning,
@@ -12,4 +13,5 @@ export default {
accident: Accident,
petMode: PetMode,
smartHome: SmartHome,
+ maps: Maps,
};
diff --git a/src/sample.config.js b/src/sample.config.js
index 317a009..67d9ec1 100644
--- a/src/sample.config.js
+++ b/src/sample.config.js
@@ -3,5 +3,6 @@ const TG_API = "xxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxx";
const TG_USERID = 123456789;
const CAR_API = "http://localhost:5000/";
const CAMERA_URL = "http://path.to/still/image.jpg";
+const MAPS_API = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
-export { WS_BASE, TG_API, TG_USERID, CAR_API, CAMERA_URL };
+export { WS_BASE, TG_API, TG_USERID, CAR_API, CAMERA_URL, MAPS_API };