diff --git a/AgentCompany-New/src/renderer/src/shared/OrgSwitcher.tsx b/AgentCompany-New/src/renderer/src/shared/OrgSwitcher.tsx index 0d81ab6b..f46b8e32 100644 --- a/AgentCompany-New/src/renderer/src/shared/OrgSwitcher.tsx +++ b/AgentCompany-New/src/renderer/src/shared/OrgSwitcher.tsx @@ -2,6 +2,10 @@ import { useEffect, useRef, useState } from "react"; import type { AppSnapshot, OrganizationRecord } from "../../../shared/domain"; import { Icon } from "./Icon"; +function orgInitial(name: string): string { + return name.trim().charAt(0).toUpperCase(); +} + interface OrgSwitcherProps { snapshot: AppSnapshot; activeOrgId: string; @@ -29,7 +33,7 @@ export function OrgSwitcher({ snapshot, activeOrgId, onSelect, onNew, onDelete } return () => document.removeEventListener("mousedown", onDocClick); }, [open]); - const initial = active.name.trim().charAt(0).toUpperCase() || "A"; + const initial = orgInitial(active.name); const orgs = snapshot.organizations; const handleSelect = (orgId: string) => { @@ -113,7 +117,7 @@ function OrgRow({ onConfirmDelete: () => void; canDelete: boolean; }) { - const initial = org.name.trim().charAt(0).toUpperCase() || "A"; + const initial = orgInitial(org.name); if (confirming) { return (