Patch: Fix to StreamerRoute to correctly send user to UserPage/VideoPage;

Update: Display Category Thumbnails
This commit is contained in:
Chris-1010
2025-01-29 14:51:04 +00:00
parent a4f66ba321
commit c0a110c76d
20 changed files with 25 additions and 190 deletions

View File

@@ -27,6 +27,7 @@ const ListItem: React.FC<ListItemProps> = ({
thumbnail,
onItemClick,
}) => {
console.log(title, "thumbnail", thumbnail);
return (
<div
className="flex flex-col bg-gray-800 rounded-lg overflow-hidden cursor-pointer hover:bg-gray-700 transition-colors"
@@ -35,7 +36,7 @@ const ListItem: React.FC<ListItemProps> = ({
<div className="relative w-full pt-[56.25%]">
{thumbnail ? (
<img
src={`images/` + thumbnail}
src={thumbnail}
alt={title}
className="absolute top-0 left-0 w-full h-full object-cover"
/>
@@ -74,6 +75,7 @@ const ListRow: React.FC<ListRowProps> = ({
title={item.title}
streamer={item.type === "stream" ? (item.streamer) : undefined}
viewers={item.viewers}
thumbnail={item.thumbnail}
onItemClick={() =>
onClick?.(item.id, item.streamer || item.title)
}

View File

@@ -13,8 +13,7 @@ const StreamerRoute: React.FC = () => {
try {
const response = await fetch(`/api/streamer/${streamerName}/status`);
const data = await response.json();
console.log("Stream status:", data);
setIsLive(data.status === "live");
setIsLive(data.is_live);
} catch (error) {
console.error("Error checking stream status:", error);
setIsLive(false);
@@ -36,7 +35,7 @@ const StreamerRoute: React.FC = () => {
}
// streamId=0 is a special case for the streamer's latest stream
return isLive ? <VideoPage streamId={0} /> : <UserPage profile={streamerName} />;
return isLive ? <VideoPage streamId={0} /> : (streamerName ? <UserPage username={streamerName} /> : <div>Error: Streamer not found</div>);
};
export default StreamerRoute;