PATCH: Fix to retrieval of chat

This commit is contained in:
Chris-1010
2025-02-04 15:38:13 +00:00
parent 60c19b3052
commit d472d672bd
2 changed files with 5 additions and 4 deletions

View File

@@ -5,9 +5,9 @@ import UserPage from "../../pages/UserPage";
const StreamerRoute: React.FC = () => {
const { streamerName } = useParams<{ streamerName: string }>();
const [isLive, setIsLive] = useState<boolean>(false);
const [isLoading, setIsLoading] = useState<boolean>(true);
let streamId: number = 0;
const [isLive, setIsLive] = useState<boolean>(false);
const [streamId, setStreamId] = useState<number>(0);
useEffect(() => {
const checkStreamStatus = async () => {
@@ -15,6 +15,7 @@ const StreamerRoute: React.FC = () => {
const response = await fetch(`/api/streamer/${streamerName}/status`);
const data = await response.json();
setIsLive(Boolean(data.is_live));
setStreamId(data.most_recent_stream);
} catch (error) {
console.error("Error checking stream status:", error);
setIsLive(false);

View File

@@ -121,7 +121,7 @@ const ChatPanel: React.FC<ChatPanelProps> = ({ streamId }) => {
<div
ref={chatContainerRef}
id="chat-message-list"
className="flex-grow w-full max-h-[50vh] overflow-y-auto mb-4 space-y-2 rounded-[67px]"
className="flex-grow w-full max-h-[50vh] overflow-y-auto mb-4 space-y-2 rounded-md"
>
{messages.map((msg, index) => (
<div
@@ -156,7 +156,7 @@ const ChatPanel: React.FC<ChatPanelProps> = ({ streamId }) => {
onKeyDown={handleKeyPress}
placeholder={isLoggedIn ? "Type a message..." : "Login to chat"}
disabled={!isLoggedIn}
extraClasses="flex-grow"
extraClasses="flex-grow focus:w-[20vw]"
onClick={() => !isLoggedIn && setShowAuthModal(true)}
/>