import "./ProfilePreview.css"; import { ReactNode } from "react"; import ProfileImage from "./ProfileImage"; import FollowButton from "./FollowButton"; import useProfile from "../feed/ProfileFeed"; import { HexKey } from "../nostr"; import { useInView } from "react-intersection-observer"; export interface ProfilePreviewProps { pubkey: HexKey, options?: { about?: boolean }, actions?: ReactNode } export default function ProfilePreview(props: ProfilePreviewProps) { const pubkey = props.pubkey; const user = useProfile(pubkey)?.get(pubkey); const { ref, inView } = useInView({ triggerOnce: true }); const options = { about: true, ...props.options }; return (
{inView && <> {user?.about}
: undefined} /> {props.actions ?? } } ) }