From da1fd74f9387149b2b94d62853587a8afdb74ddd Mon Sep 17 00:00:00 2001 From: Wolfboy248 Date: Thu, 21 Aug 2025 10:33:27 +0200 Subject: Reorganised Maplist and Sidebar --- frontend/src/components/Sidebar/Content.tsx | 133 ++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 frontend/src/components/Sidebar/Content.tsx (limited to 'frontend/src/components/Sidebar/Content.tsx') diff --git a/frontend/src/components/Sidebar/Content.tsx b/frontend/src/components/Sidebar/Content.tsx new file mode 100644 index 0000000..4051b08 --- /dev/null +++ b/frontend/src/components/Sidebar/Content.tsx @@ -0,0 +1,133 @@ +import React, { useRef } from "react"; +import { Link } 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"; + +interface ContentProps { + profile?: UserProfile; + 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 = ""; + + 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} + + + ))} +
+ )} +
+
+ +
+ +
+
+ ); +} + +export default Content; -- cgit v1.2.3