summaryrefslogtreecommitdiff
path: root/front/src/components/layout/Sidebar.tsx
blob: c267e2fbe9c695f55956625da14e56b643faa0c9 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import { RADIO, versionNum } from "@/logic/constants";
import { useLocation } from "wouter";
import useLocalState from "@/state/state";
import logo from "@/assets/icons/logo.png";
import Icon from "@/components/Icon";
import { ThemeSwitcher } from "@/styles/ThemeSwitcher";

function SlidingMenu() {
  const [_, navigate] = useLocation();
  const { api, unreadNotifications, setModal } = useLocalState((s) => ({ 
    api: s.api,
    unreadNotifications: s.unreadNotifications,
    setModal: s.setModal
  }));
  
  function goto(to: string) {
    navigate(to);
  }
  
  function openNotifications() {
    // We'll create this component next
    import("../NotificationCenter").then(({ default: NotificationCenter }) => {
      setModal(<NotificationCenter />);
    });
  }
  return (
    <div id="left-menu">
      <div id="logo">
        <img src={logo} />
        <h3> Nostrill </h3>
      </div>
      <h3>Feeds</h3>
      <div className="opt" role="link" onClick={() => goto(`/feed/global`)}>
        <Icon name="home" size={20} />
        <div>Home</div>
      </div>
      <div className="opt notification-item" role="link" onClick={openNotifications}>
        <div className="notification-icon-wrapper">
          <Icon name="bell" size={20} />
          {unreadNotifications > 0 && (
            <span className="notification-badge">
              {unreadNotifications > 99 ? "99+" : unreadNotifications}
            </span>
          )}
        </div>
        <div>Notifications</div>
      </div>
      <hr />

      <div
        className="opt tbd"
        role="link"
        // onClick={() => goto("/chat")}
      >
        <Icon name="messages" size={20} />
        <div>Messages</div>
      </div>
      <div className="opt" role="link" onClick={() => goto("/pals")}>
        <Icon name="pals" size={20} />
        <div>Pals</div>
      </div>
      <hr />
      <div
        className="opt"
        role="link"
        onClick={() => goto(`/feed/${api!.airlock.our}`)}
      >
        <Icon name="profile" size={20} />
        <div>Profile</div>
      </div>
      <hr />
      <div className="opt" role="link" onClick={() => goto("/sets")}>
        <Icon name="settings" size={20} />
        <div>Settings</div>
      </div>
      <ThemeSwitcher />
    </div>
  );
}
export default SlidingMenu;