import { useRef, useState } from "react"; import { useNostrEvents } from "nostr-react"; import KIND20Card from "./KIND20Card"; import { getImageUrl } from "@/utils/utils"; import { Button } from "@/components/ui/button"; import { Skeleton } from "@/components/ui/skeleton"; interface TagFeedProps { tag: string; } const TagFeed: React.FC = ({ tag }) => { const now = useRef(new Date()); // Make sure current time isn't re-rendered const [limit, setLimit] = useState(25); const { events, isLoading } = useNostrEvents({ filter: { // since: dateToUnix(now.current), // all new events from now // since: 0, limit: limit, kinds: [20], "#t": [tag], }, }); const loadMore = () => { setLimit(prevLimit => prevLimit + 25); }; return ( <>
{events.length === 0 && isLoading ? ( <>
) : ( events.map((event) => (
)) )}
{!isLoading && (
)} ); } export default TagFeed;