3 changed files with 57 additions and 23 deletions
@ -0,0 +1,30 @@ |
|||||||
|
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> |
||||||
|
) |
||||||
|
} |
||||||
@ -0,0 +1,22 @@ |
|||||||
|
import { useFetchRelayList } from '@/hooks' |
||||||
|
import { toOthersRelaySettings, toRelaySettings } from '@/lib/link' |
||||||
|
import { SecondaryPageLink } from '@/PageManager' |
||||||
|
import { useNostr } from '@/providers/NostrProvider' |
||||||
|
import { Loader } from 'lucide-react' |
||||||
|
import { useTranslation } from 'react-i18next' |
||||||
|
|
||||||
|
export default function Relays({ pubkey }: { pubkey: string }) { |
||||||
|
const { t } = useTranslation() |
||||||
|
const { pubkey: accountPubkey } = useNostr() |
||||||
|
const { relayList, isFetching } = useFetchRelayList(pubkey) |
||||||
|
|
||||||
|
return ( |
||||||
|
<SecondaryPageLink |
||||||
|
to={accountPubkey === pubkey ? toRelaySettings('mailbox') : toOthersRelaySettings(pubkey)} |
||||||
|
className="flex gap-1 hover:underline w-fit items-center" |
||||||
|
> |
||||||
|
{isFetching ? <Loader className="animate-spin size-4" /> : relayList.originalRelays.length} |
||||||
|
<div className="text-muted-foreground">{t('Relays')}</div> |
||||||
|
</SecondaryPageLink> |
||||||
|
) |
||||||
|
} |
||||||
Loading…
Reference in new issue