diff --git a/frontend-next/src/components/app/page/chat.js b/frontend-next/src/components/app/page/chat.js
index 1374ea2..bf666c2 100644
--- a/frontend-next/src/components/app/page/chat.js
+++ b/frontend-next/src/components/app/page/chat.js
@@ -50,23 +50,25 @@ export function ChatRoom({ roomObj, user }) {
* @returns {void}
*/
function sendMessage(data) {
- reset();
- var payload = {
- body: data.message,
- user: user.username,
- uid: user.uid,
- isSystem: false,
- timestamp: new Date().getTime(),
- };
- set(
- ref(
- database,
- `/rooms/${
- roomObj.path + "/" + roomObj.name + "-" + roomObj.timestamp
- }/chats/${new Date().getTime()}-${user.username}`
- ),
- payload
- );
+ if (data.message) {
+ reset();
+ var payload = {
+ body: data.message,
+ user: user.username,
+ uid: user.uid,
+ isSystem: false,
+ timestamp: new Date().getTime(),
+ };
+ set(
+ ref(
+ database,
+ `/rooms/${
+ roomObj.path + "/" + roomObj.name + "-" + roomObj.timestamp
+ }/chats/${new Date().getTime()}-${user.username}`
+ ),
+ payload
+ );
+ }
}
if (!chats) return
No Chats
;
diff --git a/frontend-next/src/components/app/profile/ProfilePanel.js b/frontend-next/src/components/app/profile/ProfilePanel.js
index 0b3dcb3..387025d 100644
--- a/frontend-next/src/components/app/profile/ProfilePanel.js
+++ b/frontend-next/src/components/app/profile/ProfilePanel.js
@@ -3,8 +3,9 @@ import { Popover } from "@headlessui/react";
import Link from "next/link"
// Firebase Imports
-import { auth } from "../../../../firebase-config";
+import { auth, database } from "../../../../firebase-config";
import { signOut } from "firebase/auth";
+import {update, ref, serverTimestamp} from "firebase/database";
/**
* Logs out from Firebase Authentication
@@ -43,6 +44,18 @@ export function ProfilePanel({user}) {
>
View Profile
+
{
+ // Toggle Invisible Status
+ update(ref(database, `/users/${user.uid}`), {
+ invisibleStatus: user.invisibleStatus? !user.invisibleStatus: true,
+ lastOnline: user.invisibleStatus? true: serverTimestamp()
+ }
+ );
+ }}
+ >
+ {user.invisibleStatus ? "Go Online" : "Go Invisible"}
+