diff options
| author | Wolfboy248 <georgejvindkarlsen@gmail.com> | 2025-08-25 09:47:23 +0200 |
|---|---|---|
| committer | Wolfboy248 <georgejvindkarlsen@gmail.com> | 2025-08-25 09:47:23 +0200 |
| commit | 3f0655d280e744e685b5b449d716ff1443c93690 (patch) | |
| tree | 6fff4e6608c69c15aadff61b32f1f2f55ab61ccc /frontend/src | |
| parent | Restructured sidebar and implemented links var (diff) | |
| download | lphub-3f0655d280e744e685b5b449d716ff1443c93690.tar.gz lphub-3f0655d280e744e685b5b449d716ff1443c93690.tar.bz2 lphub-3f0655d280e744e685b5b449d716ff1443c93690.zip | |
Removed unnecessary imports
Diffstat (limited to 'frontend/src')
| -rw-r--r-- | frontend/src/components/Sidebar/Content.tsx | 9 | ||||
| -rw-r--r-- | frontend/src/components/Sidebar/Footer.tsx | 10 | ||||
| -rw-r--r-- | frontend/src/components/Sidebar/Search.tsx | 3 | ||||
| -rw-r--r-- | frontend/src/components/Sidebar/Sidebar.tsx | 15 |
4 files changed, 15 insertions, 22 deletions
diff --git a/frontend/src/components/Sidebar/Content.tsx b/frontend/src/components/Sidebar/Content.tsx index 3d9533a..ceb9e67 100644 --- a/frontend/src/components/Sidebar/Content.tsx +++ b/frontend/src/components/Sidebar/Content.tsx | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | import React, { useRef } from "react"; | 1 | import React from "react"; |
| 2 | import { Link, useLocation } from "react-router-dom"; | 2 | import { Link } from "react-router-dom"; |
| 3 | import { UserProfile } from "@customTypes/Profile"; | ||
| 4 | 3 | ||
| 5 | import styles from "./Sidebar.module.css"; | 4 | import styles from "./Sidebar.module.css"; |
| 6 | 5 | ||
| @@ -11,14 +10,12 @@ import { | |||
| 11 | import links from "./Links"; | 10 | import links from "./Links"; |
| 12 | 11 | ||
| 13 | interface ContentProps { | 12 | interface ContentProps { |
| 14 | profile?: UserProfile; | ||
| 15 | isSearching: boolean; | 13 | isSearching: boolean; |
| 16 | selectedButtonIndex: number | 14 | selectedButtonIndex: number |
| 17 | isSidebarOpen: boolean; | ||
| 18 | handle_sidebar_click: (clicked_sidebar_idx: number) => void; | 15 | handle_sidebar_click: (clicked_sidebar_idx: number) => void; |
| 19 | }; | 16 | }; |
| 20 | 17 | ||
| 21 | const _Content: React.FC<ContentProps> = ({ profile, isSearching, selectedButtonIndex, isSidebarOpen, handle_sidebar_click }) => { | 18 | const _Content: React.FC<ContentProps> = ({ isSearching, selectedButtonIndex, handle_sidebar_click }) => { |
| 22 | 19 | ||
| 23 | return ( | 20 | return ( |
| 24 | <div className="h-full"> | 21 | <div className="h-full"> |
diff --git a/frontend/src/components/Sidebar/Footer.tsx b/frontend/src/components/Sidebar/Footer.tsx index 8e910b3..3b0d543 100644 --- a/frontend/src/components/Sidebar/Footer.tsx +++ b/frontend/src/components/Sidebar/Footer.tsx | |||
| @@ -4,12 +4,9 @@ import { Link } from "react-router-dom"; | |||
| 4 | import styles from "./Sidebar.module.css"; | 4 | import styles from "./Sidebar.module.css"; |
| 5 | 5 | ||
| 6 | import { UserProfile } from "@customTypes/Profile"; | 6 | import { UserProfile } from "@customTypes/Profile"; |
| 7 | import Login from "@components/Login"; | ||
| 8 | 7 | ||
| 9 | import { | 8 | import { |
| 10 | UploadIcon, | 9 | UploadIcon, |
| 11 | BookIcon, | ||
| 12 | HelpIcon, | ||
| 13 | } from "../../images/Images"; | 10 | } from "../../images/Images"; |
| 14 | 11 | ||
| 15 | import links from "./Links"; | 12 | import links from "./Links"; |
| @@ -19,12 +16,13 @@ interface FooterProps { | |||
| 19 | isSearching: boolean; | 16 | isSearching: boolean; |
| 20 | selectedButtonIndex: number; | 17 | selectedButtonIndex: number; |
| 21 | onUploadRun: () => void; | 18 | onUploadRun: () => void; |
| 22 | setProfile: React.Dispatch<React.SetStateAction<UserProfile | undefined>>; | 19 | // currently unused, but needed for login component |
| 23 | setToken: React.Dispatch<React.SetStateAction<string | undefined>>; | 20 | // setProfile: React.Dispatch<React.SetStateAction<UserProfile | undefined>>; |
| 21 | // setToken: React.Dispatch<React.SetStateAction<string | undefined>>; | ||
| 24 | handle_sidebar_click: (clicked_sidebar_idx: number) => void; | 22 | handle_sidebar_click: (clicked_sidebar_idx: number) => void; |
| 25 | }; | 23 | }; |
| 26 | 24 | ||
| 27 | const _Footer: React.FC<FooterProps> = ({ profile, isSearching, selectedButtonIndex, onUploadRun, setToken, setProfile, handle_sidebar_click }) => { | 25 | const _Footer: React.FC<FooterProps> = ({ profile, isSearching, selectedButtonIndex, onUploadRun, handle_sidebar_click }) => { |
| 28 | const uploadRunRef = useRef<HTMLButtonElement>(null); | 26 | const uploadRunRef = useRef<HTMLButtonElement>(null); |
| 29 | 27 | ||
| 30 | return ( | 28 | return ( |
diff --git a/frontend/src/components/Sidebar/Search.tsx b/frontend/src/components/Sidebar/Search.tsx index 0c6b868..00d9e1e 100644 --- a/frontend/src/components/Sidebar/Search.tsx +++ b/frontend/src/components/Sidebar/Search.tsx | |||
| @@ -7,10 +7,9 @@ import { UserProfile } from "@customTypes/Profile"; | |||
| 7 | 7 | ||
| 8 | interface SearchProps { | 8 | interface SearchProps { |
| 9 | profile?: UserProfile; | 9 | profile?: UserProfile; |
| 10 | isSearching: boolean; | ||
| 11 | }; | 10 | }; |
| 12 | 11 | ||
| 13 | const _Search: React.FC<SearchProps> = ({ profile, isSearching }) => { | 12 | const _Search: React.FC<SearchProps> = ({ profile }) => { |
| 14 | const [searchData, setSearchData] = React.useState<Search | undefined>( | 13 | const [searchData, setSearchData] = React.useState<Search | undefined>( |
| 15 | undefined | 14 | undefined |
| 16 | ); | 15 | ); |
diff --git a/frontend/src/components/Sidebar/Sidebar.tsx b/frontend/src/components/Sidebar/Sidebar.tsx index 1d58d2e..77e23a6 100644 --- a/frontend/src/components/Sidebar/Sidebar.tsx +++ b/frontend/src/components/Sidebar/Sidebar.tsx | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | import React, { useCallback, useRef } from "react"; | 1 | import React, { useCallback } from "react"; |
| 2 | import { Link, useLocation } from "react-router-dom"; | 2 | import { useLocation } from "react-router-dom"; |
| 3 | import { UserProfile } from "@customTypes/Profile"; | 3 | import { UserProfile } from "@customTypes/Profile"; |
| 4 | 4 | ||
| 5 | import _Header from "./Header"; | 5 | import _Header from "./Header"; |
| @@ -10,19 +10,18 @@ import links from "./Links"; | |||
| 10 | 10 | ||
| 11 | interface SidebarProps { | 11 | interface SidebarProps { |
| 12 | setToken: React.Dispatch<React.SetStateAction<string | undefined>>; | 12 | setToken: React.Dispatch<React.SetStateAction<string | undefined>>; |
| 13 | profile?: UserProfile; | ||
| 14 | setProfile: React.Dispatch<React.SetStateAction<UserProfile | undefined>>; | 13 | setProfile: React.Dispatch<React.SetStateAction<UserProfile | undefined>>; |
| 14 | profile?: UserProfile; | ||
| 15 | onUploadRun: () => void; | 15 | onUploadRun: () => void; |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | const Sidebar: React.FC<SidebarProps> = ({ | 18 | const Sidebar: React.FC<SidebarProps> = ({ |
| 19 | setToken, | 19 | setToken, |
| 20 | profile, | ||
| 21 | setProfile, | 20 | setProfile, |
| 21 | profile, | ||
| 22 | onUploadRun, | 22 | onUploadRun, |
| 23 | }) => { | 23 | }) => { |
| 24 | const [isSearching, setIsSearching] = React.useState<boolean>(false); | 24 | const [isSearching, setIsSearching] = React.useState<boolean>(false); |
| 25 | const [isSidebarOpen, setSidebarOpen] = React.useState<boolean>(false); | ||
| 26 | const [selectedButtonIndex, setSelectedButtonIndex] = React.useState<number>(1); | 25 | const [selectedButtonIndex, setSelectedButtonIndex] = React.useState<number>(1); |
| 27 | 26 | ||
| 28 | const location = useLocation(); | 27 | const location = useLocation(); |
| @@ -67,14 +66,14 @@ const Sidebar: React.FC<SidebarProps> = ({ | |||
| 67 | <div className="flex flex-1 overflow-hidden w-full not-md:hidden "> | 66 | <div className="flex flex-1 overflow-hidden w-full not-md:hidden "> |
| 68 | <div className={`flex flex-col transition-all duration-300 ${isSearching ? "w-[64px]" : "w-full"}`}> | 67 | <div className={`flex flex-col transition-all duration-300 ${isSearching ? "w-[64px]" : "w-full"}`}> |
| 69 | {/* Sidebar Content */} | 68 | {/* Sidebar Content */} |
| 70 | <_Content profile={profile} isSearching={isSearching} selectedButtonIndex={selectedButtonIndex} isSidebarOpen={isSidebarOpen} handle_sidebar_click={handle_sidebar_click} /> | 69 | <_Content isSearching={isSearching} selectedButtonIndex={selectedButtonIndex} handle_sidebar_click={handle_sidebar_click} /> |
| 71 | 70 | ||
| 72 | {/* Bottom Section */} | 71 | {/* Bottom Section */} |
| 73 | <_Footer profile={profile} isSearching={isSearching} selectedButtonIndex={selectedButtonIndex} onUploadRun={onUploadRun} setToken={setToken} setProfile={setProfile} handle_sidebar_click={handle_sidebar_click} /> | 72 | <_Footer profile={profile} isSearching={isSearching} selectedButtonIndex={selectedButtonIndex} onUploadRun={onUploadRun} handle_sidebar_click={handle_sidebar_click} /> |
| 74 | </div> | 73 | </div> |
| 75 | 74 | ||
| 76 | <div className={`flex bg-panel ${isSearching ? 'w-full' : "w-0"}`}> | 75 | <div className={`flex bg-panel ${isSearching ? 'w-full' : "w-0"}`}> |
| 77 | <_Search profile={profile} isSearching={isSearching} /> | 76 | <_Search profile={profile} /> |
| 78 | </div> | 77 | </div> |
| 79 | 78 | ||
| 80 | </div> | 79 | </div> |