import { useRef, useState } from "react"; import { useNostrEvents } from "nostr-react"; import { Skeleton } from "@/components/ui/skeleton"; import { Button } from "@/components/ui/button"; import QuickViewKind20NoteCard from "./QuickViewKind20NoteCard"; import { getImageUrl } from "@/utils/utils"; interface FollowerQuickViewFeedProps { pubkey: string; } const FollowerQuickViewFeed: React.FC = ({ pubkey }) => { const now = useRef(new Date()); // Make sure current time isn't re-rendered const [limit, setLimit] = useState(25); 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 + 25); }; return ( <>
{events.length === 0 && isLoading ? ( <>
) : ( events.map((event) => ( )) )}
{!isLoading && (
)} ); } export default FollowerQuickViewFeed;