From c3361e3141d8cf415e39685ced012cf3cbb2dce3 Mon Sep 17 00:00:00 2001 From: Nicholas Pease Date: Wed, 24 Apr 2024 00:59:04 -0400 Subject: [PATCH 1/3] Bugfix - RMF Chatma.ps URL Fix --- frontend-next/src/components/app/datatypes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend-next/src/components/app/datatypes.js b/frontend-next/src/components/app/datatypes.js index ed72e03..c03cd9c 100644 --- a/frontend-next/src/components/app/datatypes.js +++ b/frontend-next/src/components/app/datatypes.js @@ -84,7 +84,7 @@ export async function RMF(message) { // Rich Message Formatting for Chat Maps if (URLmatch[i].includes("/chat?")) { var roomName = URLmatch[i].split("?")[1].split("/")[2].split("-")[0].replaceAll("%20"," ") - newMessage.push((invites you to {roomName})) + newMessage.push((invites you to {roomName})) } } else { await imageProcessing("https://"+URLmatch[i]).then((result) => { -- 2.52.0 From f02e74bc3af122b23ef355efa8069706f5f717aa Mon Sep 17 00:00:00 2001 From: Nicholas Pease Date: Wed, 24 Apr 2024 01:25:40 -0400 Subject: [PATCH 2/3] Bugfix - Fix nearby rooms on map --- frontend-next/src/components/app/map/geo.js | 56 +++++++++++---------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/frontend-next/src/components/app/map/geo.js b/frontend-next/src/components/app/map/geo.js index 8bd43b3..f446a78 100644 --- a/frontend-next/src/components/app/map/geo.js +++ b/frontend-next/src/components/app/map/geo.js @@ -1,7 +1,7 @@ import { Map, Marker, ZoomControl, Overlay } from "pigeon-maps"; import { database } from "../../../../firebase-config"; import { ref, get} from "firebase/database"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import ChatBubbleTwoToneIcon from '@mui/icons-material/ChatBubbleTwoTone'; import PersonOutlineTwoToneIcon from '@mui/icons-material/PersonOutlineTwoTone'; import { red } from '@mui/material/colors'; @@ -19,6 +19,7 @@ export function Geo({ loc, zoom, moveable, user }) { const [hovering, setHovering] = useState(false); const [hoverText, setHoverText] = useState(""); const [hoverAnchor, setHoverAnchor] = useState([null,null]); + const [nearbyMarkersFinal, setNearbyMarkers] = useState(null); if (moveable) { if (user.rooms) { @@ -37,31 +38,34 @@ export function Geo({ loc, zoom, moveable, user }) { }) } - - // Load Nearby Markers - var nearbyMarkers = null; - if (loc) { - const path = String(loc.latitude.toFixed(2)).replace(".", "") +"/" +String(loc.longitude.toFixed(2)).replace(".", "") +"/"; - get(ref(database, `/rooms/${path}`)).then((snapshot) => { - if (snapshot.exists()) { - nearbyMarkers = snapshot.val(); - if (nearbyMarkers) { - var nearbyMarkers = Object.values(nearbyMarkers).map((roomObj) => { - return ( {window.location.href = "/chat?room=" + roomObj.path + "/" + roomObj.name + "-" + roomObj.timestamp;}} - style={{pointerEvents:'auto'} /* So stupid */} - onMouseOver={() => {setHoverText(roomObj.name);setHovering(true);setHoverAnchor([roomObj.latitude, roomObj.longitude])}} - onMouseOut={() => {setHovering(false)}} - > - - ) - }) + useEffect(() => { + // Load Nearby Markers + if (loc) { + const path = String(loc.latitude.toFixed(2)).replace(".", "") +"/" +String(loc.longitude.toFixed(2)).replace(".", "") +"/"; + get(ref(database, `/rooms/${path}`)).then((snapshot) => { + console.log("Ran") + if (snapshot.exists()) { + nearbyMarkers = snapshot.val(); + if (nearbyMarkers) { + var nearbyMarkers = Object.values(nearbyMarkers).map((roomObj) => { + return ( {window.location.href = "/chat?room=" + roomObj.path + "/" + roomObj.name + "-" + roomObj.timestamp;}} + style={{pointerEvents:'auto'} /* So stupid */} + onMouseOver={() => {setHoverText(roomObj.name);setHovering(true);setHoverAnchor([roomObj.latitude, roomObj.longitude])}} + onMouseOut={() => {setHovering(false)}} + > + + ) + }) + setNearbyMarkers(nearbyMarkers); + } } - } - }) - } + }) + } + }, []) + } if (!loc) { @@ -77,7 +81,7 @@ export function Geo({ loc, zoom, moveable, user }) { attribution={false} > {zoom && } - {moveable && nearbyMarkers} + {moveable && nearbyMarkersFinal} {moveable && myRoomsMarkers} { /* Overlay */} -- 2.52.0 From 91735beb8802a129e7fb73bbcb64602c1ef615c8 Mon Sep 17 00:00:00 2001 From: Nicholas Pease Date: Wed, 24 Apr 2024 01:35:23 -0400 Subject: [PATCH 3/3] Remove hanging console.log / fix linting issues --- frontend-next/src/components/app/map/geo.js | 85 ++++++++++----------- 1 file changed, 41 insertions(+), 44 deletions(-) diff --git a/frontend-next/src/components/app/map/geo.js b/frontend-next/src/components/app/map/geo.js index f446a78..ecc4d38 100644 --- a/frontend-next/src/components/app/map/geo.js +++ b/frontend-next/src/components/app/map/geo.js @@ -21,52 +21,49 @@ export function Geo({ loc, zoom, moveable, user }) { const [hoverAnchor, setHoverAnchor] = useState([null,null]); const [nearbyMarkersFinal, setNearbyMarkers] = useState(null); - if (moveable) { - if (user.rooms) { - // Load My Rooms Markers - var myRoomsMarkers = Object.values(user.rooms).map((roomObj) => { - return ( {window.location.href = "/chat?room=" + roomObj.path + "/" + roomObj.name + "-" + roomObj.timestamp;}} - style={{pointerEvents:'auto'} /* So stupid */} - onMouseOver={() => {setHoverText(roomObj.name);setHovering(true);setHoverAnchor([roomObj.latitude, roomObj.longitude])}} - onMouseOut={() => {setHovering(false)}} - > - - ) + if (moveable && user.rooms) { + // Load My Rooms Markers + var myRoomsMarkers = Object.values(user.rooms).map((roomObj) => { + return ( {window.location.href = "/chat?room=" + roomObj.path + "/" + roomObj.name + "-" + roomObj.timestamp;}} + style={{pointerEvents:'auto'} /* So stupid */} + onMouseOver={() => {setHoverText(roomObj.name);setHovering(true);setHoverAnchor([roomObj.latitude, roomObj.longitude])}} + onMouseOut={() => {setHovering(false)}} + > + + ) + }) + } + + useEffect(() => { + // Load Nearby Markers + if (moveable && loc) { + const path = String(loc.latitude.toFixed(2)).replace(".", "") +"/" +String(loc.longitude.toFixed(2)).replace(".", "") +"/"; + get(ref(database, `/rooms/${path}`)).then((snapshot) => { + console.log("ran") + if (snapshot.exists()) { + nearbyMarkers = snapshot.val(); + if (nearbyMarkers) { + var nearbyMarkers = Object.values(nearbyMarkers).map((roomObj) => { + return ( {window.location.href = "/chat?room=" + roomObj.path + "/" + roomObj.name + "-" + roomObj.timestamp;}} + style={{pointerEvents:'auto'} /* So stupid */} + onMouseOver={() => {setHoverText(roomObj.name);setHovering(true);setHoverAnchor([roomObj.latitude, roomObj.longitude])}} + onMouseOut={() => {setHovering(false)}} + > + + ) + }) + setNearbyMarkers(nearbyMarkers); + } + } }) } - - useEffect(() => { - // Load Nearby Markers - if (loc) { - const path = String(loc.latitude.toFixed(2)).replace(".", "") +"/" +String(loc.longitude.toFixed(2)).replace(".", "") +"/"; - get(ref(database, `/rooms/${path}`)).then((snapshot) => { - console.log("Ran") - if (snapshot.exists()) { - nearbyMarkers = snapshot.val(); - if (nearbyMarkers) { - var nearbyMarkers = Object.values(nearbyMarkers).map((roomObj) => { - return ( {window.location.href = "/chat?room=" + roomObj.path + "/" + roomObj.name + "-" + roomObj.timestamp;}} - style={{pointerEvents:'auto'} /* So stupid */} - onMouseOver={() => {setHoverText(roomObj.name);setHovering(true);setHoverAnchor([roomObj.latitude, roomObj.longitude])}} - onMouseOut={() => {setHovering(false)}} - > - - ) - }) - setNearbyMarkers(nearbyMarkers); - } - } - }) - } - }, []) - - } + }, []) if (!loc) { return
Getting Location...
; -- 2.52.0