diff --git a/frontend/src/components/Auth/AuthModal.tsx b/frontend/src/components/Auth/AuthModal.tsx index 1f6fcf6..ac224be 100644 --- a/frontend/src/components/Auth/AuthModal.tsx +++ b/frontend/src/components/Auth/AuthModal.tsx @@ -25,10 +25,10 @@ const AuthModal: React.FC = ({ onClose }) => { return ( <> {/*Background Blur*/} -
+
{/*Container*/}
diff --git a/frontend/src/components/Video/ChatPanel.tsx b/frontend/src/components/Video/ChatPanel.tsx index 1aca340..e2e0836 100644 --- a/frontend/src/components/Video/ChatPanel.tsx +++ b/frontend/src/components/Video/ChatPanel.tsx @@ -2,6 +2,8 @@ import React, { useState, useEffect, useRef } from "react"; import Input from "../Layout/Input"; import { useAuth } from "../../context/AuthContext"; import { useSocket } from "../../context/SocketContext"; +import Button from "../Layout/Button"; +import AuthModal from "../Auth/AuthModal"; interface ChatMessage { chatter_username: string; @@ -93,7 +95,22 @@ const ChatPanel: React.FC = ({ streamId }) => { } }; + //added to show login/reg if not + const [showAuthModal, setShowAuthModal] = useState(false); + + useEffect(() => { + if (showAuthModal) { + document.body.style.overflow = "hidden"; + } else { + document.body.style.overflow = "unset"; + } + return () => { + document.body.style.overflow = "unset"; + }; + }, [showAuthModal]); + return ( + <>

Stream Chat

@@ -124,24 +141,40 @@ const ChatPanel: React.FC = ({ streamId }) => {
+ {isLoggedIn && + <> setInputMessage(e.target.value)} - onKeyDown={handleKeyPress} - placeholder={isLoggedIn ? "Type a message..." : "Login to chat"} - disabled={!isLoggedIn} - extraClasses="flex-grow disabled:cursor-not-allowed" - /> - + type="text" + value={inputMessage} + onChange={(e) => setInputMessage(e.target.value)} + onKeyDown={handleKeyPress} + placeholder={isLoggedIn ? "Type a message..." : "Login to chat"} + disabled={!isLoggedIn} + extraClasses="flex-grow" + onClick={() => (!isLoggedIn && setShowAuthModal(true))} /> + + + } + + {!isLoggedIn && + + } +
-
+ {showAuthModal && ( +
+ setShowAuthModal(false)} /> +
+ )} + + ); }; diff --git a/frontend/src/pages/VideoPage.tsx b/frontend/src/pages/VideoPage.tsx index 04fbdc0..af7ceb1 100644 --- a/frontend/src/pages/VideoPage.tsx +++ b/frontend/src/pages/VideoPage.tsx @@ -30,6 +30,7 @@ const VideoPage: React.FC = ({ streamId }) => { const navigate = useNavigate(); const [isChatVisible, setIsChatVisible] = useState(false); + const [showAuthModal, setShowAuthModal] = useState(false); const toggleChat = () => { setIsChatVisible((prev) => !prev); @@ -72,6 +73,14 @@ const VideoPage: React.FC = ({ streamId }) => { }); }, [streamId, streamerName]); + useEffect(() => { + document.body.style.overflow = showAuthModal ? "hidden" : "unset"; + + return () => { + document.body.style.overflow = "unset"; // Cleanup + }; + }, [showAuthModal]); + return (
@@ -83,7 +92,7 @@ const VideoPage: React.FC = ({ streamId }) => { {isChatVisible ? "Hide Chat" : "Show Chat"}