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

@@ -41,12 +41,12 @@ export function StreamsProvider({ children }: { children: React.ReactNode }) {
// Streams
fetch(fetch_url[0])
.then((response) => response.json())
.then((data) => {
const extractedData: StreamItem[] = data.streams.map((stream: any) => ({
.then((data: StreamItem[]) => {
const extractedData: StreamItem[] = data.map((stream: any) => ({
type: "stream",
id: stream.stream_id,
title: stream.title,
streamer: stream.user_id,
streamer: stream.username,
viewers: stream.num_viewers,
thumbnail: stream.thumbnail,
}));
@@ -56,15 +56,17 @@ export function StreamsProvider({ children }: { children: React.ReactNode }) {
// Categories
fetch(fetch_url[1])
.then((response) => response.json())
.then((data) => {
const extractedData: CategoryItem[] = data.categories.map(
.then((data: CategoryItem[]) => {
const extractedData: CategoryItem[] = data.map(
(category: any) => ({
type: "category",
id: category.category_id,
title: category.category_name,
viewers: category.num_viewers,
thumbnail: `/images/thumbnails/categories/${category.category_name.toLowerCase().replace(/ /g, "_")}.webp`
})
);
console.log(extractedData);
setFeaturedCategories(extractedData);
});
}, []);