import { Dialog, Transition } from '@headlessui/react'; import { Fragment, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { User } from '@app/auth/components/user'; import { CancelIcon, LoaderIcon, PlusIcon } from '@shared/icons'; import { useAccount } from '@utils/hooks/useAccount'; export function NewMessageModal() { const navigate = useNavigate(); const [isOpen, setIsOpen] = useState(false); const { status, account } = useAccount(); const follows = account ? JSON.parse(account.follows) : []; const closeModal = () => { setIsOpen(false); }; const openModal = () => { setIsOpen(true); }; const openChat = (pubkey: string) => { closeModal(); navigate(`/app/chat/${pubkey}`); }; return ( <> openModal()} className="inline-flex h-9 items-center gap-2.5 rounded-md px-2.5" > New chat New chat All messages will be encrypted, but anyone can see who you chat {status === 'loading' ? ( ) : ( follows.map((follow) => ( openChat(follow)} className="inline-flex w-max translate-x-20 transform rounded border-t border-zinc-600/50 bg-zinc-700 px-3 py-1.5 text-sm transition-transform duration-150 ease-in-out hover:bg-fuchsia-500 group-hover:translate-x-0" > Chat )) )} > ); }