import { Tab } from '@headlessui/react'; import { Fragment, useEffect, useState } from 'react'; import { Link, useParams } from 'react-router-dom'; import { UserFeed } from '@app/user/components/feed'; import { UserMetadata } from '@app/user/components/metadata'; import { EditProfileModal } from '@shared/editProfileModal'; import { ThreadsIcon, ZapIcon } from '@shared/icons'; import { Image } from '@shared/image'; import { DEFAULT_AVATAR } from '@stores/constants'; import { useAccount } from '@utils/hooks/useAccount'; import { useProfile } from '@utils/hooks/useProfile'; import { useSocial } from '@utils/hooks/useSocial'; import { shortenKey } from '@utils/shortenKey'; export function UserScreen() { const { pubkey } = useParams(); const { user } = useProfile(pubkey); const { account } = useAccount(); const { status, userFollows, follow, unfollow } = useSocial(); const [followed, setFollowed] = useState(false); const followUser = (pubkey: string) => { try { follow(pubkey); // update state setFollowed(true); } catch (error) { console.log(error); } }; const unfollowUser = (pubkey: string) => { try { unfollow(pubkey); // update state setFollowed(false); } catch (error) { console.log(error); } }; useEffect(() => { if (status === 'success' && userFollows) { if (userFollows.includes(pubkey)) { setFollowed(true); } } }, [status]); return (
{user?.about}