({
canResetWidth,
currentPubkey,
isSinglePanelView = false,
layout = "standalone",
onClose,
onOpenDm,
onOpenProfile,
onResetWidth,
onResizeStart,
onTabChange,
onViewChange,
persona,
pubkey,
splitPaneClamp = false,
tab: controlledTab,
view: controlledView,
widthPx,
transparentChrome = false,
}: UserProfilePanelProps)
| 99 | export type { ProfilePanelTab, ProfilePanelView }; |
| 100 | |
| 101 | export function UserProfilePanel({ |
| 102 | canResetWidth, |
| 103 | currentPubkey, |
| 104 | isSinglePanelView = false, |
| 105 | layout = "standalone", |
| 106 | onClose, |
| 107 | onOpenDm, |
| 108 | onOpenProfile, |
| 109 | onResetWidth, |
| 110 | onResizeStart, |
| 111 | onTabChange, |
| 112 | onViewChange, |
| 113 | persona, |
| 114 | pubkey, |
| 115 | splitPaneClamp = false, |
| 116 | tab: controlledTab, |
| 117 | view: controlledView, |
| 118 | widthPx, |
| 119 | transparentChrome = false, |
| 120 | }: UserProfilePanelProps) { |
| 121 | const isOverlay = useIsThreadPanelOverlay(); |
| 122 | const isSplitLayout = layout === "split"; |
| 123 | useEscapeKey(onClose, isOverlay || isSinglePanelView); |
| 124 | |
| 125 | const [internalView, setInternalView] = |
| 126 | React.useState<ProfilePanelView>("summary"); |
| 127 | const view = controlledView ?? internalView; |
| 128 | const setView = React.useCallback( |
| 129 | (nextView: ProfilePanelView, options?: { replace?: boolean }) => { |
| 130 | if (onViewChange) { |
| 131 | onViewChange(nextView, options); |
| 132 | return; |
| 133 | } |
| 134 | setInternalView(nextView); |
| 135 | }, |
| 136 | [onViewChange], |
| 137 | ); |
| 138 | const [internalTab, setInternalTab] = React.useState<ProfilePanelTab>("info"); |
| 139 | const tab = controlledTab ?? internalTab; |
| 140 | const setTab = React.useCallback( |
| 141 | (nextTab: ProfilePanelTab, options?: { replace?: boolean }) => { |
| 142 | if (onTabChange) { |
| 143 | onTabChange(nextTab, options); |
| 144 | return; |
| 145 | } |
| 146 | setInternalTab(nextTab); |
| 147 | }, |
| 148 | [onTabChange], |
| 149 | ); |
| 150 | const [editAgentOpen, setEditAgentOpen] = React.useState(false); |
| 151 | const [addToChannelOpen, setAddToChannelOpen] = React.useState(false); |
| 152 | const [personaDialogState, setPersonaDialogState] = |
| 153 | React.useState<PersonaDialogState | null>(null); |
| 154 | const [personaToDelete, setPersonaToDelete] = |
| 155 | React.useState<AgentPersona | null>(null); |
| 156 | |
| 157 | const personasQuery = usePersonasQuery(); |
| 158 | const managedAgentsQuery = useManagedAgentsQuery({ enabled: true }); |
nothing calls this directly
no test coverage detected