diff --git a/frontend/src/components/Video/ChatPanel.tsx b/frontend/src/components/Video/ChatPanel.tsx index 22dc187..eaf0396 100644 --- a/frontend/src/components/Video/ChatPanel.tsx +++ b/frontend/src/components/Video/ChatPanel.tsx @@ -15,11 +15,13 @@ interface ChatMessage { interface ChatPanelProps { streamId: number; onViewerCountChange?: (count: number) => void; + onInputFocus: (focused: boolean) => void; } const ChatPanel: React.FC = ({ streamId, onViewerCountChange, + onInputFocus, }) => { const { isLoggedIn, username } = useAuth(); const { showAuthModal, setShowAuthModal } = useAuthModal(); @@ -114,17 +116,19 @@ const ChatPanel: React.FC = ({ return (
-

+ {/* Chat Header */} +

Stream Chat

+ {/* Message List */}
{messages.map((msg, index) => (
= ({ />
-
+
{/* Username */} = ({
{/* Message content */} -
{msg.message}
+
+ {msg.message} +
{/* Time sent */} @@ -166,7 +172,8 @@ const ChatPanel: React.FC = ({ ))}
-
+ {/* Input area */} +
{isLoggedIn ? ( <> = ({ onKeyDown={handleKeyPress} placeholder="Type a message..." extraClasses="flex-grow w-full focus:w-full" + maxLength={200} onClick={() => !isLoggedIn && setShowAuthModal(true)} + onFocus={() => onInputFocus(true)} + onBlur={() => onInputFocus(false)} /> +
- {/* Stream Data */} -
- {/* Streamer Icon */} -
- streamer navigate(`/user/${streamerName}`)} - /> - -
+ {/* Stream Title */} +
+

+ {streamData ? streamData.streamTitle : "Loading..."} +

+ + {streamData ? streamData.categoryName : "Loading..."} + +
- {/* Stream Title */} -
-

- {streamData ? streamData.streamTitle : "Loading..."} -

- - {streamData ? streamData.categoryName : "Loading..."} - -
- - {/* Streamer Info */} -
-
- {!isFollowing ? ( - - ) : ( - - )} -
-
- - {/* Stream Stats */} -
-
- Viewers Icon - {viewerCount} -
-
- -
- Started - - {streamData - ? `${Math.floor( - (Date.now() - new Date(streamData.startTime).getTime()) / - 3600000 - )} hours ago` - : "Loading..."} - -
- - {/* Subscribe Button */} -
- + {/* Streamer Info */} +
+
+ {!isFollowing ? ( + + ) : ( + + )}
- {showCheckout && ( - setShowCheckout(false)} - streamerID={streamerId} - /> - )} - {showReturn && } - {showAuthModal && ( - setShowAuthModal(false)} /> - )} + + {/* Stream Stats */} +
+
+ Viewers Icon + {viewerCount} +
+
+ +
+ Started + + {streamData + ? `${Math.floor( + (Date.now() - new Date(streamData.startTime).getTime()) / + 3600000 + )} hours ago` + : "Loading..."} + +
+ + {/* Subscribe Button */} +
+ +
+ {showCheckout && ( + setShowCheckout(false)} + streamerID={streamerId} + /> + )} + {showReturn && } + {showAuthModal && setShowAuthModal(false)} />}
);