import { useMemo } from "react"; import { Users } from "lucide-react"; import { Select, SelectOption, } from "@nous-research/ui/ui/components/select"; import { useProfileScope } from "@/contexts/useProfileScope"; import { useI18n } from "@/i18n"; import { cn } from "@/lib/utils"; /** * The machine dashboard's single write-target selector. * * Rendered in the sidebar above the nav. Every management page (Config, * Keys, Skills, MCP, Models) reads/writes the selected profile via the * fetchJSON ?profile= injection. Hidden when only one profile exists. */ export function ProfileSwitcher({ collapsed }: ProfileSwitcherProps) { const { profile, currentProfile, profiles, setProfile } = useProfileScope(); const { t } = useI18n(); const currentDashboardLabel = useMemo( () => (t.app.currentProfileOption ?? "this dashboard ({name})").replace( "{name}", currentProfile || "default", ), [currentProfile, t.app.currentProfileOption], ); if (profiles.length < 2) return null; const managed = profile || currentProfile || "default"; const isOther = !!profile && profile !== currentProfile; const managingLabel = t.app.managingProfile ?? "Managing profile"; return (