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 533a97d..af7ceb1 100644 --- a/frontend/src/pages/VideoPage.tsx +++ b/frontend/src/pages/VideoPage.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from "react"; import Navbar from "../components/Layout/Navbar"; -import Button from "../components/Layout/Button"; +import Button, { ToggleButton } from "../components/Layout/Button"; import ChatPanel from "../components/Video/ChatPanel"; import CheckoutForm, { Return } from "../components/Checkout/CheckoutForm"; import { useNavigate, useParams } from "react-router-dom"; @@ -29,6 +29,13 @@ const VideoPage: React.FC = ({ streamId }) => { const [streamData, setStreamData] = useState(); const navigate = useNavigate(); + const [isChatVisible, setIsChatVisible] = useState(false); + const [showAuthModal, setShowAuthModal] = useState(false); + + const toggleChat = () => { + setIsChatVisible((prev) => !prev); + } + // useEffect(() => { // // Prevent scrolling when checkout is open // if (showCheckout) { @@ -44,8 +51,7 @@ const VideoPage: React.FC = ({ streamId }) => { useEffect(() => { // Fetch stream data for this streamer fetch( - `/api/get_stream_data/${streamerName}${ - streamId == 0 ? "" : `/${streamId}` + `/api/get_stream_data/${streamerName}${streamId == 0 ? "" : `/${streamId}` }` ).then((res) => { if (!res.ok) { @@ -67,14 +73,34 @@ const VideoPage: React.FC = ({ streamId }) => { }); }, [streamId, streamerName]); + useEffect(() => { + document.body.style.overflow = showAuthModal ? "hidden" : "unset"; + + return () => { + document.body.style.overflow = "unset"; // Cleanup + }; + }, [showAuthModal]); + return (
+ - + + {isChatVisible ? "Hide Chat" : "Show Chat"} + + + {isChatVisible && +
+ +
}
=22.10.2 gevent-websocket +flask-oauthlib==0.9.6 celery==5.2.3 redis==5.2.1 \ No newline at end of file