🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
"use client";
import { AppWindow, Building2, Combine, CreditCard, UserCircle, Users } from "lucide-react";
import { useExtracted } from "next-intl";
import { usePathname } from "next/navigation";
import { useActiveOrgName } from "../../hooks/useActiveOrgName";
import { useOrgPermissions } from "../../hooks/usePermissions";
import { IS_CLOUD } from "../../lib/const";
import { OrganizationSelector } from "../OrganizationSelector";
import { Sidebar } from "./Sidebar";
export function NavigationSidebar() {
const t = useExtracted();
const pathname = usePathname();
const { can } = useOrgPermissions();
const activeOrgName = useActiveOrgName();
const showOrgSettings = can("members:manage") || can("teams:manage") || (IS_CLOUD && can("billing:manage"));
return (
<Sidebar.Root>
<div className="p-3 pt-4 border-b border-neutral-300 dark:border-neutral-800">
<OrganizationSelector />
</div>
<Sidebar.Items>
<Sidebar.Item
label={t("Properties")}
active={pathname === "/"}
href="/"
icon={<AppWindow className="w-4 h-4" />}
/>
<Sidebar.Item
label={t("Rollup")}
active={pathname.startsWith("/rollup")}
href="/rollup"
icon={<Combine className="w-4 h-4" />}
/>
<Sidebar.SectionHeader>{t("Personal")}</Sidebar.SectionHeader>
<Sidebar.Item
label={t("Account")}
active={pathname.startsWith("/settings/account")}
href="/settings/account"
icon={<UserCircle className="w-4 h-4" />}
/>
{showOrgSettings && <Sidebar.SectionHeader>{activeOrgName ?? t("Organization")}</Sidebar.SectionHeader>}
{can("members:manage") && (
<Sidebar.Item
label={t("Organization")}
active={pathname === "/settings/organization"}
href="/settings/organization"
icon={<Building2 className="w-4 h-4" />}
/>
)}
{can("teams:manage") && (
<Sidebar.Item
label={t("Teams")}
active={pathname.startsWith("/settings/teams")}
href="/settings/teams"
icon={<Users className="w-4 h-4" />}
/>
)}
{IS_CLOUD && can("billing:manage") && (
<Sidebar.Item
label={t("Billing")}
active={pathname.startsWith("/settings/billing")}
href="/settings/billing"
icon={<CreditCard className="w-4 h-4" />}
/>
)}
</Sidebar.Items>
</Sidebar.Root>
);
}