summaryrefslogtreecommitdiff
path: root/front/src/root.jsx
blob: 82e79c386217e5c60ef5ca38ad62e5b8e45fc8a3 (plain)
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
import { Link, Outlet } from "react-router-dom";

import logo from "./assets/chessh_sm.svg";

import { useAuthContext } from "./context/auth_context";

export const Root = () => {
  const { signedIn, signOut } = useAuthContext();

  return (
    <>
      <div className="container">
        <div className="flex-row-around">
          <Link to="/home">
            <img src={logo} className="logo" alt="CheSSH Logo" />
          </Link>
        </div>
        <div className="navbar">
          <div className="nav">
            {signedIn ? (
              <>
                <Link className="button" onClick={signOut} to="/">
                  Sign Out
                </Link>
                <Link className="link" to="/home">
                  Home
                </Link>
                <Link className="link" to="/password">
                  Password
                </Link>
                <Link className="link" to="/keys">
                  Keys
                </Link>
                <Link className="link" to="/bots">
                  Bots
                </Link>
              </>
            ) : (
              <>
                <a
                  href={process.env.REACT_APP_DISCORD_OAUTH}
                  className="button"
                >
                  👾 Login w/ Discord 👾
                </a>
              </>
            )}

            <Link className="link" to="/man-pages">
              Man Pages
            </Link>
          </div>
        </div>
        <div className="content">
          <Outlet />
        </div>
      </div>
    </>
  );
};