import { useRef, useState } from "react"; import { useNostrEvents, dateToUnix } from "nostr-react"; import KIND20Card from "./KIND20Card"; import { getImageUrl } from "@/utils/utils"; import { Button } from "@/components/ui/button"; interface FollowerFeedProps { pubkey: string; } const FollowerFeed: React.FC = ({ pubkey }) => { const now = useRef(new Date()); const [limit, setLimit] = useState(20); const { events: following, isLoading: followingLoading } = useNostrEvents({ filter: { kinds: [3], authors: [pubkey], limit: 1, }, }); let followingPubkeys = following.flatMap((event) => event.tags .filter(tag => tag[0] === 'p') .map(tag => tag[1]) ); const { events, isLoading } = useNostrEvents({ filter: { limit: limit, kinds: [20], authors: followingPubkeys, }, }); const loadMore = () => { setLimit(prevLimit => prevLimit + 20); }; return ( <>
{events.map((event) => (
))}
{!isLoading && (
)} ); } export default FollowerFeed;