aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/shared/sidebar/Sidebar.tsx
blob: dff26cdd3869aebd372ad2dbc8893f500092f252 (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
import Link from "next/link";
import { useTranslation } from "@/lib/i18n/server";
import { TFunction } from "i18next";

import serverConfig from "@karakeep/shared/config";

import SidebarItem from "./SidebarItem";
import { TSidebarItem } from "./TSidebarItem";

export default async function Sidebar({
  items,
  extraSections,
}: {
  items: (t: TFunction) => TSidebarItem[];
  extraSections?: React.ReactNode;
}) {
  const { t } = await useTranslation();

  return (
    <aside className="flex h-[calc(100vh-64px)] w-60 flex-col gap-5 border-r p-4">
      <div>
        <ul className="space-y-2 text-sm">
          {items(t).map((item) => (
            <SidebarItem
              key={item.name}
              logo={item.icon}
              name={item.name}
              path={item.path}
            />
          ))}
        </ul>
      </div>
      {extraSections}
      <Link
        href={
          serverConfig.serverVersion === "nightly"
            ? `https://github.com/karakeep-app/karakeep`
            : `https://github.com/karakeep-app/karakeep/releases/tag/v${serverConfig.serverVersion}`
        }
        target="_blank"
        rel="noopener noreferrer"
        className="mt-auto flex items-center border-t pt-2 text-sm text-gray-400 hover:underline"
      >
        Karakeep v{serverConfig.serverVersion}
      </Link>
    </aside>
  );
}