feat: nip05 feeds
This commit is contained in:
parent
e08172f4a7
commit
5619905ae0
28 changed files with 395 additions and 165 deletions
|
|
@ -1,9 +1,12 @@
|
|||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
import { useFetchProfile } from '@/hooks'
|
||||
import { useFetchNip05 } from '@/hooks/useFetchNip05'
|
||||
import { toNoteList } from '@/lib/link'
|
||||
import { SecondaryPageLink } from '@/PageManager'
|
||||
import { BadgeAlert, BadgeCheck } from 'lucide-react'
|
||||
import { Favicon } from '../Favicon'
|
||||
|
||||
export default function Nip05({ pubkey }: { pubkey: string }) {
|
||||
export default function Nip05({ pubkey, append }: { pubkey: string; append?: string }) {
|
||||
const { profile } = useFetchProfile(pubkey)
|
||||
const { nip05IsVerified, nip05Name, nip05Domain, isFetching } = useFetchNip05(
|
||||
profile?.nip05,
|
||||
|
|
@ -13,30 +16,27 @@ export default function Nip05({ pubkey }: { pubkey: string }) {
|
|||
if (isFetching) {
|
||||
return (
|
||||
<div className="flex items-center py-1">
|
||||
<Skeleton className="h-3 w-20" />
|
||||
<Skeleton className="h-3 w-16" />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
if (!profile?.nip05) return null
|
||||
if (!profile?.nip05 || !nip05Name || !nip05Domain) return null
|
||||
|
||||
return (
|
||||
nip05Name &&
|
||||
nip05Domain && (
|
||||
<div className="flex items-center space-x-1 truncate">
|
||||
{nip05Name !== '_' ? (
|
||||
<div className="text-sm text-muted-foreground truncate">@{nip05Name}</div>
|
||||
) : null}
|
||||
<a
|
||||
href={`https://${nip05Domain}`}
|
||||
target="_blank"
|
||||
className={`flex items-center space-x-1 hover:underline truncate ${nip05IsVerified ? 'text-primary' : 'text-muted-foreground'}`}
|
||||
rel="noreferrer"
|
||||
>
|
||||
{nip05IsVerified ? <BadgeCheck className="size-4" /> : <BadgeAlert className="size-4" />}
|
||||
<div className="text-sm truncate">{nip05Domain}</div>
|
||||
</a>
|
||||
</div>
|
||||
)
|
||||
<div className="flex items-center gap-1 truncate" onClick={(e) => e.stopPropagation()}>
|
||||
{nip05Name !== '_' ? (
|
||||
<span className="text-sm text-muted-foreground truncate">@{nip05Name}</span>
|
||||
) : null}
|
||||
<SecondaryPageLink
|
||||
to={toNoteList({ domain: nip05Domain })}
|
||||
className={`flex items-center gap-1 hover:underline truncate [&_svg]:size-3.5 [&_svg]:shrink-0 ${nip05IsVerified ? 'text-primary' : 'text-muted-foreground'}`}
|
||||
>
|
||||
{nip05IsVerified ? <BadgeCheck /> : <BadgeAlert />}
|
||||
<span className="text-sm truncate">{nip05Domain}</span>
|
||||
</SecondaryPageLink>
|
||||
<Favicon domain={nip05Domain} className="w-3.5 h-3.5" />
|
||||
{append && <span className="text-sm text-muted-foreground truncate">{append}</span>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue