From 90a17a3353a98b18c7f5b411b5480ab571626414 Mon Sep 17 00:00:00 2001 From: Korbs Date: Thu, 25 Jul 2024 00:51:54 -0400 Subject: [PATCH] Add Twitch categories to Home page --- src/pages/index.astro | 53 ++++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/src/pages/index.astro b/src/pages/index.astro index ff89f60..94843af 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -5,12 +5,14 @@ import Base from "@layouts/Default.astro"; // Configuration import { DEFAULT_MEDIA_DATA_PROXY, - DEFAULT_IMAGE_PROXY + DEFAULT_IMAGE_PROXY, +DEFAULT_STREAM_DATA_PROXY } from '@utils/GetConfig' import { FireFlame, Frame, Gamepad, GraphUp, Movie, MusicDoubleNote } from "@iconoir/vue"; // Components import Trending from "@components/category/trending.astro"; +import Chip from "@components/Chip.astro"; // Fetch const TrendingFetch = DEFAULT_MEDIA_DATA_PROXY + '/api/v1/trending' @@ -34,17 +36,22 @@ const GamingFetch = DEFAULT_MEDIA_DATA_PROXY + '/api/v1/trending?type=gaming' const GamingResponse = await fetch(GamingFetch) const GamingData = await GamingResponse.json() const GamingSplit = GamingData.slice(0, 1) + +/// Twitch (/api/discover/) +const TwitchDiscoverFetch = await fetch(DEFAULT_STREAM_DATA_PROXY + '/api/discover') +const TwitchDiscoverData = await TwitchDiscoverFetch.json() ---
-
+
-
+
{TrendingSplit.map((data) => - + +

{t("SIDEBAR.CATEGORY_LIST.TRENDING")}

@@ -52,7 +59,8 @@ const GamingSplit = GamingData.slice(0, 1)
)} {MoviesSplit.map((data) => - + +

{t("SIDEBAR.CATEGORY_LIST.MOVIES")}

@@ -60,7 +68,8 @@ const GamingSplit = GamingData.slice(0, 1)
)} {MusicSplit.map((data) => - + +

{t("SIDEBAR.CATEGORY_LIST.MUSIC")}

@@ -68,7 +77,8 @@ const GamingSplit = GamingData.slice(0, 1)
)} {GamingSplit.map((data) => - + + +
+
+ {TwitchDiscoverData.data.map((data) => + + +
+

{data.displayName}

+
+
+ )} +
-