import type { AccountFragment } from "@hey/indexer"; import type { ReactNode } from "react"; import { memo } from "react"; import FallbackAccountName from "@/components/Shared/FallbackAccountName"; interface AccountsProps { context?: string; accounts: AccountFragment[]; } const Accounts = ({ context, accounts }: AccountsProps) => { const Wrapper = ({ children }: { children: ReactNode }) => ( <> {children} {context && {context}} ); const accountOne = accounts[0]; const accountTwo = accounts[1]; const accountThree = accounts[2]; if (accounts.length === 1) { return ( ); } const andSep = " and "; if (accounts.length === 2) { return ( ); } if (accounts.length >= 3) { const additionalCount = accounts.length - 3; return ( 0 && ( {andSep} {additionalCount} {additionalCount === 1 ? "other" : "others"} ) } /> ); } return null; }; export default memo(Accounts);