import Area from '@components/common/Area.js'; import { useCustomer, useCustomerDispatch } from '@components/frontStore/customer/CustomerContext.jsx'; import { _ } from '@evershop/evershop/lib/locale/translate/_'; import { Mail, User } from 'lucide-react'; import React from 'react'; import { toast } from 'react-toastify'; interface AccountInfoProps { title?: string; showLogout?: boolean; } export default function AccountInfo({ title, showLogout }: AccountInfoProps) { const { customer: account } = useCustomer(); const { logout } = useCustomerDispatch(); return (
{title &&

{title}

} {showLogout && ( { e.preventDefault(); try { await logout(); window.location.href = '/'; } catch (error) { toast.error(error.message); } }} > {_('Logout')} )}
{account?.fullName}
) }, sortOrder: 10 }, { component: { default: () => (
{account?.email}
) }, sortOrder: 15 } ]} />
); }