import { h, Fragment } from 'preact'; import { ID, AccountMeta } from 'common/graph/type'; import AccountSidebarItem from './AccountSidebarItem'; interface Props { accounts: AccountMeta[]; active: ID; onClick: (id: ID) => void; } /** * Displays a list of account buttons stacked vertically, * indicating if they have unread messages, and the active account. * Shows a home account if there are two or more accounts registered. */ export default function AccountSidebar({ accounts, active, onClick }: Props) { return (
{accounts.length > 1 && onClick('')} account={{ unread: true, id: '', name: 'Home', image: '../../client/res/icon/home-account.svg', address: `${accounts.length} Account${accounts.length === 1 ? '' : 's'}` }}/>
} {accounts.map(account => onClick(account.id)} />)}
); }