import { useEffect, useState } from 'react' import { FaPlus } from 'react-icons/fa6' import { Account, db } from '@/db' import NewAccount from '@/components/accounts/New' import { Avatar } from 'flowbite-react' import { useRouter } from 'next/router' type LayoutProps = { children: React.ReactNode } export default function Layout({ children }: LayoutProps) { const [accounts, setAccounts] = useState>([]) const [openNewModal, setOpenNewModal] = useState(false) const router = useRouter() useEffect(() => { const fn = async () => { const acct = await db.accounts.toArray() setAccounts(acct) if (acct.length === 0) { setOpenNewModal(true) } } fn() }, []) const closeNewModal = async () => { const acct = await db.accounts.toArray() setAccounts(acct) setOpenNewModal(false) } const openAccount = (id: number) => { router.push(`/accounts/${id}`) } const openContextMenu = (id: number) => {} return (
{children}
) }