import { DropdownMenu } from "@cloudflare/kumo/components/dropdown";
import { ListIcon } from "@phosphor-icons/react";
import { Link, useNavigate } from "@tanstack/react-router";
import { signOut } from "~/fns/auth";
import { resetAnalytics } from "~/lib/analytics";
import { useAction } from "~/hooks/use-action";
import { useEmailUnverified, useSupporter, useUnreadNotifications, useViewer } from "~/hooks/use-viewer";
import { ProBadge } from "~/components/billing/ProBadge";
import { Avatar } from "~/ui/Avatar";
import { Logo } from "~/ui/Logo";
import { buttonClass } from "~/ui/Button";
import { SearchForm } from "~/components/SearchForm";
import { Icon } from "~/ui/Icon";
import { cn } from "~/utils/cn";
const MEMBER_NAV = [{ to: "/explore", label: "Explore" }] as const;
const VISITOR_NAV = [
{ to: "/features", label: "Features" },
{ to: "/pricing", label: "Pricing" },
{ to: "/self-host", label: "Self-host" },
{ to: "/explore", label: "Explore" },
] as const;
function UserMenu({ name, isAdmin }: { name: string; isAdmin: boolean }) {
const navigate = useNavigate();
const supporter = useSupporter();
const logout = useAction(signOut);
const items = [
{ to: "/$owner", params: { owner: name }, label: "Your profile" },
{ to: "/settings", params: {}, label: "Settings" },
{ to: "/settings/billing", params: {}, label: "Billing" },
{ to: "/settings/tokens", params: {}, label: "Access tokens" },
{ to: "/settings/containers", params: {}, label: "Containers" },
{ to: "/orgs/new", params: {}, label: "New organization" },
...(isAdmin ? [{ to: "/admin", params: {}, label: "Site admin" } as const] : []),
];
async function handleSignOut() {
await logout.run({});