- Added Chat frontend, interfaces with backend;

- Updated styles for VideoPage;
- Added StreamerRoute component;
- Remove unused Login and Signup pages;
- Update to Navbar and Logo components for new structure on different pages;
- Update to auth flow to display error messages to user;
This commit is contained in:
Chris-1010
2025-01-25 02:34:06 +00:00
parent 5c16092b1c
commit a409e74992
23 changed files with 625 additions and 119 deletions

View File

@@ -0,0 +1,41 @@
import React, { useState, useEffect } from "react";
import { useParams } from "react-router-dom";
import VideoPage from "../../pages/VideoPage";
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);
useEffect(() => {
const checkStreamStatus = async () => {
try {
const response = await fetch(`/api/streamer/${streamerName}/status`);
const data = await response.json();
console.log("Stream status:", data);
setIsLive(data.status === "live");
} catch (error) {
console.error("Error checking stream status:", error);
setIsLive(false);
} finally {
setIsLoading(false);
}
};
checkStreamStatus();
// Poll for live status changes
const interval = setInterval(checkStreamStatus, 90000); // Check every 90 seconds
return () => clearInterval(interval);
}, [streamerName]);
if (isLoading) {
return <div>Loading...</div>; // Or your loading component
}
return isLive ? <VideoPage streamId={1} /> : <UserPage />;
};
export default StreamerRoute;

View File

@@ -7,12 +7,12 @@ interface ThumbnailProps {
const Thumbnail = ({ path, alt }: ThumbnailProps) => {
return (
<div>
<div id='stream-thumbnail'>
<img
width={300}
src={path}
alt={alt}
className="stream-thumbnail rounded-md"
className="rounded-md"
/>
</div>
)