diff options
| author | Wolfboy248 <georgejvindkarlsen@gmail.com> | 2025-08-25 09:36:51 +0200 |
|---|---|---|
| committer | Wolfboy248 <georgejvindkarlsen@gmail.com> | 2025-08-25 09:36:51 +0200 |
| commit | 246eabe4a46d2585d653738e46089ed2bfada8bd (patch) | |
| tree | c86dd05119b0aa086a5d5401dd6a48d90a6f3bbd /frontend/src/components/Sidebar/Footer.tsx | |
| parent | Reorganised Maplist and Sidebar (diff) | |
| download | lphub-246eabe4a46d2585d653738e46089ed2bfada8bd.tar.gz lphub-246eabe4a46d2585d653738e46089ed2bfada8bd.tar.bz2 lphub-246eabe4a46d2585d653738e46089ed2bfada8bd.zip | |
Restructured sidebar and implemented links var
Diffstat (limited to 'frontend/src/components/Sidebar/Footer.tsx')
| -rw-r--r-- | frontend/src/components/Sidebar/Footer.tsx | 56 |
1 files changed, 23 insertions, 33 deletions
diff --git a/frontend/src/components/Sidebar/Footer.tsx b/frontend/src/components/Sidebar/Footer.tsx index 070301a..8e910b3 100644 --- a/frontend/src/components/Sidebar/Footer.tsx +++ b/frontend/src/components/Sidebar/Footer.tsx | |||
| @@ -12,26 +12,28 @@ import { | |||
| 12 | HelpIcon, | 12 | HelpIcon, |
| 13 | } from "../../images/Images"; | 13 | } from "../../images/Images"; |
| 14 | 14 | ||
| 15 | import links from "./Links"; | ||
| 16 | |||
| 15 | interface FooterProps { | 17 | interface FooterProps { |
| 16 | profile?: UserProfile; | 18 | profile?: UserProfile; |
| 19 | isSearching: boolean; | ||
| 20 | selectedButtonIndex: number; | ||
| 17 | onUploadRun: () => void; | 21 | onUploadRun: () => void; |
| 18 | setProfile: React.Dispatch<React.SetStateAction<UserProfile | undefined>>; | 22 | setProfile: React.Dispatch<React.SetStateAction<UserProfile | undefined>>; |
| 19 | setToken: React.Dispatch<React.SetStateAction<string | undefined>>; | 23 | setToken: React.Dispatch<React.SetStateAction<string | undefined>>; |
| 20 | sidebarButtonRefs: React.RefObject<(HTMLButtonElement | null)[]>; | ||
| 21 | getButtonClasses: (buttonIndex: number) => string; | ||
| 22 | handle_sidebar_click: (clicked_sidebar_idx: number) => void; | 24 | handle_sidebar_click: (clicked_sidebar_idx: number) => void; |
| 23 | }; | 25 | }; |
| 24 | 26 | ||
| 25 | const Footer: React.FC<FooterProps> = ({ profile, onUploadRun, setToken, setProfile, sidebarButtonRefs, getButtonClasses, handle_sidebar_click }) => { | 27 | const _Footer: React.FC<FooterProps> = ({ profile, isSearching, selectedButtonIndex, onUploadRun, setToken, setProfile, handle_sidebar_click }) => { |
| 26 | const uploadRunRef = useRef<HTMLButtonElement>(null); | 28 | const uploadRunRef = useRef<HTMLButtonElement>(null); |
| 27 | 29 | ||
| 28 | return ( | 30 | return ( |
| 29 | <div className=""> | 31 | <div className="px-2 gap-2 flex flex-col mb-2"> |
| 30 | {profile && profile.profile && ( | 32 | {profile && profile.profile && ( |
| 31 | <button | 33 | <button |
| 32 | ref={uploadRunRef} | 34 | ref={uploadRunRef} |
| 33 | id="upload-run" | 35 | id="upload-run" |
| 34 | className={getButtonClasses(-1)} | 36 | className={``} |
| 35 | onClick={() => onUploadRun()} | 37 | onClick={() => onUploadRun()} |
| 36 | > | 38 | > |
| 37 | <img src={UploadIcon} alt="Upload" className={``} /> | 39 | <img src={UploadIcon} alt="Upload" className={``} /> |
| @@ -39,42 +41,30 @@ const Footer: React.FC<FooterProps> = ({ profile, onUploadRun, setToken, setProf | |||
| 39 | </button> | 41 | </button> |
| 40 | )} | 42 | )} |
| 41 | 43 | ||
| 42 | <div className={true ? 'min-w-0' : 'flex justify-center'}> | 44 | {/* <div className={true ? 'min-w-0' : 'flex justify-center'}> |
| 43 | <Login | 45 | <Login |
| 44 | setToken={setToken} | 46 | setToken={setToken} |
| 45 | profile={profile} | 47 | profile={profile} |
| 46 | setProfile={setProfile} | 48 | setProfile={setProfile} |
| 47 | isOpen={true} | 49 | isOpen={true} |
| 48 | /> | 50 | /> |
| 49 | </div> | 51 | </div> */} |
| 50 | |||
| 51 | <Link to="/rules" tabIndex={-1}> | ||
| 52 | <button | ||
| 53 | ref={el => { | ||
| 54 | sidebarButtonRefs.current[5] = el | ||
| 55 | }} | ||
| 56 | className={`${styles.button}`} | ||
| 57 | onClick={() => handle_sidebar_click(5)} | ||
| 58 | > | ||
| 59 | <img src={BookIcon} alt="Rules" /> | ||
| 60 | {true && <span className="font-[--font-barlow-semicondensed-regular] truncate">Leaderboard Rules</span>} | ||
| 61 | </button> | ||
| 62 | </Link> | ||
| 63 | 52 | ||
| 64 | <Link to="/about" tabIndex={-1}> | 53 | {links.footer.map(({ to, icon, label }, i) => ( |
| 65 | <button | 54 | <Link to={to} tabIndex={-1} key={i}> |
| 66 | ref={el => { | 55 | <button |
| 67 | sidebarButtonRefs.current[6] = el | 56 | className={`${styles.button} ${selectedButtonIndex == links.content.length + i + 1 ? styles["button-selected"] : ""} ${isSearching ? styles["button-hidden"] : ""}`} |
| 68 | }} | 57 | onClick={() => handle_sidebar_click(links.content.length + i + 1)} |
| 69 | className={`${styles.button}`} | 58 | > |
| 70 | onClick={() => handle_sidebar_click(6)} | 59 | <img src={icon} /> |
| 71 | > | 60 | <span className=""> |
| 72 | <img src={HelpIcon} alt="About" /> | 61 | {label} |
| 73 | {true && <span className="font-[--font-barlow-semicondensed-regular] truncate">About LPHUB</span>} | 62 | </span> |
| 74 | </button> | 63 | </button> |
| 75 | </Link> | 64 | </Link> |
| 65 | ))} | ||
| 76 | </div> | 66 | </div> |
| 77 | ); | 67 | ); |
| 78 | } | 68 | } |
| 79 | 69 | ||
| 80 | export default Footer; | 70 | export default _Footer; |