import { useQuery } from '@tanstack/react-query'; import { NoteSkeleton } from '@shared/notes/skeleton'; import { TitleBar } from '@shared/titleBar'; import { WidgetWrapper } from '@shared/widgets'; import { NostrBandUserProfile, type Profile } from '@shared/widgets/nostrBandUserProfile'; import { Widget } from '@utils/types'; interface Response { profiles: Array<{ pubkey: string }>; } export function TrendingAccountsWidget({ params }: { params: Widget }) { const { status, data } = useQuery( ['trending-profiles-widget'], async () => { const res = await fetch('https://api.nostr.band/v0/trending/profiles'); if (!res.ok) { throw new Error('Error'); } const json: Response = await res.json(); if (!json.profiles) return []; return json.profiles; }, { refetchOnMount: false, refetchOnReconnect: false, refetchOnWindowFocus: false, staleTime: Infinity, } ); return (
{status === 'loading' ? (
) : status === 'error' ? (

Sorry, an unexpected error has occurred.

) : (
{data.map((item: Profile) => ( ))}
)}
); }