diff --git a/frontend-next/.eslintrc.json b/frontend-next/.eslintrc.json
index 471d759..b256ceb 100644
--- a/frontend-next/.eslintrc.json
+++ b/frontend-next/.eslintrc.json
@@ -1,5 +1,5 @@
{
- "extends": "next/core-web-vitals",
+ "extends": ["next/babel","next/core-web-vitals" ],
"rules": {
"no-unused-vars": ["warn", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }],
"jsx-a11y/alt-text": "off",
diff --git a/frontend-next/src/components/app/map/geo.js b/frontend-next/src/components/app/map/geo.js
index f5e3182..24daf29 100644
--- a/frontend-next/src/components/app/map/geo.js
+++ b/frontend-next/src/components/app/map/geo.js
@@ -1,32 +1,87 @@
import { Map, Marker, ZoomControl } from "pigeon-maps";
+import { database } from "../../../../firebase-config";
+import { ref, get } from "firebase/database";
+import { useState, useEffect } from "react";
+
+// ONLY nearby markers
+function NearbyRoomMarkers({ loc, user }) {
+ const [markerArr, setMarkerArr] = useState([]);
+
+ // Room path in DB
+ const path =
+ String(loc.latitude.toFixed(2)).replace(".", "") +
+ "/" +
+ String(loc.longitude.toFixed(2)).replace(".", "") +
+ "/";
+
+ // Sorry for the href but doesn't work here
+ const handleRoomMarkerClick = (roomObj) => {
+ window.location.href =
+ "/chat?room=" + path + roomObj.name + "-" + roomObj.timestamp;
+ };
+
+ // Mostly copied Nick's code from before
+ useEffect(() => {
+ if (loc && user) {
+ get(ref(database, `/rooms/${path}`)).then((snapshot) => {
+ if (snapshot.exists()) {
+ const rooms = snapshot.val();
+
+ const newMarkers = Object.values(rooms).map((roomObj, index) => {
+ const markerKey = roomObj.path + "-" + index;
+ console.log("RoomObj", roomObj);
+
+ return (
+ // Want to change this to be something other than markers (or something extra)
+ handleRoomMarkerClick(roomObj)}
+ >
+ );
+ });
+ setMarkerArr(newMarkers);
+ }
+ });
+ }
+ }, []);
+
+ return markerArr;
+}
/**
* Geo Component for Wrapping Map
* @constructor
* @prop {JSON} loc - Location Object {latitude, longitude}
* @prop {Number} zoom - Zoom Level
- * @prop {Boolean} locMarker - Show Location Marker
- * @prop {Markers[]} markers - Array of Markers
+ * @prop {Boolean} moveable - Moveable Map
+ * @prop {Boolean} markers - Enable Markers
* @returns {Map} - Geo Component (As Map)
*/
-export function Geo({ loc, zoom, locMarker, markers }) {
- if (loc) {
- return (
-
- );
+export function Geo({ loc, zoom, moveable, markers, user }) {
+ const handleUserMarkerClick = () => {
+ window.location.href = "/user?uid=" + user.uid;
+ }
+
+ if (!loc) {
+ return
Getting Location...
;
} else {
return (
-
+ <>
+
+ >
);
}
}
diff --git a/frontend-next/src/components/app/map/marker.js b/frontend-next/src/components/app/map/marker.js
deleted file mode 100644
index e69de29..0000000
diff --git a/frontend-next/src/components/app/page/home.js b/frontend-next/src/components/app/page/home.js
index 1fbf3fa..a2bd14b 100644
--- a/frontend-next/src/components/app/page/home.js
+++ b/frontend-next/src/components/app/page/home.js
@@ -5,7 +5,7 @@ import { Geo } from "../map/geo";
* @prop {JSON} user - User Object
* @returns {Object} - Welcome Message Component
*/
- function WelcomeMessage({ user }) {
+function WelcomeMessage({ user }) {
return (
@@ -23,7 +23,7 @@ import { Geo } from "../map/geo";
* @prop {JSON} user - User Object
* @returns {Object} - Home Page Component
*/
-export function HomePage({ loc, markers, user }) {
+export function HomePage({ loc, user }) {
return (
<>
@@ -31,9 +31,9 @@ export function HomePage({ loc, markers, user }) {
>
diff --git a/frontend-next/src/components/app/profile/ProfileRoom.js b/frontend-next/src/components/app/profile/ProfileRoom.js
index 796978f..8b25a31 100644
--- a/frontend-next/src/components/app/profile/ProfileRoom.js
+++ b/frontend-next/src/components/app/profile/ProfileRoom.js
@@ -17,7 +17,8 @@ export function ProfileRoom({ room }) {
diff --git a/frontend-next/src/components/app/sidebar/chat.js b/frontend-next/src/components/app/sidebar/chat.js
index 401509b..f8d3062 100644
--- a/frontend-next/src/components/app/sidebar/chat.js
+++ b/frontend-next/src/components/app/sidebar/chat.js
@@ -43,8 +43,8 @@ export function Sidebar({chatRoomObj}) {
longitude: parseFloat(chatRoomObj.longitude.toFixed(2)),
}}
zoom={12}
- movable={false}
- marker={false}
+ moveable={false}
+ markers={false}
/>