import React from 'react' import { Box, Text } from 'ink' import { Surface } from '../../../../ui/Surface.js' import { Select } from '../../../../ui/Select.js' import { theme } from '../../../../ui/theme.js' import { transferSnapshotView } from '../../transfer/state.js' import type { EthagentIdentity } from '../../../../storage/config.js' type UnlinkedIdentityScreenProps = { identity?: EthagentIdentity agentId?: string onLoadAgent: () => void onOpenMenu: () => void onRetry?: () => void onCancel: () => void } type Action = 'load-agent' | 'open-menu' | 'retry' export const UnlinkedIdentityScreen: React.FC = ({ identity, agentId, onLoadAgent, onOpenMenu, onRetry, onCancel, }) => { const options: Array<{ value: Action; label: string; hint?: string; role?: 'section' | 'utility' }> = [ { value: 'load-agent', role: 'section', label: 'Switch Agent' }, { value: 'load-agent', label: 'Switch Agent', hint: 'Reconnect or switch wallet' }, { value: 'open-menu', role: 'section', label: 'Identity' }, { value: 'open-menu', label: 'Open Identity', hint: 'Browse without reconnecting' }, ] if (onRetry) { options.push({ value: 'retry', role: 'section', label: 'Recheck' }) options.push({ value: 'retry', label: 'Retry Ownership Check', hint: 'Recheck owner onchain', role: 'utility' }) } const tokenLabel = agentId ? `Token #${agentId}` : 'Token' const transferSnapshot = transferSnapshotView(identity) return ( ↵ select · esc back} > {transferSnapshot ? ( <> {tokenLabel} was transferred. Local files remain. Back them up before reuse. ) : ( <> {tokenLabel} left this wallet without Prepare Transfer, so the new holder has no continuity handoff. Local files remain. Back them up before reuse. )} options={options} hintLayout="inline" onSubmit={choice => { if (choice === 'load-agent') return onLoadAgent() if (choice === 'open-menu') return onOpenMenu() if (choice === 'retry') return onRetry?.() }} onCancel={onCancel} /> ) }