feat: 💨

This commit is contained in:
codytseng
2025-07-09 14:54:38 +08:00
parent 5d1427db31
commit f316ef1946
2 changed files with 13 additions and 13 deletions

View File

@@ -25,7 +25,7 @@ export default function Nip05({ pubkey, append }: { pubkey: string; append?: str
return ( return (
<div <div
className="flex items-center gap-1 truncate [&_svg]:size-3.5 [&_svg]:shrink-0" className="flex items-center gap-1 truncate [&_svg]:!size-3.5 [&_svg]:shrink-0"
onClick={(e) => e.stopPropagation()} onClick={(e) => e.stopPropagation()}
> >
{nip05Name !== '_' ? ( {nip05Name !== '_' ? (

View File

@@ -1,15 +1,16 @@
import { SecondaryPageLink } from '@/PageManager' import { SecondaryPageLink } from '@/PageManager'
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
import { CommandDialog, CommandInput, CommandItem, CommandList } from '@/components/ui/command' import { CommandDialog, CommandInput, CommandItem, CommandList } from '@/components/ui/command'
import { useSearchProfiles } from '@/hooks' import { useSearchProfiles } from '@/hooks'
import { toNote, toNoteList, toProfile, toProfileList, toRelay } from '@/lib/link' import { toNote, toNoteList, toProfile, toProfileList, toRelay } from '@/lib/link'
import { generateImageByPubkey } from '@/lib/pubkey'
import { normalizeUrl } from '@/lib/url' import { normalizeUrl } from '@/lib/url'
import { TProfile } from '@/types' import { TProfile } from '@/types'
import { Hash, Notebook, Server, UserRound } from 'lucide-react' import { Hash, Notebook, Server, UserRound } from 'lucide-react'
import { nip19 } from 'nostr-tools' import { nip19 } from 'nostr-tools'
import { Dispatch, useEffect, useMemo, useState } from 'react' import { Dispatch, useEffect, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import Nip05 from '../Nip05'
import UserAvatar from '../UserAvatar'
import Username from '../Username'
export function SearchDialog({ open, setOpen }: { open: boolean; setOpen: Dispatch<boolean> }) { export function SearchDialog({ open, setOpen }: { open: boolean; setOpen: Dispatch<boolean> }) {
const { t } = useTranslation() const { t } = useTranslation()
@@ -142,16 +143,15 @@ function ProfileItem({ profile, onClick }: { profile: TProfile; onClick?: () =>
return ( return (
<SecondaryPageLink to={toProfile(profile.pubkey)} onClick={onClick}> <SecondaryPageLink to={toProfile(profile.pubkey)} onClick={onClick}>
<CommandItem value={`profile-${profile.pubkey}`}> <CommandItem value={`profile-${profile.pubkey}`}>
<div className="flex gap-2"> <div className="flex gap-2 items-center pointer-events-none">
<Avatar> <UserAvatar userId={profile.pubkey} className="shrink-0" />
<AvatarImage src={profile.avatar} alt={profile.username} /> <div className="w-full overflow-hidden">
<AvatarFallback> <Username
<img src={generateImageByPubkey(profile.pubkey)} alt={profile.username} /> userId={profile.pubkey}
</AvatarFallback> className="font-semibold truncate max-w-full w-fit"
</Avatar> skeletonClassName="h-4"
<div> />
<div className="font-semibold">{profile.username}</div> <Nip05 pubkey={profile.pubkey} />
<div className="line-clamp-1 text-muted-foreground">{profile.about}</div>
</div> </div>
</div> </div>
</CommandItem> </CommandItem>