diff --git a/frontend-next/src/app/app/page.js b/frontend-next/src/app/app/page.js index 75d60e3..f63fcfc 100644 --- a/frontend-next/src/app/app/page.js +++ b/frontend-next/src/app/app/page.js @@ -10,7 +10,7 @@ import { useGeolocated } from "react-geolocated"; import { Header } from "../../components/app/header"; // Main Tab Imports -import { MainTabHome } from "../../components/app/main_tab/home"; +import { MainTabHome } from "../../components/app/page/home"; // Sidebar Imports import { Home_Sidebar } from "../../components/app/sidebar/home"; diff --git a/frontend-next/src/app/chat/page.js b/frontend-next/src/app/chat/page.js index b5fecd5..e4ec728 100644 --- a/frontend-next/src/app/chat/page.js +++ b/frontend-next/src/app/chat/page.js @@ -9,7 +9,7 @@ import { useAuthState } from "react-firebase-hooks/auth" import { Header } from "../../components/app/header"; // Main Tab Imports -import { MainTabChatRoom } from "../../components/app/main_tab/chat"; +import { MainTabChatRoom } from "../../components/app/page/chat"; // Sidebar Imports import { Chat_Sidebar } from "../../components/app/sidebar/chat"; diff --git a/frontend-next/src/components/app/main_tab/chat.js b/frontend-next/src/components/app/page/chat.js similarity index 100% rename from frontend-next/src/components/app/main_tab/chat.js rename to frontend-next/src/components/app/page/chat.js diff --git a/frontend-next/src/components/app/main_tab/home.js b/frontend-next/src/components/app/page/home.js similarity index 100% rename from frontend-next/src/components/app/main_tab/home.js rename to frontend-next/src/components/app/page/home.js diff --git a/frontend-next/src/components/app/sidebar/home.js b/frontend-next/src/components/app/sidebar/home.js index dbfce0b..5bf9eed 100644 --- a/frontend-next/src/components/app/sidebar/home.js +++ b/frontend-next/src/components/app/sidebar/home.js @@ -2,6 +2,8 @@ import { Form, useForm } from "react-hook-form"; import { database } from "../../../../firebase-config"; import { ref, set, get } from "firebase/database"; import { useEffect, useState } from "react"; +import { Tab } from '@headlessui/react' + import { ChatRoomSidebar } from "../datatypes"; // Sidebar on Home Page, with various functionality (create, nearby, my rooms) @@ -50,12 +52,16 @@ function CreateRoom({ loc }) { ); } +function classNames(...classes) { + return classes.filter(Boolean).join(' ') +} + export function Home_Sidebar({ user, location, loadingLoc }) { - const [tab, setTab] = useState("rooms"); + const [tab, setTab] = useState("nearby"); const [nearbyArr, setNearbyArr] = useState([]) const [nearbyArrReady, setNearbyArrReady] = useState(false) @@ -98,71 +104,60 @@ export function Home_Sidebar({ return (
-
-
-
{ - setTab("nearby"); - }} - > - Nearby -
-
{ - setTab("rooms"); - }} - > - My Rooms -
-
{ - setTab("create"); - }} - > - Create -
-
-
- {tab == "nearby" && ( -
-
- {!nearbyArr && !loadingLoc && ( + + + + classNames( + 'w-[31%]', + selected + ? 'bg-cyan-500 text-white font-bold shadow hover:bg-white/[0.6] hover:text-black' + : 'hover:bg-cyan-500/[0.6] hover:text-white hover:font-bold' + )} defaultIndex={1}>Nearby + + classNames( + 'w-[31%]', + selected + ? 'bg-cyan-500 text-white font-bold shadow hover:bg-white/[0.6] hover:text-black' + : 'hover:bg-cyan-500/[0.6] hover:text-white hover:font-bold' + )}>My Rooms + + classNames( + 'w-[31%]', + selected + ? 'bg-cyan-500 text-white font-bold shadow hover:bg-white/[0.6] hover:text-black' + : 'hover:bg-cyan-500/[0.6] hover:text-white hover:font-bold' + )}>Create + + + +
- No Nearby Rooms -
- Create One? + {!nearbyArr && !loadingLoc && ( +
+ No Nearby Rooms +
+ Create One? +
+ )} + {loadingLoc &&
Loading...
} + {nearbyArrReady && nearbyArr}
- )} +
+
+ +
+
+ {!myRoomArr &&
No User Saved Rooms
} + {myRoomArr} +
+
+
+ + {!loadingLoc && } {loadingLoc &&
Loading...
} - {nearbyArrReady && nearbyArr} -
-
- )} - {tab == "rooms" && ( -
-
- {!myRoomArr &&
No User Saved Rooms
} - {myRoomArr} -
-
- )} - {tab == "create" && !loadingLoc && } - {tab == "create" && loadingLoc &&
Loading...
} + + +
);