import React from "react" import { Box, Text } from "ink" import type { AccountView } from "../types" export function AccountSelector(props: { accounts: AccountView[]; selected: number; title?: string; description?: string }) { return ( ──────────────────────────────────────────────────────────────────────────── {props.title ?? "Select account"} {props.description ?? "Switch accounts. Applies to this session and future requests."} {props.accounts.map((account, index) => ( {index === props.selected ? "›" : " "}{index + 1}. {account.name} {index === props.selected ? " ✓" : ""} {accountDetail(account)} ))} {!props.accounts.length && No accounts available. Use /connect to add one.} ↑/↓ choose · Enter switch · Esc cancel ) } function accountDetail(account: AccountView) { if (account.detail) return account.detail return [ account.email, account.plan, account.accountId ? account.accountId.slice(0, 8) : account.key, ].filter(Boolean).join(" · ") }