From 379140852a0f5ada6fba20b5bae9d2563b17492a Mon Sep 17 00:00:00 2001 From: Chris-1010 <122332721@umail.ucc.ie> Date: Wed, 26 Feb 2025 13:25:40 +0000 Subject: [PATCH] REFACTOR: Update list components style; REFACTOR: Correct loading handling in `AllCategoriesPage`; REFACTOR: Update to `ResultsPage` --- frontend/src/components/Layout/ListItem.tsx | 6 +- frontend/src/components/Layout/ListRow.tsx | 56 ++++--- frontend/src/pages/AllCategoriesPage.tsx | 17 +- frontend/src/pages/ResultsPage.tsx | 171 ++++++++------------ 4 files changed, 105 insertions(+), 145 deletions(-) diff --git a/frontend/src/components/Layout/ListItem.tsx b/frontend/src/components/Layout/ListItem.tsx index 6e0f569..4fe6af0 100644 --- a/frontend/src/components/Layout/ListItem.tsx +++ b/frontend/src/components/Layout/ListItem.tsx @@ -26,13 +26,13 @@ const ListItem: React.FC = ({ return (
{`user -
- - ); - } - return ( - -
+ +

Search results for "{query}"

-
- {searchResults.streams.length > 0 && ( - ({ - id: stream.user_id, - type: "stream", - title: stream.title, - username: stream.username, - streamCategory: stream.category_name, - viewers: stream.num_viewers, - thumbnail: stream.thumbnail_url, - }))} - title="Streams" - onItemClick={(streamer_name: string) => - (window.location.href = `/${streamer_name}`) - } - itemExtraClasses="min-w-[calc(12vw+12vh/2)]" - amountForScroll={3} - /> - )} +
+ ({ + id: stream.user_id, + type: "stream", + title: stream.title, + username: stream.username, + streamCategory: stream.category_name, + viewers: stream.num_viewers, + thumbnail: stream.thumbnail_url, + }))} + title="Streams" + onItemClick={(streamer_name: string) => + (window.location.href = `/${streamer_name}`) + } + extraClasses="min-h-[calc((20vw+20vh)/4)] bg-[var(--liveNow)]" + itemExtraClasses="min-w-[calc(12vw+12vh/2)]" + amountForScroll={3} + /> - {searchResults.categories.length > 0 && ( - ({ - id: category.category_id, - type: "category", - title: category.category_name, - viewers: 0, - thumbnail: `/images/category_thumbnails/${category.category_name - .toLowerCase() - .replace(/ /g, "_")}.webp`, - }))} - title="Categories" - onItemClick={(category_name: string) => - navigate(`/category/${category_name}`) - } - titleClickable={true} - itemExtraClasses="min-w-[calc(12vw+12vh/2)]" - amountForScroll={3} - /> - )} + ({ + id: category.category_id, + type: "category", + title: category.category_name, + viewers: 0, + thumbnail: `/images/category_thumbnails/${category.category_name + .toLowerCase() + .replace(/ /g, "_")}.webp`, + }))} + title="Categories" + onItemClick={(category_name: string) => + navigate(`/category/${category_name}`) + } + titleClickable={true} + extraClasses="min-h-[calc((20vw+20vh)/4)] bg-[var(--liveNow)]" + itemExtraClasses="min-w-[calc(12vw+12vh/2)]" + amountForScroll={3} + /> - {searchResults.users.length > 0 && ( - ({ - id: user.user_id, - type: "user", - title: `${user.is_live ? "🔴" : ""} ${user.username}`, - viewers: 0, - username: user.username, - thumbnail: user.profile_picture, - }))} - title="Users" - onItemClick={(username: string) => - (window.location.href = `/user/${username}`) - } - amountForScroll={3} - itemExtraClasses="min-w-[calc(12vw+12vh/2)]" - /> - )} + ({ + id: user.user_id, + type: "user", + title: `${user.is_live ? "🔴" : ""} ${user.username}`, + viewers: 0, + username: user.username, + thumbnail: user.profile_picture, + }))} + title="Users" + onItemClick={(username: string) => + (window.location.href = `/user/${username}`) + } + amountForScroll={3} + extraClasses="min-h-[calc((20vw+20vh)/4)] bg-[var(--liveNow)]" + itemExtraClasses="min-w-[calc(12vw+12vh/2)]" + />
- -