aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/components/Sidebar/Footer.tsx
blob: 070301a7f64ef25874e3d5df69c43254042fe262 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import React, { useRef } from "react";
import { Link } from "react-router-dom";

import styles from "./Sidebar.module.css";

import { UserProfile } from "@customTypes/Profile";
import Login from "@components/Login";

import {
    UploadIcon,
    BookIcon,
    HelpIcon,
} from "../../images/Images";

interface FooterProps {
    profile?: UserProfile;
    onUploadRun: () => void;
    setProfile: React.Dispatch<React.SetStateAction<UserProfile | undefined>>;
    setToken: React.Dispatch<React.SetStateAction<string | undefined>>;
    sidebarButtonRefs: React.RefObject<(HTMLButtonElement | null)[]>;
    getButtonClasses: (buttonIndex: number) => string;
    handle_sidebar_click: (clicked_sidebar_idx: number) => void;
};

const Footer: React.FC<FooterProps> = ({ profile, onUploadRun, setToken, setProfile, sidebarButtonRefs, getButtonClasses, handle_sidebar_click }) => {
    const uploadRunRef = useRef<HTMLButtonElement>(null);

    return (
        <div className="">
            {profile && profile.profile && (
                <button
                    ref={uploadRunRef}
                    id="upload-run"
                    className={getButtonClasses(-1)}
                    onClick={() => onUploadRun()}
                >
                    <img src={UploadIcon} alt="Upload" className={``} />
                    {true && <span className="font-[--font-barlow-semicondensed-regular] truncate">Upload Record</span>}
                </button>
            )}

            <div className={true ? 'min-w-0' : 'flex justify-center'}>
                <Login
                    setToken={setToken}
                    profile={profile}
                    setProfile={setProfile}
                    isOpen={true}
                />
            </div>

            <Link to="/rules" tabIndex={-1}>
                <button
                    ref={el => {
                        sidebarButtonRefs.current[5] = el
                    }}
                    className={`${styles.button}`}
                    onClick={() => handle_sidebar_click(5)}
                >
                    <img src={BookIcon} alt="Rules" />
                    {true && <span className="font-[--font-barlow-semicondensed-regular] truncate">Leaderboard Rules</span>}
                </button>
            </Link>

            <Link to="/about" tabIndex={-1}>
                <button
                    ref={el => {
                        sidebarButtonRefs.current[6] = el
                    }}
                    className={`${styles.button}`}
                    onClick={() => handle_sidebar_click(6)}
                >
                    <img src={HelpIcon} alt="About" />
                    {true && <span className="font-[--font-barlow-semicondensed-regular] truncate">About LPHUB</span>}
                </button>
            </Link>
        </div>
    );
}

export default Footer;