Final Touches

This commit is contained in:
2024-03-31 05:22:10 +00:00
parent b52c17162d
commit 5d8a29d19c
8 changed files with 9 additions and 19 deletions
+2 -1
View File
@@ -3,6 +3,7 @@
"rules": {
"no-unused-vars": ["warn", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }],
"jsx-a11y/alt-text": "off",
"@next/next/no-img-element": "off"
"@next/next/no-img-element": "off",
"no-console": "on",
}
}
+3 -9
View File
@@ -2,14 +2,10 @@
// System Imports
import { useState, useEffect } from "react";
import { auth, database } from "../../../firebase-config";
import { ref, onValue, set, remove, get } from "firebase/database";
import { ref, onValue } from "firebase/database";
import { useAuthState } from "react-firebase-hooks/auth"
import { useGeolocated } from "react-geolocated";
// Refactored Component Imports
// Data Structure Imports
import { Member } from "../../components/app/datatypes";
// Header Import
import { Header } from "../../components/app/header";
@@ -24,7 +20,6 @@ function Home() {
// It's time to document and change these awful variable names
// State variables for app page
const [user, setUser] = useState(null);
const [mainTab, setMainTab] = useState("home"); // Primary tab
const [loadingLoc, setLoadingLoc] = useState(true); // location variable loading, true = loading, false = finished loading
const [authUser, loading] = useAuthState(auth)
@@ -50,7 +45,6 @@ function Home() {
});
useEffect(() => {
console.log(coords)
if (coords) {
setLoadingLoc(false);
}
@@ -69,10 +63,10 @@ function Home() {
/>
{/* Main Page Section */}
<div className="mr-2 h-[calc(100%-110px)]">
{mainTab == "home" && !loadingLoc && (
{!loadingLoc && (
<MainTabHome loc={coords} user={user} />
)}
{mainTab == "home" && loadingLoc && (
{loadingLoc && (
<MainTabHome loc={null} user={user} />
)}
</div>
-2
View File
@@ -9,13 +9,11 @@ function Home() {
const [isLoadingLoc, setLoadingLoc] = useState(true);
const [roomCount, setRoomCount] = useState(null);
const [isAuthenticated, setAuth] = useState(false);
const [userID, setUserID] = useState(null);
// Authentication
useEffect(() => {
onAuthStateChanged(auth, (user) => {
if (user) {
setUserID(user.uid);
setAuth(true);
} else {
setAuth(false);
+2 -2
View File
@@ -1,8 +1,8 @@
"use client";
// System Imports
import { useState, useEffect } from "react";
import { auth, database, storage } from "../../../../firebase-config";
import { ref, onValue, get, update } from "firebase/database";
import { auth, database } from "../../../../firebase-config";
import { ref, onValue, get } from "firebase/database";
import { onAuthStateChanged } from "firebase/auth";
// Refactored Component Imports
@@ -2,7 +2,6 @@ import { auth, database } from "../../../firebase-config";
import { ref, set, remove } from "firebase/database";
import { signOut } from "firebase/auth";
import { Popover } from "@headlessui/react";
import { useState, useEffect } from "react";
function logout() {
@@ -7,7 +7,6 @@ import { database } from "../../../../firebase-config";
// Chatroom Module for Primary Tab
export function MainTabChatRoom({ roomObj, user }) {
var { register, control, reset, handleSubmit } = useForm();
const [isLoading, setLoading] = useState(true);
// Message updater
var chatsArr = [];
@@ -20,7 +20,7 @@ export function ProfileRoom({ room }) {
</div>
<a
href={
"/app?room=" + room.path + "/" + room.name + "-" + room.timestamp
"/chat?room=" + room.path + "/" + room.name + "-" + room.timestamp
}
className="absolute z-2 top-[190px] w-[108px] p-2 cursor-pointer bg-cyan-500 text-white font-bold rounded-full flex items-center"
>
@@ -3,7 +3,7 @@ import { database } from "../../../../firebase-config";
import { ref, set, get } from "firebase/database";
import { useEffect, useState } from "react";
import { ChatRoomSidebar, Marker } from "../datatypes";
import { ChatRoomSidebar } from "../datatypes";
// Sidebar on Home Page, with various functionality (create, nearby, my rooms)
// CreateRoom Module for Sidebar Create Tab
@@ -80,7 +80,6 @@ export function Home_Sidebar({
if (snapshot.exists()) {
var rooms = snapshot.val()
for (var room in rooms) {
console.log(rooms[room])
var newRoom = (
<ChatRoomSidebar
roomObj={rooms[room]}