REFACTOR: Separated Navbar and ChatPanel components; Updated VideoPage layout and toggle chat functionality

This commit is contained in:
Chris-1010
2025-02-04 17:43:31 +00:00
parent d472d672bd
commit 595190b0a0
5 changed files with 98 additions and 95 deletions

View File

@@ -1,6 +1,6 @@
import React, { useState, useEffect } from "react";
import Logo from "./Logo";
import Button, { ToggleButton } from "./Button";
import Button from "./Button";
import Sidebar from "./Sidebar";
import { Sidebar as SidebarIcon } from "lucide-react";
import {
@@ -15,18 +15,13 @@ import { useAuth } from "../../context/AuthContext";
interface NavbarProps {
variant?: "home" | "default";
isChatOpen?: boolean;
toggleChat?: () => void;
}
const Navbar: React.FC<NavbarProps> = ({
variant = "default",
isChatOpen,
toggleChat,
}) => {
const [showAuthModal, setShowAuthModal] = useState(false);
const { isLoggedIn } = useAuth();
const isVideoPage = location.pathname.includes("/EduGuru");
useEffect(() => {
if (showAuthModal) {
@@ -88,15 +83,6 @@ const Navbar: React.FC<NavbarProps> = ({
<SettingsIcon className="h-15 w-15 mr-1" />
Quick Settings
</Button>
{isVideoPage && (
<ToggleButton
onClick={toggleChat}
toggled={isChatOpen}
extraClasses="absolute top-[80px] right-[20px] text-[1rem] flex items-center flex-nowrap"
>
{isChatOpen ? "Hide Chat" : "Show Chat"}
</ToggleButton>
)}
<div id="search-bar" className="flex items-center">
<Input