From 638b3e0750c61aded2d08dfad7680bfcff8abf9f Mon Sep 17 00:00:00 2001 From: Logan Hunt Date: Fri, 1 Apr 2022 16:31:24 -0600 Subject: Fix some bugs --- client/components/chatroom/_chat_room.jsx | 32 +++++++++++++++++++----------- client/components/map/chat_room_geoman.jsx | 6 +++--- 2 files changed, 23 insertions(+), 15 deletions(-) (limited to 'client/components') diff --git a/client/components/chatroom/_chat_room.jsx b/client/components/chatroom/_chat_room.jsx index 22fb399..6a93807 100644 --- a/client/components/chatroom/_chat_room.jsx +++ b/client/components/chatroom/_chat_room.jsx @@ -11,7 +11,7 @@ import { generateGruvboxFromString } from '../../utils/generate_gruvbox'; export const ChatRoom = () => { const { id } = useParams(); const [chatRoom, setChatRoom] = useState(''); - const [connections, messages, sendMessage] = useChat(chatRoom); + const [active, connections, messages, sendMessage] = useChat(chatRoom); const [message, setMessage] = useState(''); const [color, setColor] = useState(generateGruvboxFromString('placeholder')); const [user, setUser] = useState({}); @@ -78,17 +78,25 @@ export const ChatRoom = () => {
- -
- Send -
+ {active ? ( + <> + +
+ Send +
+ + ) : ( +
+

This room has been marked inactive and has been deleted.

+
+ )}
Back to map
diff --git a/client/components/map/chat_room_geoman.jsx b/client/components/map/chat_room_geoman.jsx index 07d0a4c..86b5c8a 100644 --- a/client/components/map/chat_room_geoman.jsx +++ b/client/components/map/chat_room_geoman.jsx @@ -51,7 +51,7 @@ const haversine = (p1, p2) => { export const Geoman = ({ user, userPos, joinRoom }) => { const context = useLeafletContext(); const api = useContext(ApiContext); - let dontRedirect = true; + let dontRedirect = false; const circleAndMarkerFromChatroom = (chatRoom) => { const circle = new L.Circle(chatRoom.center, chatRoom.radius); const marker = new L.Marker(chatRoom.center, { pmIgnore: !chatRoom.editable, icon }); @@ -64,7 +64,7 @@ export const Geoman = ({ user, userPos, joinRoom }) => { return; } dontRedirect = false; - }, 500); + }, 200); }); marker.bindPopup(chatRoom.name || `Chat Room ${chatRoom.id}`); marker.on('mouseover', (e) => { @@ -158,7 +158,7 @@ export const Geoman = ({ user, userPos, joinRoom }) => { const { lat: latitude, lng: longitude } = shape.layer.getLatLng(); const chatRoom = await api.post('/chat_rooms', { - name: prompt("What's the name of the chat room?"), + name: prompt("What's the name of the chat room?\n(Chat rooms are deleted after 2 hours of inactivity)"), latitude, longitude, radius: shape.layer.getRadius(), -- cgit v1.2.3-70-g09d2