You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.0 KiB
30 lines
1.0 KiB
import { useFetchFollowings } from '@/hooks' |
|
import { toFollowingList } from '@/lib/link' |
|
import { SecondaryPageLink } from '@/PageManager' |
|
import { useFollowList } from '@/providers/FollowListProvider' |
|
import { useNostr } from '@/providers/NostrProvider' |
|
import { Loader } from 'lucide-react' |
|
import { useTranslation } from 'react-i18next' |
|
|
|
export default function Followings({ pubkey }: { pubkey: string }) { |
|
const { t } = useTranslation() |
|
const { pubkey: accountPubkey } = useNostr() |
|
const { followings: selfFollowings } = useFollowList() |
|
const { followings, isFetching } = useFetchFollowings(pubkey) |
|
|
|
return ( |
|
<SecondaryPageLink |
|
to={toFollowingList(pubkey)} |
|
className="flex gap-1 hover:underline w-fit items-center" |
|
> |
|
{accountPubkey === pubkey ? ( |
|
selfFollowings.length |
|
) : isFetching ? ( |
|
<Loader className="animate-spin size-4" /> |
|
) : ( |
|
followings.length |
|
)} |
|
<div className="text-muted-foreground">{t('Following')}</div> |
|
</SecondaryPageLink> |
|
) |
|
}
|
|
|