import { useDbContext } from "@/context/db/db"; import { type LocalAccount, useAccountRepo } from "@/repository/account"; import { CirclePlus, User } from "lucide-react"; import { useEffect, useState, type FC } from "react"; const AccountList: FC = () => { const [accounts, setAccounts] = useState([]); const repo = useAccountRepo(); const { connected } = useDbContext(); useEffect(() => { if (connected) repo.loadAll().then(setAccounts); // eslint-disable-next-line react-hooks/exhaustive-deps }, [connected]); if (!connected) { return (
Loading...
); } return ( <> {accounts.map((account) => (
{account.profilePicture ? ( profile ) : (
)}

{account.label}

{account.email}

))}

Add new account

); }; export default AccountList;