From 246eabe4a46d2585d653738e46089ed2bfada8bd Mon Sep 17 00:00:00 2001 From: Wolfboy248 Date: Mon, 25 Aug 2025 09:36:51 +0200 Subject: Restructured sidebar and implemented links var --- frontend/src/App.css | 1 + frontend/src/App.tsx | 4 +- frontend/src/components/Sidebar/Content.tsx | 117 ++++----------------- frontend/src/components/Sidebar/Footer.tsx | 56 ++++------ frontend/src/components/Sidebar/Header.tsx | 6 +- frontend/src/components/Sidebar/Links.ts | 53 ++++++++++ frontend/src/components/Sidebar/Search.tsx | 66 ++++++++++++ frontend/src/components/Sidebar/Sidebar.module.css | 16 ++- frontend/src/components/Sidebar/Sidebar.tsx | 82 ++++++--------- 9 files changed, 214 insertions(+), 187 deletions(-) create mode 100644 frontend/src/components/Sidebar/Links.ts create mode 100644 frontend/src/components/Sidebar/Search.tsx (limited to 'frontend') diff --git a/frontend/src/App.css b/frontend/src/App.css index 3e0d813..d443222 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -4,6 +4,7 @@ @theme { --color-main: #141520; + --color-input: #161723; --color-panel: #202232; --color-block: #2b2e46; --color-bright: #333753; diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 5d0c8eb..2451307 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -89,7 +89,7 @@ const App: React.FC = () => { games={games} /> -
+
{ onUploadRun={() => setUploadRunDialog(true)} /> -
+
} /> diff --git a/frontend/src/components/Sidebar/Content.tsx b/frontend/src/components/Sidebar/Content.tsx index 4051b08..3d9533a 100644 --- a/frontend/src/components/Sidebar/Content.tsx +++ b/frontend/src/components/Sidebar/Content.tsx @@ -1,124 +1,45 @@ import React, { useRef } from "react"; -import { Link } from "react-router-dom"; +import { Link, useLocation } from "react-router-dom"; import { UserProfile } from "@customTypes/Profile"; -import { Search } from "@customTypes/Search"; -import { API } from "@api/Api"; import styles from "./Sidebar.module.css"; import { - FlagIcon, - HomeIcon, - PortalIcon, SearchIcon, } from "../../images/Images"; +import links from "./Links"; + interface ContentProps { profile?: UserProfile; + isSearching: boolean; + selectedButtonIndex: number isSidebarOpen: boolean; - sidebarButtonRefs: React.RefObject<(HTMLButtonElement | null)[]>; - getButtonClasses: (buttonIndex: number) => string; handle_sidebar_click: (clicked_sidebar_idx: number) => void; }; -const Content: React.FC = ({ profile, isSidebarOpen, sidebarButtonRefs, getButtonClasses, handle_sidebar_click }) => { - const [searchData, setSearchData] = React.useState( - undefined - ); - - const searchbarRef = useRef(null); - - const _handle_search_change = async (q: string) => { - const searchResponse = await API.get_search(q); - setSearchData(searchResponse); - }; - - const iconClasses = ""; +const _Content: React.FC = ({ profile, isSearching, selectedButtonIndex, isSidebarOpen, handle_sidebar_click }) => { return (
-
-
- Search - Search -
- -
- _handle_search_change(e.target.value)} - className="w-full p-2 bg-input text-foreground border border-border rounded-lg text-sm min-w-0" - /> - - {searchData && ( -
- {searchData?.maps.map((q, index) => ( - - {q.game} - {q.chapter} - {q.map} - - ))} - {searchData?.players.map((q, index) => ( - - pfp - - {q.user_name} - - - ))} -
- )} -
+
+
-
+