Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

2.1 KB
Raw Blame
import { Inbox, LayoutPanelLeft, CircleCheck, Users } from "lucide-react";
import { useTranslation } from "react-i18next";

type PreviewSidebarProps = {
  workspaceName: string;
  projectName: string | null;
};

const rowClassName =
  "flex h-7 items-center gap-2 rounded-md px-2 text-[13px] text-sidebar-foreground";

export function PreviewSidebar({
  workspaceName,
  projectName,
}: PreviewSidebarProps) {
  const { t } = useTranslation();
  const initial = Array.from(workspaceName.trim())[0]?.toUpperCase() ?? "";

  return (
    <div className="flex w-52 shrink-0 flex-col gap-4 px-2.5 py-3">
      <div className="flex h-9 items-center gap-2 rounded-lg bg-accent px-2">
        <span className="flex size-5 shrink-0 items-center justify-center rounded-md bg-foreground font-semibold text-[11px] text-background">
          {initial}
        </span>
        <span className="truncate font-medium text-[13px] text-foreground">
          {workspaceName}
        </span>
      </div>
      <div className="flex flex-col gap-0.5">
        <div className={rowClassName}>
          <Inbox className="size-3.5" />
          {t("navigation:sidebar.inbox")}
        </div>
        <div className={rowClassName}>
          <CircleCheck className="size-3.5" />
          {t("navigation:sidebar.myTasks")}
        </div>
        <div className={rowClassName}>
          <Users className="size-3.5" />
          {t("navigation:sidebar.members")}
        </div>
      </div>
      <div className="flex flex-col gap-0.5">
        <div className="flex h-6 items-center px-2 text-sidebar-foreground/70 text-xs">
          {t("navigation:sidebar.projects")}
        </div>
        {projectName !== null ? (
          <div className={`${rowClassName} bg-accent text-foreground`}>
            <LayoutPanelLeft className="size-3.5" />
            <span className="truncate">{projectName}</span>
          </div>
        ) : (
          <div className="flex h-7 items-center gap-2 rounded-md bg-muted/40 px-2">
            <span className="size-3.5 rounded bg-muted" />
            <span className="h-2 w-24 rounded bg-muted" />
          </div>
        )}
      </div>
    </div>
  );
}