import "./ProfilePage.css"; import Nostrich from "../nostrich.jpg"; import { useEffect, useMemo, useState } from "react"; import { useSelector } from "react-redux"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faQrcode, faGear, faEnvelope } from "@fortawesome/free-solid-svg-icons"; import { useNavigate, useParams } from "react-router-dom"; import useProfile from "../feed/ProfileFeed"; import FollowButton from "../element/FollowButton"; import { extractLnAddress, parseId, hexToBech32 } from "../Util"; import Timeline from "../element/Timeline"; import Text from '../element/Text' import LNURLTip from "../element/LNURLTip"; import Nip05 from "../element/Nip05"; import Copy from "../element/Copy"; import ProfilePreview from "../element/ProfilePreview"; import FollowersList from "../element/FollowersList"; import FollowsList from "../element/FollowsList"; const ProfileTab = { Notes: 0, //Reactions: 1, Followers: 2, Follows: 3 }; export default function ProfilePage() { const params = useParams(); const navigate = useNavigate(); const id = useMemo(() => parseId(params.id), [params]); const user = useProfile(id); const loginPubKey = useSelector(s => s.login.publicKey); const follows = useSelector(s => s.login.follows); const isMe = loginPubKey === id; const [showLnQr, setShowLnQr] = useState(false); const [tab, setTab] = useState(ProfileTab.Notes); const about = Text({ content: user?.about }) const avatarUrl = (user?.picture?.length ?? 0) === 0 ? Nostrich : user?.picture const backgroundImage = `url(${avatarUrl})` const domain = user?.nip05 && user.nip05.split('@')[1] useEffect(() => { setTab(ProfileTab.Notes); }, [params]); function username() { return (